From patchwork Mon Dec 10 18:32:49 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [testsuite] Fix pr35634 tests when char is unsigned. From: Steve Ellcey X-Patchwork-Id: 205008 Message-Id: <94beee57-1486-4617-b0dd-b4f8af4a4c1d@EXCHHUB01.MIPS.com> To: Cc: Date: Mon, 10 Dec 2012 10:32:49 -0800 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 * 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); }