With -funsafe-loop-optimizations in flags, pr27285.c FAILs: FAIL: gcc.c-torture/execute/pr27285.c execution, -O1 FAIL: gcc.c-torture/execute/pr27285.c execution, -O2 FAIL: gcc.c-torture/execute/pr27285.c execution, -O3 -fomit-frame-pointer FAIL: gcc.c-torture/execute/pr27285.c execution, -O3 -fomit-frame-pointer -funroll-loops FAIL: gcc.c-torture/execute/pr27285.c execution, -O3 -fomit-frame-pointer -funroll-all-loops -finline-functions FAIL: gcc.c-torture/execute/pr27285.c execution, -O3 -g FAIL: gcc.c-torture/execute/pr27285.c execution, -O2 -flto FAIL: gcc.c-torture/execute/pr27285.c execution, -O2 -fwhopr
Output: $ gcc -O -funsafe-loop-optimizations pr27285.i -Wunsafe-loop-optimizations /mnt/svn/gcc-trunk/gcc/testsuite/gcc.c-torture/execute/pr27285.c: In function 'foo': /mnt/svn/gcc-trunk/gcc/testsuite/gcc.c-torture/execute/pr27285.c:19:10: warning: assuming that the loop counter does not overflow [-Wunsafe-loop-optimizations] /mnt/svn/gcc-trunk/gcc/testsuite/gcc.c-torture/execute/pr27285.c:17:9: warning: assuming that the loop counter does not overflow [-Wunsafe-loop-optimizations] $ ./a.out Aborted There is no overflow in the loop. When compiled with -funsafe-loop-optimizations, the loop is exited when 'b' has value 1 (that is, e[a] = d[a] & c; is not executed when b == 0). 'b' has values of 25,17,19,1 (and then the loop ends) - without -funsafe-loop-optimizations, it has values 25,17,19,1,0. Even though -funsafe-loop-optimizations is expected to be unsafe, this behaviour makes it unusable. The loop is finite and the counter doesn't overflow, so this is a wrong code generated. Tested revisions: r162653 - fail r162456 - OK -- Summary: [4.6 Regression] -funsafe-loop-optimizations causes FAIL: gcc.c-torture/execute/pr27285.c execution Product: gcc Version: 4.6.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: zsojka at seznam dot cz GCC host triplet: x86_64-pc-linux-gnu GCC target triplet: x86_64-pc-linux-gnu http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45122