On Tue, Nov 26, 2013 at 02:15:58PM -0700, Jeff Law wrote: > On 11/26/13 13:33, Jakub Jelinek wrote: > >Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk? > > > >I'll try to create a testcase for 4.8 branch tomorrow.
I've managed to create a testcase which reproduces this on 4.8 too, so I've committed it to trunk and committed both the patch from yesterday and this one to 4.8 branch too. 2013-11-27 Jakub Jelinek <ja...@redhat.com> PR tree-optimization/59014 * gcc.c-torture/execute/pr59014-2.c: New test. --- gcc/testsuite/gcc.c-torture/execute/pr59014-2.c 2013-08-25 18:20:55.717911035 +0200 +++ gcc/testsuite/gcc.c-torture/execute/pr59014-2.c 2013-11-27 15:31:09.833340947 +0100 @@ -0,0 +1,23 @@ +/* PR tree-optimization/59014 */ + +__attribute__((noinline, noclone)) long long int +foo (long long int x, long long int y) +{ + if (((int) x | (int) y) != 0) + return 6; + return x + y; +} + +int +main () +{ + if (sizeof (long long) == sizeof (int)) + return 0; + int shift_half = sizeof (int) * __CHAR_BIT__ / 2; + long long int x = (3LL << shift_half) << shift_half; + long long int y = (5LL << shift_half) << shift_half; + long long int z = foo (x, y); + if (z != ((8LL << shift_half) << shift_half)) + __builtin_abort (); + return 0; +} Jakub