This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

I: gcc 3.0.1 bug


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 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]