Date: Fri, 28 May 1999 01:17:31 +0200 From: Ronald de Man To: pgcc AT delorie DOT com Subject: -fcompare-elim Message-ID: <19990528011731.A22985@win.tue.nl> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 0.95.4i X-Operating-System: Linux localhost 2.2.9 Reply-To: pgcc AT delorie DOT com The following little program triggers a bug in pgcc-1.1.3 when compiled with -O2 -fcompare-elim: ----- #define bit(x) bitjes[x]; long long bitjes[64]; long long mvs[64][8]; void SetUp() { int b,x,y,z,b2; long long board; for (b = 0; b < 64; b++) { b2 = b << 1; for ( y = 0; y < 64; y += 8) { board = 0; x = y + 8; z = (y>>3) + 1; while (x < 64) { board |= bit(x); if (b2 & (1<>3)-1; while (x >= 0) { board |= bit(x); if (b2 & (1<>3] = board; } } } main() { int i, j; for (i = 0; i < 64; i++) bitjes[i] = 1ULL << i; SetUp(); for (i = 0; i < 64; i++) for (j = 0; j < 8; j++) printf("%2d %d %lld\n", i, j, mvs[i][j]); } ----- Running the program should give some output, but when compiled with -O2 -fcompare-elim it crashes at the line mvs[b][y>>3] = board; with for b a value of -64. Indeed, looking at the assembly output, it seems pgcc lets b run from -64 to 63. I do not know if this also happens with egcs-1.1.2. Version 1.1.1 of pgcc does not have problems here. Ronald