This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PR54693] loss of debug info in jump threading and loop ivopts
- From: Andreas Schwab <schwab at suse dot de>
- To: Alexandre Oliva <aoliva at redhat dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Wed, 09 Jan 2013 12:56:32 +0100
- Subject: Re: [PR54693] loss of debug info in jump threading and loop ivopts
- References: <orr4olzqwe.fsf@livre.localdomain>
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 --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;
--
1.8.1
--
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."