[PATCH] Fix PR26898, folding of X +- C1 CMP Y +- C2
Roger Sayle
roger@eyesopen.com
Thu Mar 30 14:05:00 GMT 2006
On Thu, 30 Mar 2006, Joseph S. Myers wrote:
> On Thu, 30 Mar 2006, Richard Guenther wrote:
>
> > 2006-03-29 Richard Guenther <rguenther@suse.de>
> >
> > PR middle-end/26898
> > * fold-const.c (fold_comparison): Fold signed comparisons
> > of the form X +- C1 CMP Y +- C2.
>
> This miscompiles:
>
> int a = 0, b = __INT_MAX__ - 1;
> extern void abort(void);
> extern void exit(int);
> int
> main(void)
> {
> if (a - 1 > b + 1)
> abort();
> exit(0);
> }
Thanks! Good catch. I must still be thinking in Fortran :}
Roger
--
More information about the Gcc-patches
mailing list