This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] restore -Wstringop-overflow for checked strcpy/strcat (PR 85259)


This patch (commit r261518) has broken the build of the glibc testsuite.  
I see, for example for aarch64-linux-gnu with build-many-glibcs.py:

In function 'test_strncat',
    inlined from 'main' at tester.c:1621:3:
tester.c:490:13: error: 'strncat' accessing 18446744073709551600 or more bytes at offsets 0 and 0 overlaps 9223372036854775793 bytes at offset -9223372036854775793 [-Werror=restrict]
      check (strncat (buf1 + n2, buf2 + n1, ~((size_t) 0) - n4)
             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors

The code in question already has -Wstringop-overflow= and -Warray-bounds 
warnings disabled as it's deliberately testing a large size.  But a 
-Wrestrict warning makes no sense to me at all here.  The arguments are 
based on two different variables, buf1 and buf2, and regardless of sizes 
and offsets I wouldn't expect a -Wrestrict warning when the arguments are 
based on different array variables like that.

-- 
Joseph S. Myers
joseph@codesourcery.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]