pr28651.c (main): Use INT_MAX instead of assuming it is 0x7fffffff.

* 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.

From-SVN: r126989
This commit is contained in:
Rask Ingemann Lambertsen 2007-07-27 19:27:57 +02:00 committed by Rask Ingemann Lambertsen
parent bd12160ab8
commit f017014e09
4 changed files with 16 additions and 6 deletions

View File

@ -1,3 +1,10 @@
2007-07-27 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.
2007-07-27 Mark Mitchell <mark@codesourcery.com>
PR c++/32346

View File

@ -1,3 +1,5 @@
#include <limits.h>
extern void abort (void);
int __attribute__((noinline))
foo (unsigned int u)
@ -8,7 +10,7 @@ foo (unsigned int u)
int
main (int argc, char *argv[])
{
unsigned int u = 0x7fffffff;
unsigned int u = INT_MAX;
if (foo (u) == 0)
abort();

View File

@ -60,8 +60,8 @@ void h (int x)
uc = '\xa0'; /* Warned by -Wsign-conversion. */
fui ('\xa0'); /* Warned by -Wsign-conversion. */
ui = '\xa0'; /* Warned by -Wsign-conversion. */
fsi (0x80000000); /* Warned by -Wsign-conversion. */
si = 0x80000000; /* Warned by -Wsign-conversion. */
fsi ((unsigned) INT_MAX + 1U); /* Warned by -Wsign-conversion. */
si = (unsigned) INT_MAX + 1U; /* Warned by -Wsign-conversion. */
fsi (UINT_MAX - 1); /* Warned by -Wsign-conversion. */

View File

@ -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;
}