🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gcc.bug
Article #6028

Re: Incorrect size of structure on m68k-sun-sunos4.1.1 gcc2.7.2

#6028
From: Andreas Schwab
Date: Mon, 06 Jan 1997 00:00
36 lines
2082 bytes
Nate Bohlmann <njb@elfwerks.com> writes:

|> I have discovered a bug in the 2.7.2 version of GCC which causes the
|> compiler to miscalculate the size of a structure for an m68k-sun-sunos4.1.1
|> machine.  The following structure should be one byte in length but the 
|> compiler calculates it as two bytes.

|> struct FlagByte{
|> 	unsigned char flag1 : 1;
|> 	unsigned char flag2 : 1;
|> 	unsigned char flag3 : 1;
|> 	unsigned char flag4 : 1;
|> 	unsigned char flag5 : 1;
|> 	unsigned char flag6 : 1;
|> 	unsigned char flag7 : 1;
|> 	unsigned char flag8 : 1;
|> }

|> this code generates the following stab:

|> .stabs "FlagByte:T20=s2flag1:11,0,1;flag2:11,1,1;\\",128,0,0,0
|> .stabs "flag3:11,2,1;flag4:11,3,1;flag5:11,4,1;\\",128,0,0,0
|> .stabs "flag5:11,2,1;flag6:11,3,1;flag7:11,4,1;\\",128,0,0,0

|> This seems to occur for all odd-numbered length structs so it looks like
|> the compiler is promoting the length to be on a word boundry.

This is a target option, it's called STRUCTURE_SIZE_BOUNDARY.  Check the
machine description whether this is defined.  Are you sure that the SunOS
compiler does no alignment on structure sizes?  After all, the Sun3
configuration is a very old one, and surely was once written to be
compatible with the native compiler.
-- 
Andreas Schwab                                      "And now for something
schwab@issan.informatik.uni-dortmund.de              completely different"
Technical Details
Message-ID: <vyzrajzcdoz.fsf@issan.informatik.uni-dortmund.de>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <9701060157.AA07344@vu-alumni.elfwerks.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 113d02,24e06586982adde0
X-Google-Attributes: gid113d02,public
From: schwab@issan.informatik.uni-dortmund.de (Andreas Schwab)
Subject: Re: Incorrect size of structure on m68k-sun-sunos4.1.1 gcc2.7.2
Date: 1997/01/06
Message-ID: <vyzrajzcdoz.fsf@issan.informatik.uni-dortmund.de>
X-Deja-AN: 208029921
sender: schwab@issan.informatik.uni-dortmund.de
references: <9701060157.AA07344@vu-alumni.elfwerks.com>
organization: Dortmund University, Germany
x-gateway: relay3.UU.NET from bug-gcc to gnu.gcc.bug; Mon, 6 Jan 1997 05:16:13 EST
newsgroups: gnu.gcc.bug