]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Drop duplicate half of doubly-applied test.
authorJeff Law <law@gcc.gnu.org>
Thu, 6 Dec 2018 13:46:25 +0000 (06:46 -0700)
committerJeff Law <law@gcc.gnu.org>
Thu, 6 Dec 2018 13:46:25 +0000 (06:46 -0700)
From-SVN: r266854

gcc/testsuite/gcc.dg/Wstringop-truncation-5.c

index dbb5e1fed32b7ac941c53ee62d2438ae6ec2222f..f66c0ce1e3f19124e38b098a2912133ab6dfa3e8 100644 (file)
@@ -62,67 +62,3 @@ void test_compound_literal (struct S *s)
   strncpy (s->a, (char[]){ STR }, sizeof s->a - 1);
   s->a [sizeof s->a - 1] = '\0';
 }
-/* PR tree-optimization/87028 - false positive -Wstringop-truncation
-   strncpy with global variable source string
-   { dg-do compile }
-   { dg-options "-O2 -Wstringop-truncation" } */
-
-char *strncpy (char *, const char *, __SIZE_TYPE__);
-
-#define STR   "1234567890"
-
-struct S
-{
-  char a[5], b[5];
-};
-
-const char arr[] = STR;
-const char* const ptr = STR;
-
-const char arr2[][10] = { "123", STR };
-
-void test_literal (struct S *s)
-{
-  strncpy (s->a, STR, sizeof s->a - 1);     /* { dg-bogus "\\\[-Wstringop-truncation]" } */
-  s->a[sizeof s->a - 1] = '\0';
-}
-
-void test_global_arr (struct S *s)
-{
-  strncpy (s->a, arr, sizeof s->a - 1);     /* { dg-bogus "\\\[-Wstringop-truncation]" } */
-  s->a [sizeof s->a - 1] = '\0';
-}
-
-void test_global_arr2 (struct S *s)
-{
-  strncpy (s->a, arr2[1], sizeof s->a - 1); /* { dg-bogus "\\\[-Wstringop-truncation]" } */
-  s->a [sizeof s->a - 1] = '\0';
-
-  strncpy (s->b, arr2[0], sizeof s->a - 1);
-}
-
-void test_global_ptr (struct S *s)
-{
-  strncpy (s->a, ptr, sizeof s->a - 1);     /* { dg-bogus "\\\[-Wstringop-truncation]" } */
-  s->a [sizeof s->a - 1] = '\0';
-}
-
-void test_local_arr (struct S *s)
-{
-  const char arr[] = STR;
-  strncpy (s->a, arr, sizeof s->a - 1);
-  s->a [sizeof s->a - 1] = '\0';
-}
-
-void test_local_ptr (struct S *s)
-{
-  const char* const ptr = STR;
-  strncpy (s->a, ptr, sizeof s->a - 1);     /* { dg-bogus "\\\[-Wstringop-truncation]" } */
-  s->a [sizeof s->a - 1] = '\0';
-}
-
-void test_compound_literal (struct S *s)
-{
-  strncpy (s->a, (char[]){ STR }, sizeof s->a - 1);
-  s->a [sizeof s->a - 1] = '\0';
-}