🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gcc.bug
Article #2864

Alignment bug in 1.36.93

#2864
From: Tom Wood
Date: Fri, 09 Feb 1990 20:32
48 lines
1559 bytes
With the 1.36.93 version of GCC and this input file, I get a bad
alignment error:

	as: error (jackson-align.s:14): Odd address

Here's the source:

extern char *reg_names[1];

char *hello= "hi";
char *reg_names[] = { "fp31", };

Here's the sun output:

#NO_APP
gcc_compiled.:
.globl _hello
.data
LC0:
	.ascii "hi\0"
	.even
_hello:
	.long LC0
.globl _reg_names
LC1:
	.ascii "fp31\0"
_reg_names:
	.long LC1
 
Notice that there is no invocation of ASM_OUTPUT_ALIGN before the label
_reg_names.  The relevant code in varasm.c (around line 549) is:

  /* Output the alignment of this data.  */
  for (i = 0; DECL_ALIGN (decl) >= BITS_PER_UNIT << (i + 1); i++);
  if (i > 0)
    ASM_OUTPUT_ALIGN (asm_out_file, i);

  /* Output the name(s) of this data.  */
  ASM_OUTPUT_LABEL (asm_out_file, name);

In this case, DECL_ALIGN (decl) is 1, but if you leave out the array
bounds in the extern declaration it is properly aligned and everything
goes OK.  I think something's going wrong in grokdeclarator\c-decl.c
around about the call to build_decl for the variable.

Film at 11.
-- 
Tom Wood
Technical Details
Message-ID: <9002092033.AA02399@gen-rtx.rtp.dg.com>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!clyde.concordia.ca!uunet!tut.cis.ohio-state.edu!DG-RTP.DG.COM!wood

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!clyde.concordia.ca!uunet!tut.cis.ohio-state.edu!DG-RTP.DG.COM!wood
From: wood@DG-RTP.DG.COM (Tom Wood)
Newsgroups: gnu.gcc.bug
Subject: Alignment bug in 1.36.93
Message-ID: <9002092033.AA02399@gen-rtx.rtp.dg.com>
Date: 9 Feb 90 20:32:57 GMT
Sender: daemon@tut.cis.ohio-state.edu
Reply-To: wood@dg-rtp.dg.com
Distribution: gnu
Organization: Data General, RTP, NC
Lines: 48