]> sourceware.org Git - glibc.git/commitdiff
Fix stringop-overflow warning in tst-strlcat2.
authorStefan Liebler <stli@linux.ibm.com>
Tue, 16 Jan 2024 08:44:30 +0000 (09:44 +0100)
committerStefan Liebler <stli@linux.ibm.com>
Mon, 5 Feb 2024 14:04:26 +0000 (15:04 +0100)
On s390x, I get warnings like this when do_one_test is inlined with SIZE_MAX:
In function ‘do_one_test’,
    inlined from ‘do_overflow_tests’ at tst-strlcat2.c:184:2:
tst-strlcat2.c:49:18: error: ‘strnlen’ specified bound [1844674407370955086618446744073709551615] exceeds maximum object size 9223372036854775807 [-Werror=stringop-overflow=]
   49 | # define STRNLEN strnlen
      |                  ^
tst-strlcat2.c:89:23: note: in expansion of macro ‘STRNLEN’
   89 |   size_t dst_length = STRNLEN (dst, n);
      |                       ^~~~~~~

This patch just marks the do_one_test function as noinline as also done in test-strncat.c:
Fix stringop-overflow warning in test-strncat.
https://sourceware.org/git/?p=glibc.git;a=commit;h=51aeab9a363a0d000d0912aa3d6490463a26fba2

string/tst-strlcat2.c

index 225520a46b5b5c6b034111cd300e8fdf5d93e804..1ec26a2432b42f0a1bc0431abb43fac91072fe14 100644 (file)
@@ -81,6 +81,7 @@ IMPL (STRLCAT, 1)
 typedef size_t (*proto_t) (CHAR *, const CHAR *, size_t);
 
 static void
+__attribute__((noinline))
 do_one_test (impl_t *impl, CHAR *dst, const CHAR *src,
             size_t n)
 {
This page took 0.044127 seconds and 5 git commands to generate.