Article View: gnu.gcc.bug
Article #1124Re: sun cc vs gcc structure
From: Casper H.S. Dik
Date: Fri, 11 Sep 1992 08:32
Date: Fri, 11 Sep 1992 08:32
31 lines
1690 bytes
1690 bytes
zilla@nj.nec.com (John Lewis) writes: >Hi, >In recompiling a file under gcc 2.2.2 (on sparc2), it seems like gcc >is handling double alignment in a structure differently >than previous versions. >The file needs to be linked with some files compiled with the >normal sun cc; thus I specified -fpcc-struct-return, which did not help. >The following self-contained program illustrates the problem. >The program runs using the sun cc compilation line but fails with a >buss error when run with either of the gcc lines. >================ >/*% cc % -o junk %* OK > *% gcc % -o junk %* BUS ERROR > *% gcc -fpcc-struct-return % -o junk %* BUS ERROR > */ > p += 4; /* make it aligned on 4*/ You mess with the structure alignment requirements. There is no guarantee that your code will continue to work with Sun's cc. (And it doesn't, if you use -dalign) Gcc 2.x assumes that doubles are aligned on 8 byte boundaries. That assumption holds, until people mess with the alignment. Actually, I'm suprised that Sun's compiler doesn't do this by default. Casper -- | Casper H.S. Dik | casper@fwi.uva.nl
Technical Details
Message-ID:
<1992Sep11.083250.29450@fwi.uva.nl>Path:
arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!fwi.uva.nl!casperReferences:
<1992Sep11.042924.22002@research.nj.nec.com>Show Full Headers
Complete Article Headers
Newsgroups: gnu.gcc.bug Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!fwi.uva.nl!casper From: casper@fwi.uva.nl (Casper H.S. Dik) Subject: Re: sun cc vs gcc structure Message-ID: <1992Sep11.083250.29450@fwi.uva.nl> Sender: gnulists@ai.mit.edu Organization: FWI, University of Amsterdam References: <1992Sep11.042924.22002@research.nj.nec.com> Distribution: gnu Date: Fri, 11 Sep 1992 08:32:50 GMT Approved: bug-gcc@prep.ai.mit.edu Lines: 32