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] 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
--


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