diff mbox

[PR54693] loss of debug info in jump threading and loop ivopts

Message ID mvma9sir2mn.fsf@hawking.suse.de
State New
Headers show

Commit Message

Andreas Schwab Jan. 9, 2013, 11:56 a.m. UTC
Alexandre Oliva <aoliva@redhat.com> writes:

> +int
> +main ()
> +{
> +  int i;
> +  char c;
> +  char arr[11];
> +
> +  for (i = 0; i < 10; i++)
> +    {
> +      c = 0x30 + i;
> +      foo (&arr[i], c); /* { dg-final { gdb-test 24 "i" "c - 48" } } */
> +    }
> +
> +  __builtin_printf ("arr = %s\n", arr);

The string is not 0-terminated, which causes random characters to be
output, and could even result in a spurious crash.  Installed as
obvious.

Andreas.

	* gcc.dg/guality/pr54693.c: Null-terminate arr.
diff mbox

Patch

diff --git a/gcc/testsuite/gcc.dg/guality/pr54693.c b/gcc/testsuite/gcc.dg/guality/pr54693.c
index adc2dfd..b852c06 100644
--- a/gcc/testsuite/gcc.dg/guality/pr54693.c
+++ b/gcc/testsuite/gcc.dg/guality/pr54693.c
@@ -21,6 +21,7 @@  main ()
       c = 0x30 + i;
       foo (&arr[i], c); /* { dg-final { gdb-test 22 "i" "c - 48" } } */
     }
+  arr[10] = 0;
 
   __builtin_printf ("arr = %s\n", arr);
   return 0;