The current gcc trunk mis-compiles the following code on x86_64-linux at -O3 in 32-bit mode. This is a regression from 4.8.x. $ gcc-trunk -v gcc version 4.9.0 20130710 (experimental) [trunk revision 200864] (GCC) $ $ gcc-trunk -m32 -O3 small.c $ a.out 0 $ gcc-trunk -m32 -O2 small.c $ a.out 1 $ gcc-4.8 -m32 -O3 small.c $ a.out 1 $ ---------------------------------------------------- int printf (const char *, ...); int a, b = 1, c, *d = &c, f, *g, h, j; static int e; int main () { int i; for (i = 0; i < 2; i++) { long long k = b; int l; for (f = 0; f < 8; f++) { int *m = &e; j = *d; h = a * j - 1; *m = (h == 0) < k; g = &l; } } printf ("%d\n", e); return 0; }
This was likely introduced with r200723 and got fixed in r200899.
Author: jakub Date: Tue Aug 27 09:24:52 2013 New Revision: 202018 URL: http://gcc.gnu.org/viewcvs?rev=202018&root=gcc&view=rev Log: PR rtl-optimization/57860 PR rtl-optimization/57861 PR rtl-optimization/57875 PR rtl-optimization/57876 PR rtl-optimization/57877 * gcc.c-torture/execute/pr57860.c: New test. * gcc.c-torture/execute/pr57861.c: New test. * gcc.c-torture/execute/pr57875.c: New test. * gcc.c-torture/execute/pr57876.c: New test. * gcc.c-torture/execute/pr57877.c: New test. Added: trunk/gcc/testsuite/gcc.c-torture/execute/pr57860.c trunk/gcc/testsuite/gcc.c-torture/execute/pr57861.c trunk/gcc/testsuite/gcc.c-torture/execute/pr57875.c trunk/gcc/testsuite/gcc.c-torture/execute/pr57876.c trunk/gcc/testsuite/gcc.c-torture/execute/pr57877.c Modified: trunk/gcc/testsuite/ChangeLog