testsuite/gcc.dg/strcmpopt_6.c: Add space in array for terminator.

Message ID 001a01d5e67c$4306f400$c914dc00$@beniston.com
State New
Headers show
Series
  • testsuite/gcc.dg/strcmpopt_6.c: Add space in array for terminator.
Related show

Commit Message

Jon Beniston Feb. 18, 2020, 4:55 p.m.
Hi,

The patch adds space for the string terminator, as the function is called
with test_strcpy_strcmp_abc ("abcd")

ChangeLog

gcc/testsuite

2020-02-18  Jon Beniston <jon@beniston.com>

        * gcc.dg/strcmpopt_6.c: Add space in array for terminator.

Comments

Martin Sebor Feb. 18, 2020, 5:48 p.m. | #1
On 2/18/20 9:55 AM, Jon Beniston wrote:
> Hi,

> 

> The patch adds space for the string terminator, as the function is called

> with test_strcpy_strcmp_abc ("abcd")


That looks right.  Please go ahead and commit it.

Thanks!
Martin

> 

> ChangeLog

> 

> gcc/testsuite

> 

> 2020-02-18  Jon Beniston <jon@beniston.com>

> 

>          * gcc.dg/strcmpopt_6.c: Add space in array for terminator.

> 

> diff --git a/gcc/testsuite/gcc.dg/strcmpopt_6.c

> b/gcc/testsuite/gcc.dg/strcmpopt_6.c

> index cb99294e5fa..06b7e3480db 100644

> --- a/gcc/testsuite/gcc.dg/strcmpopt_6.c

> +++ b/gcc/testsuite/gcc.dg/strcmpopt_6.c

> @@ -33,7 +33,7 @@ test_strlen_lt6_strcmp_abcd (const char *s)

>   __attribute__ ((noclone, noinline)) int

>   test_strcpy_strcmp_abc (const char *s)

>   {

> -  char a[4];

> +  char a[5];

>     strcpy (a, s);

>     return strcmp (a, "abc") == 0;

>   }

> 

>

Patch

diff --git a/gcc/testsuite/gcc.dg/strcmpopt_6.c
b/gcc/testsuite/gcc.dg/strcmpopt_6.c
index cb99294e5fa..06b7e3480db 100644
--- a/gcc/testsuite/gcc.dg/strcmpopt_6.c
+++ b/gcc/testsuite/gcc.dg/strcmpopt_6.c
@@ -33,7 +33,7 @@  test_strlen_lt6_strcmp_abcd (const char *s)
 __attribute__ ((noclone, noinline)) int
 test_strcpy_strcmp_abc (const char *s)
 {
-  char a[4];
+  char a[5];
   strcpy (a, s);
   return strcmp (a, "abc") == 0;
 }