Commit f017014e by Rask Ingemann Lambertsen Committed by Rask Ingemann Lambertsen

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
parent bd12160a
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
#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();
......
......@@ -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. */
......
/* { 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;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment