[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [csmith-dev] Pragma pack clang/gcc difference



Thanks, Pascal. I believe the bug is fixed in commit 9a88a2.

 

GCC provides an option -mms-bitfields to force packed struct layout identical to VC++. I found with that the output of your toy program is 8!  This is indeed agree with VC++. Seems Clang is the most efficient packer among the three. J

 

-Xuejun

 

From: Pascal Cuoq [mailto:pascal.cuoq@gmail.com]
Sent: Sunday, August 14, 2011 1:41 PM
To: Xuejun Yang
Cc: csmith-dev@flux.utah.edu
Subject: Re: [csmith-dev] Pragma pack clang/gcc difference

 

Here is the unreduced program. I have modified it a bit in order to understand what was happening, so I suggest you regenerate it from the header information. I unfortunately erased the original when I understood what was happening (which seemed benign enough to me).

The compilations below are for a 64-bit little-endian platform.

 

~/csmith_new$ clang -Iruntime t.c

~/csmith_new$ ./a.out 

checksum = 94020CBC

~/csmith_new$ gcc -Iruntime t.c

t.c:36: warning: overflow in implicit constant conversion

t.c:36: warning: overflow in implicit constant conversion

t.c:36: warning: large integer implicitly truncated to unsigned type

~/csmith_new$ ./a.out 

checksum = C3DA6B5

 

Pascal