This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH 1/5][testsuite] Use INT_MAX instead of 0x7fffffff
On Tue, 24 Jul 2007, Janis Johnson wrote:
> On Tue, 2007-07-24 at 18:07 +0200, Rask Ingemann Lambertsen wrote:
> > This patch fixes three testcases which assume INT_MAX is 0x7fffffff. Ok
> > for trunk?
> >
> > :ADDPATCH testsuite:
> >
> > 2007-07-24 Rask Ingemann Lambertsen <rask@sygehus.dk>
> >
> > * gcc.c-torture/execute/pr28651.c (main): Use INT_MAX instead of
> > assuming it is 0x7fffffff.
> > * gcc.dg/tree-ssa/vrp29.c (decCompare)(main): Likewise.
> > * gcc.dg/Wconversion-integer-no-sign.c (h): Likewise.
>
> :REVIEWMAIL:
>
> The first and third are OK but I'm not sure about the second.
> Richard Guenther, do the changes to the additions in vrp29.c
> require additional casts?
I think they are fine. INT_MAX + 1U is promoted to unsigned arithmetic.
Rask, did you verify we still constant fold the constant operations?
(it would be a bug if not, of course).
Richard.
> > Index: gcc.dg/tree-ssa/vrp29.c
> > ===================================================================
> > --- gcc.dg/tree-ssa/vrp29.c (revision 126653)
> > +++ gcc.dg/tree-ssa/vrp29.c (working copy)
> > @@ -1,20 +1,21 @@
> > /* { dg-do run } */
> > /* { dg-options "-O2" } */
> > +#include <limits.h>
> >
> > extern void abort(void);
> >
> > void decCompareOp (int result)
> > {
> > - if (result != (int)0x80000000)
> > + if (result != (int) (INT_MAX + 1U))
> > {
> > result = -result;
> > - if (result != (int)0x80000001)
> > + if (result != (int) (INT_MAX + 2U))
> > abort ();
> > }
> > }
> >
> > int main()
> > {
> > - decCompareOp (0x7fffffff);
> > + decCompareOp (INT_MAX);
> > return 0;
> > }
>
>
>
--
Richard Guenther <rguenther@suse.de>
Novell / SUSE Labs
SUSE LINUX Products GmbH - Nuernberg - AG Nuernberg - HRB 16746 - GF: Markus Rex