[regehr@gamow tmp438]$ current-gcc -O0 small.c -o small [regehr@gamow tmp438]$ ./small 1 [regehr@gamow tmp438]$ current-gcc -O1 small.c -o small [regehr@gamow tmp438]$ ./small 0 [regehr@gamow tmp438]$ current-gcc -v Using built-in specs. COLLECT_GCC=current-gcc COLLECT_LTO_WRAPPER=/uusoc/exports/scratch/regehr/z/compiler-install/gcc-r168402-install/bin/../libexec/gcc/x86_64-unknown-linux-gnu/4.6.0/lto-wrapper Target: x86_64-unknown-linux-gnu Configured with: ../configure --with-libelf=/usr/local --enable-lto --prefix=/home/regehr/z/compiler-install/gcc-r168402-install --program-prefix=r168402- --enable-languages=c,c++ Thread model: posix gcc version 4.6.0 20110102 (experimental) (GCC) [regehr@gamow tmp438]$ cat small.c static unsigned int g_1; static signed char g_2 = 0x81; int printf(const char *format, ...); static unsigned char foo(unsigned char p1, unsigned char p2) { return p1 * p2; } int main (void) { int l_5[2]; int i; for (i = 0; i < 2; i++) l_5[i] = 1; g_1 = g_2 <= foo(-6, l_5[0]); printf("%u\n", g_1); return 0; }
Indeed, caused by my PR47140 patch.
Created attachment 22884 [details] gcc46-pr47155.patch Untested fix.
Author: jakub Date: Mon Jan 3 21:01:14 2011 New Revision: 168440 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=168440 Log: PR tree-optimization/47155 * tree-ssa-ccp.c (bit_value_binop_1): Use r1type instead of type when computing uns. * gcc.c-torture/execute/pr47155.c: New test. Added: trunk/gcc/testsuite/gcc.c-torture/execute/pr47155.c Modified: trunk/gcc/ChangeLog trunk/gcc/testsuite/ChangeLog trunk/gcc/tree-ssa-ccp.c
Fixed.