I: gcc 3.0.1 bug

Cyril Malkov malkov@lostpassword.com
Sun Sep 30 15:34:00 GMT 2001


Hello!

The following code:
---------------
#include "stdio.h"

typedef unsigned int ulong;
typedef unsigned short int ushort;

void func( ulong crc )
{
  ushort d = *( (ushort*)&crc + 1 );
  printf( "%X, %X\n", crc, d );
}

int main()
{
  ulong crc = 0x12345678;

  func( crc );
  func( crc );
  func( crc );

  return 0;
}
------------
After compiling with 'g++ -O3 t.cpp' it prints the following:

12345678, 804
12345678, 804
12345678, BFFF

===
Cyril Malkov, Passware,
Software Development Director,
http://www.lostpassword.com 



More information about the Gcc-bugs mailing list