Bug in gcc 2.9.51 with -fpack-struct on Linux i386
Martin v. Loewis
martin@mira.isdn.cs.tu-berlin.de
Fri Dec 31 20:54:00 GMT 1999
> I think I found a bug in gcc 2.9.51 when compiling on i386 Linux. I
> first recognized it when a code sequence like
Thanks for your bug report. I could reproduce it with gcc-2.95.2; the
mainline compiler (2.96 19991202 (experimental)) seems to work fine.
Please note that -fpack-struct has undesired side effects, as it
applies to all structures - including those used by e.g. stdio, which
gives you an incompatibility with the Linux C library.
It is better to define packing on a structure-by-structure basis. If
you say
typedef struct{
unsigned char a;
unsigned short b;
unsigned char c;
unsigned short d;
char e[3];
} __attribute__((packed)) SampleStruct ;
you declare that only the structure is packed; this works on 2.95.x as
well.
Regards,
Martin
More information about the Gcc-bugs
mailing list