This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Keep lattice abstract in the SSA propagator, substitue lattice values at defs


On Sun, 8 Aug 2010, Richard Guenther wrote:

> On Sun, 8 Aug 2010, Paolo Bonzini wrote:
> 
> > On 08/08/2010 04:44 AM, Richard Guenther wrote:
> > > arithmetic.  But - we can do so if reassociating constants only
> > > as in the example above.  Because if (L43b_216 - 1) - 2147483648
> > > doesn't overflow then L43b_216 + 2147483647 doesn't either.
> > 
> > Huh?
> > 
> > a - 1 - 2147483648 is valid if a >= 1.
> >
> > a + 2147483647 is valid if a < 1.
> 
> Oh, indeed.  Hm.  I guess we have to be more careful with
> constant-folding in reassoc ... (and it's one more reason for
> me to pick up no-undefined-overflow again ...).
> 
> I guess as I have exposed the issue I have to look into it.

C testcase which already fold messes up (well, exposes bogus
IL to VRP):

extern void abort (void);
int i = 1;
int main()
{
  if ((i - 1) - (-__INT_MAX__ - 1) != (-__INT_MAX__ - 1))
    abort ();
  return 0;
}

Testcase which forwprop breaks (via fold) with -fstrict-overflow:

extern void abort (void);
int i = 1;
int main()
{
  int j = i - 1;
  j = j - (-__INT_MAX__ - 1);
  if (j != (-__INT_MAX__ - 1))
    abort ();
  return 0;
}

Bah.

Richard.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]