This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Fix PR26898, folding of X +- C1 CMP Y +- C2
- From: Roger Sayle <roger at eyesopen dot com>
- To: "Joseph S. Myers" <joseph at codesourcery dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Thu, 30 Mar 2006 06:45:29 -0700 (MST)
- Subject: Re: [PATCH] Fix PR26898, folding of X +- C1 CMP Y +- C2
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
--