For the source code below, compiling gcc -O2/-O3 seem to produce incorrect code.
----------------------------------- #include <stdio.h> int main(int argc, char* argv[]) { unsigned int x = 0x12345678; unsigned short tmp; printf("%x\n", x); tmp = ((unsigned short *)&x)[0]; ((unsigned short *)&x)[0] = ((unsigned short *)&x)[1]; ((unsigned short *)&x)[1] = tmp; printf("%x\n", x); return 0; } ----------------------------------- % gcc -O1 a.c % ./a.out 12345678 56781234 % gcc -O2 a.c % ./a.out 12345678 12341234 % gcc -v Using built-in specs. Configured with: FreeBSD/i386 system compiler Thread model: posix gcc version 3.2.1 [FreeBSD] 20021009 (prerelease) Is this a gcc bug or the source code problem ? To Unsubscribe: send mail to [EMAIL PROTECTED] with "unsubscribe freebsd-current" in the body of the message