Article View: gnu.gcc.bug
Article #6345gcc 2.7.2: rs6000 long long alignment mismatch
From: Josef Burger
Date: Fri, 01 Dec 1995 00:00
Date: Fri, 01 Dec 1995 00:00
65 lines
2340 bytes
2340 bytes
I have an IBM SP/2 running aix-4.1.[34]. I have discovered a
compatibility problem between gcc-2.7.2 and the IBM xlc compiler.
This problem also exists with earlier versions of gcc (2.6.3 and
2.7.0).
The IBM xlc compiler aligns 'long long' objects to a 8 byte boundary,
and aligns doubles to a 4 byte boundary. Gcc aligns both 'long long'
objects and doubles to a 4 byte boundary. I discovered this when I
noticed structure mismatches between gcc and the native compiler.
I've appended a trivial example which illustrates the problem.
Does anyone have a suggestion of how to fix this bug? Increasing
alignment restrictions to 64 bits won't work, as doubles will have
their alignment broken.
Thanks for any help, suggestions, or whatever!
bolo/Josef Burger
---------------------- example follows ------------------------
sp2(bolo) cat trouble.c
struct trouble {
int a;
#ifdef USE_DOUBLE
double b;
#else
long long b;
#endif
};
main()
{
printf("sizeof(struct trouble) == %d\n", sizeof(struct trouble));
return 0;
}
Here's what the native compiler does ...
sp2(bolo) cc -o ccl c.c
sp2(bolo) cc -o ccd -DUSE_DOUBLE c.c
sp2(bolo) ./ccl
sizeof(struct trouble) == 16
sp2(bolo) ./ccd
sizeof(struct trouble) == 12
And here's what gcc does ...
sp2(bolo) which gcc
/s/gcc-2.7.2/bin/gcc
sp2(bolo) gcc -v
Reading specs from /s/gcc-2.7.2/rs_aix41/lib/gcc-lib/rs6000-ibm-aix4.1.3.0/2.7.s
gcc version 2.7.2
sp2(bolo) gcc -o gcl c.c
sp2(bolo) gcc -o gcd -DUSE_DOUBLE c.c
sp2(bolo) ./gcl
sizeof(struct trouble) == 12
sp2(bolo) ./gcd
sizeof(struct trouble) == 12
--
| Joe Burger U of WI-Madison Computer Sciences | "No matter where you go,
| "bolo" bolo@cs.wisc.edu uwvax!bolo | There you are"
| http://www.cs.wisc.edu/~bolo/ | -- Buckaroo Banzai
Technical Details
Message-ID:
<49o71v$17r@spool.cs.wisc.edu>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 113d02,ef3899a0d8d4cf86,start X-Google-Attributes: gid113d02,public From: bolo@cs.wisc.edu (Josef Burger) Subject: gcc 2.7.2: rs6000 long long alignment mismatch Date: 1995/12/01 Message-ID: <49o71v$17r@spool.cs.wisc.edu> X-Deja-AN: 120615974 distribution: gnu sender: daemon@cis.ohio-state.edu organization: University of WI, Madison -- Computer Sciences Dept. newsgroups: gnu.gcc.bug