This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] restore -Wstringop-overflow for checked strcpy/strcat (PR 85259)
- From: Joseph Myers <joseph at codesourcery dot com>
- To: Martin Sebor <msebor at gmail dot com>
- Cc: Jeff Law <law at redhat dot com>, Gcc Patch List <gcc-patches at gcc dot gnu dot org>
- Date: Wed, 13 Jun 2018 20:45:31 +0000
- Subject: Re: [PATCH] restore -Wstringop-overflow for checked strcpy/strcat (PR 85259)
- References: <9a8db8a9-acd7-665a-1300-a295e1945bf3@gmail.com> <c411df71-528b-197c-3885-e4da7c1cb9f7@redhat.com> <f0b09e9d-ce02-80b7-4a47-39f4e1f8a06e@gmail.com>
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