From mboxrd@z Thu Jan 1 00:00:00 1970 From: Doug Semler To: Robert Lipe Cc: "David A. Greene" , "Martin v. Loewis" , egcs@egcs.cygnus.com Subject: Re: egcs and bitfields Date: Wed, 31 Mar 1999 23:46:00 -0000 Message-ID: <199903121741.JAA24401@vortex.seaspace.com> References: <19990312104540.D1570@rjlhome.sco.com> X-SW-Source: 1999-03n/msg00466.html Message-ID: <19990331234600._aqWtulvwVx8XitL0jyFLR_3jqL7oAfKptEPJBjw1fs@z> > > #include > > > > struct foo { int c:3; } x = { 7 }; > > > > int main(void) > > { > > printf("%d\n", x.c); > > > > return(0); > > } > > > > >>-drakh-> egcc fieldinit.c > > >>-drakh-> ./a.out > > -1 > > > > I think the output should be 7, since an "int" > > bitfield is supposed > > to be unsigned according to the i386 SysV ABI. > > While I can't comment on any correctness issues in the example or > pertinence of various ABI specs, I can confirm that your example behaves > differently on different System V/386's. > > > On OpenServer: > /bin/cc -1 > egcs 1.1.1 -1 > icc 7 > udk cc 7 > > On UnixWare 7.0.1 > /bin/cc 7 > egcs 1.1.1 -1 > > > Note that /bin/cc on SVR5 is essentially the same as UDK on OSR5. Since > /bin/cc on OpenServer had parentage in the code that became those two > compilers, I'm guessing that it was an intentional ABI change between > the OpenServer lineage (more iBCS2-ish) and the SVR4 lineage. I am assuming egcs uses the ABI's definition of whether a bitfield is signed or unsigned???? According to the standard (6.7.2) unqualified type int is implementation defined (cf C++ 9.6) So, does egcs use the same implementation across all platforms? --- Doug Semler | doug@seaspace.com SeaSpace Corporation | Garbage In -- Gospel Out Least Senior Software Developer; | Minister of things to do Next Quarter Low Man on the Totem Pole | (but will Never Be Done) DNRC O- A closed mind is a terrible thing | Bus Error (passengers dumped) -----BEGIN GEEK CODE BLOCK----- Version: 3.12 GCS/M d---(pu) s++:- a-- C++ UILSH+++$ P--- L++ E--- W+ N++ o-- K? w--(++$) O- M-- V- PS+ !PE Y PGP t(+) 5+++ X+ R- tv+(-) b+(++) DI++++ D G e++>++++ h!>--- r% y+>+++++** ------END GEEK CODE BLOCK------