Fix stringop-overflow warning in test-strncat.

Message ID 20230228124834.1065417-1-stli@linux.ibm.com
State Committed
Commit 51aeab9a363a0d000d0912aa3d6490463a26fba2
Headers
Series Fix stringop-overflow warning in test-strncat. |

Checks

Context Check Description
dj/TryBot-apply_patch success Patch applied to master at the time it was sent
dj/TryBot-32bit success Build for i686

Commit Message

Stefan Liebler Feb. 28, 2023, 12:48 p.m. UTC
  Starting with commit
b2c474f8de4c92bfe7435853a96805ec32d68dfa
"x86: Fix strncat-avx2.S reading past length [BZ #30065]"

Building on s390 the test fails due warnings like:

In function ‘do_one_test’,
    inlined from ‘do_overflow_tests’ at test-strncat.c:175:7:
test-strncat.c:31:18: error: ‘strnlen’ specified bound [4294966546, 4294967295] exceeds maximum object size 2147483647 [-Werror=stringop-overflow=]
   31 | # define STRNLEN strnlen
      |                  ^
test-strncat.c:83:16: note: in expansion of macro ‘STRNLEN’
   83 |   size_t len = STRNLEN (src, n);
|                ^~~~~~~

In all werror cases, the call to strnlen (.., SIZE_MAX) is inlined.
Therefore this patch just marks the do_one_test function as noinline.
---
 string/test-strncat.c | 1 +
 1 file changed, 1 insertion(+)
  

Patch

diff --git a/string/test-strncat.c b/string/test-strncat.c
index c0cde206ee..e71724df5b 100644
--- a/string/test-strncat.c
+++ b/string/test-strncat.c
@@ -69,6 +69,7 @@  SIMPLE_STRNCAT (CHAR *dst, const CHAR *src, size_t n)
 }
 
 static void
+__attribute__((noinline))
 do_one_test (impl_t *impl, CHAR *dst, const CHAR *src, size_t n)
 {
   size_t k = STRLEN (dst);