public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Fix PR testsuite/32471 when INT_MAX is not 0x7fffffff
@ 2007-07-27 16:55 Rask Ingemann Lambertsen
  2007-07-27 20:10 ` Janis Johnson
  0 siblings, 1 reply; 2+ messages in thread
From: Rask Ingemann Lambertsen @ 2007-07-27 16:55 UTC (permalink / raw)
  To: gcc-patches

   This patch fixes the test cases for PR 30364 which test overflow
behaviour of integers. With "gcc version 4.1.2 20061115 (prerelease) (Debian
4.1.1-21)", pr30364-1.c still fails at -O2, which is what bug 30364 was
opened for. For mainline x86_64-unknown-linux-gnu, there are no changes in
test results (they still all pass) while for m32c-unknown-elf, they now all
pass where they all used to fail (for a total of 36 FAILs).

   Ok for trunk?

:ADDPATCH testsuite:

2007-07-27  Rask Ingemann Lambertsen  <rask@sygehus.dk>

	PR testsuite/32471
	gcc.dg/torture/pr30364-1.c (f)(main): Use INT_MAX instead of
	assuming it is 0x7ffffffff.
	gcc.dg/torture/pr30364-2.c (f)(main): Likewise.
	gcc.dg/torture/pr30364-3.c (f)(main): Likewise.

Index: gcc.dg/torture/pr30364-1.c
===================================================================
--- gcc.dg/torture/pr30364-1.c	(revision 126653)
+++ gcc.dg/torture/pr30364-1.c	(working copy)
@@ -1,19 +1,20 @@
 /* { dg-do run } */
 
+#include <limits.h>
 extern void abort (void);
 
 int f(int a, int b)
 {
-  if (a > 0x7FFFFFF0) return 0;
-  if (b > 0x7FFFFFF0) return 0;
+  if (a > INT_MAX - 15) return 0;
+  if (b > INT_MAX - 15) return 0;
 
   int c = (a - 20) + (b - 20);
-  return c > 0x7FFFFFF0;
+  return c > INT_MAX - 15;
 }
 
 int main()
 {
-  if (f (0x7FFFFFF0, 41) != 1)
+  if (f (INT_MAX - 15, 41) != 1)
     abort ();
   return 0;
 }
Index: gcc.dg/torture/pr30364-2.c
===================================================================
--- gcc.dg/torture/pr30364-2.c	(revision 126653)
+++ gcc.dg/torture/pr30364-2.c	(working copy)
@@ -1,19 +1,20 @@
 /* { dg-do run } */
 
+#include <limits.h>
 extern void abort (void);
 
 int f(unsigned int a, unsigned int b)
 {
-  if (a > 0x7FFFFFF0) return 0;
-  if (b > 0x7FFFFFF0) return 0;
+  if (a > INT_MAX - 15) return 0;
+  if (b > INT_MAX - 15) return 0;
 
   int c = (a - 20) + (b - 20);
-  return c > 0x7FFFFFF0;
+  return c > INT_MAX - 15;
 }
 
 int main()
 {
-  if (f (0x7FFFFFF0, 41) != 1)
+  if (f (INT_MAX - 15, 41) != 1)
     abort ();
   return 0;
 }
Index: gcc.dg/torture/pr30364-3.c
===================================================================
--- gcc.dg/torture/pr30364-3.c	(revision 126653)
+++ gcc.dg/torture/pr30364-3.c	(working copy)
@@ -1,20 +1,21 @@
 /* { dg-do run } */
 /* { dg-options "-fwrapv" } */
 
+#include <limits.h>
 extern void abort (void);
 
 int f(int a, int b)
 {
-  if (a > 0x7FFFFFF0) return 0;
-  if (b > 0x7FFFFFF0) return 0;
+  if (a > INT_MAX - 15) return 0;
+  if (b > INT_MAX - 15) return 0;
 
   int c = (a - 20) + (b - 20);
-  return c > 0x7FFFFFF0;
+  return c > INT_MAX - 15;
 }
 
 int main()
 {
-  if (f (0x7FFFFFF0, 41) != 1)
+  if (f (INT_MAX - 15, 41) != 1)
     abort ();
   return 0;
 }

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] Fix PR testsuite/32471 when INT_MAX is not 0x7fffffff
  2007-07-27 16:55 [PATCH] Fix PR testsuite/32471 when INT_MAX is not 0x7fffffff Rask Ingemann Lambertsen
@ 2007-07-27 20:10 ` Janis Johnson
  0 siblings, 0 replies; 2+ messages in thread
From: Janis Johnson @ 2007-07-27 20:10 UTC (permalink / raw)
  To: Rask Ingemann Lambertsen; +Cc: gcc-patches

On Fri, 2007-07-27 at 17:56 +0200, Rask Ingemann Lambertsen wrote:
>    This patch fixes the test cases for PR 30364 which test overflow
> behaviour of integers. With "gcc version 4.1.2 20061115 (prerelease) (Debian
> 4.1.1-21)", pr30364-1.c still fails at -O2, which is what bug 30364 was
> opened for. For mainline x86_64-unknown-linux-gnu, there are no changes in
> test results (they still all pass) while for m32c-unknown-elf, they now all
> pass where they all used to fail (for a total of 36 FAILs).
> 
>    Ok for trunk?

:REVIEWMAIL:

OK.

Janis

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2007-07-27 19:44 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-07-27 16:55 [PATCH] Fix PR testsuite/32471 when INT_MAX is not 0x7fffffff Rask Ingemann Lambertsen
2007-07-27 20:10 ` Janis Johnson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).