egcs_2_95 - possible bug with padding?

Marcus Meissner
Fri May 21 05:27:00 GMT 1999


I get different results for running the following testprogram on
the target "i586-pc-linux-gnu".
#include <stdio.h>

#pragma pack(1)
#pragma pack()

struct foo {
	int	a;
	short	b;
main() {
	printf("sizeof(foo) = %d\n",sizeof(struct foo));
Both compiled with "gcc -o xx xx.c"

"gcc version egcs-2.91.60 19981201 (egcs-1.1.1 release)" gives:
	sizeof(foo) = 8
"gcc version gcc-2.95 19990520 (prerelease)" gives:
	sizeof(foo) = 6

I am not quite sure this is an egcs bug, since it sort of abuses an
undocumented feature.


Ciao, Marcus

More information about the Gcc-bugs mailing list