Re: [RFA][PATCH] Fix tree-optimization/57144

2013-05-03 Thread Jeff Law
On 05/02/2013 11:56 PM, Jakub Jelinek wrote: On Thu, May 02, 2013 at 10:30:57PM -0600, Jeff Law wrote: --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr57144.c @@ -0,0 +1,15 @@ +__attribute__ ((noinline)) +foo(int a) +{ + int z = a > 0 ? a : -a; + long x = z; + if (x > 0x1) +

Re: [RFA][PATCH] Fix tree-optimization/57144

2013-05-03 Thread Richard Biener
On Fri, May 3, 2013 at 6:30 AM, Jeff Law wrote: > > When we have > > x = (T) y; > if (x > CONST) > true arm > else > false arm > > Assume CONST is larger than what can be represented in T. If we use > fold_convert, any bits not not in T will be dropped. So if CONST is say > 0x1 and T

Re: [RFA][PATCH] Fix tree-optimization/57144

2013-05-02 Thread Jakub Jelinek
On Thu, May 02, 2013 at 10:30:57PM -0600, Jeff Law wrote: > --- /dev/null > +++ b/gcc/testsuite/gcc.c-torture/execute/pr57144.c > @@ -0,0 +1,15 @@ > +__attribute__ ((noinline)) > +foo(int a) > +{ > + int z = a > 0 ? a : -a; > + long x = z; > + if (x > 0x1) > +abort (); > + else > +

[RFA][PATCH] Fix tree-optimization/57144

2013-05-02 Thread Jeff Law
When we have x = (T) y; if (x > CONST) true arm else false arm Assume CONST is larger than what can be represented in T. If we use fold_convert, any bits not not in T will be dropped. So if CONST is say 0x1 and T is a 32 bit type, the returned constant will be 0x0. So we change