This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


On Mon, Dec 10, 2012 at 7:32 PM, Steve Ellcey <sellcey@mips.com> wrote:
> 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.

statics are zero-initialized according to C89.

> OK for checkin?

Ok minus the initialization.

Thanks,
Richard.

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]