[patch, testsuite] Fix pr35634 tests when char is unsigned.

Steve Ellcey sellcey@mips.com
Mon Dec 10 18:33:00 GMT 2012


The tests gcc.dg/torture/pr35634.c and g++.dg/torture/pr35634.C fail for
me on the mips-mti-elf target.  At first I thought it was because 'n'
was not initialized but then I realized it was because 'char' on this
target defaults to 'unsigned char', not 'signed char'.  Since I think
initializing 'n' is still a good idea I made that change as well as making
'c' an explicitly signed char.  This now passes on mips-mti-elf.

OK for checkin?

Steve Ellcey
sellcey@mips.com


2012-12-10  Steve Ellcey  <sellcey@mips.com>

	* gcc.dg/torture/pr35634.c: Initialize n, make c signed.
	* g++.dg/torgure/pr35634.C: Ditto.

diff --git a/gcc/testsuite/g++.dg/torture/pr35634.C b/gcc/testsuite/g++.dg/torture/pr35634.C
index 00848e3..1f03bb1 100644
--- a/gcc/testsuite/g++.dg/torture/pr35634.C
+++ b/gcc/testsuite/g++.dg/torture/pr35634.C
@@ -5,7 +5,7 @@ extern "C" void exit (int);
 
 void foo (int i)
 {
-    static int n;
+    static int n = 0;
     if (i < -128 || i > 127)
         abort ();
     if (++n > 1000)
@@ -14,6 +14,6 @@ void foo (int i)
 
 int main ()
 {
-    char c;
+    signed char c;
     for (c = 0; ; c++) foo (c);
 }
diff --git a/gcc/testsuite/gcc.dg/torture/pr35634.c b/gcc/testsuite/gcc.dg/torture/pr35634.c
index 32df7d4..f8876a4 100644
--- a/gcc/testsuite/gcc.dg/torture/pr35634.c
+++ b/gcc/testsuite/gcc.dg/torture/pr35634.c
@@ -5,7 +5,7 @@ void exit (int);
 
 void foo (int i)
 {
-    static int n;
+    static int n = 0;
     if (i < -128 || i > 127)
         abort ();
     if (++n > 1000)
@@ -14,6 +14,6 @@ void foo (int i)
 
 int main ()
 {
-    char c;
+    signed char c;
     for (c = 0; ; c++) foo (c);
 }



More information about the Gcc-patches mailing list