I found another compiler bug!

Jonathan Lanier jonathan@westwood.com
Wed May 7 15:22:00 GMT 1997


Attached is an example of a serious bug in the GCC compiler.  The gist of 
it is, if you use packed structures in GCC, and then attempt to use 
bitfields in those packed structures, the compiler completely 
miscalculates the offsets for the data in the structure.

This example demonstrates a C++ class containing only 2 members.  Each 
one is initialized separately, and the resulting answers printed for each 
member should be different, but they are not.  Removing the 
__attribute__((packed)) keyword gets rid of the error, but it means you 
can't pack your structures, which in my case is something I really need 
to do!

Does anyone know if this bug was previously known, or if it exists on 
other architectures?

- Jonathan
  jonathan@westwood.com


More information about the Cygwin mailing list