(This has been logged as #3024825)

% gcc3 -v
Reading specs from /usr/libexec/gcc/darwin/ppc/3.1/specs
Thread model: posix
Apple Computer, Inc. GCC version 1151, based on gcc version 3.1 
20020420 (prerelease)


   I haven't come up with a small reproducible case, but I know how to 
get rid of the crash in my case...

   I have code that looks like:

static inline void _CPPWriteSwappedValueToBuffer(unsigned int v, 
unsigned char *buf)
{
     assert(sizeof(v) == 4);
     buf[0] = (v & 0x000000ff) >> 0;
     buf[1] = (v & 0x0000ff00) >> 8;
     buf[2] = (v & 0x00ff0000) >> 16;
     buf[3] = (v & 0xff000000) >> 24;
}

static inline void _CPPWriteSwappedValueToBuffer(float v, unsigned char 
*buf)
{
     union {
         float f;
         unsigned int i;
     } x;
     assert(sizeof(x.f) == sizeof(x.i));
     x.f = v;
     _CPPWriteSwappedValueToBuffer(x.i, buf);
}

   If, instead, I create a typedef for the union outside of the function 
scope, the compiler doesn't crash.

   This crash happens when I'm compiling a C++ file that imports the PFE 
that includes the header including the code above.  If I turn off PFE, 
I don't get the crash either, so it looks like a bug in PFE.

   I can possibly provide a big pair of .i files (one for the header and 
one for the source file) for someone at Apple if need be.

-tim

Reply via email to