* [PATCH v2] string: Fix GCC 11 `-Werror=stringop-overread' error
@ 2020-08-31 13:26 Maciej W. Rozycki
2020-09-01 18:13 ` Joseph Myers
2020-09-07 17:01 ` Joseph Myers
0 siblings, 2 replies; 4+ messages in thread
From: Maciej W. Rozycki @ 2020-08-31 13:26 UTC (permalink / raw)
To: libc-alpha
Fix a compilation error:
In function '__rawmemchr',
inlined from '__rawmemchr' at rawmemchr.c:27:1:
rawmemchr.c:36:12: error: 'memchr' specified bound 18446744073709551615 exceeds maximum object size 9223372036854775807 [-Werror=stringop-overread]
36 | return memchr (s, c, (size_t)-1);
| ^~~~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
../o-iterator.mk:9: recipe for target '.../string/rawmemchr.o' failed
introduced with GCC 11 commit d14c547abd48 ("Add -Wstringop-overread
for reading past the end by string functions.").
---
Changes from v1:
- Wrap the pragma into `__GNUC_PREREQ (11, 0)'.
---
string/rawmemchr.c | 4 ++++
1 file changed, 4 insertions(+)
glibc-stringop-overread.diff
Index: glibc/string/rawmemchr.c
===================================================================
--- glibc.orig/string/rawmemchr.c
+++ glibc/string/rawmemchr.c
@@ -32,6 +32,10 @@ RAWMEMCHR (const void *s, int c)
PTRDIFF_MAX; the use of SIZE_MAX is deliberate here. */
DIAG_IGNORE_NEEDS_COMMENT (8, "-Wstringop-overflow=");
#endif
+#if __GNUC_PREREQ (11, 0)
+ /* Likewise GCC 11, with a different warning option. */
+ DIAG_IGNORE_NEEDS_COMMENT (11, "-Wstringop-overread");
+#endif
if (c != '\0')
return memchr (s, c, (size_t)-1);
DIAG_POP_NEEDS_COMMENT;
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2] string: Fix GCC 11 `-Werror=stringop-overread' error
2020-08-31 13:26 [PATCH v2] string: Fix GCC 11 `-Werror=stringop-overread' error Maciej W. Rozycki
@ 2020-09-01 18:13 ` Joseph Myers
2020-09-07 17:01 ` Joseph Myers
1 sibling, 0 replies; 4+ messages in thread
From: Joseph Myers @ 2020-09-01 18:13 UTC (permalink / raw)
To: Maciej W. Rozycki; +Cc: libc-alpha
On Mon, 31 Aug 2020, Maciej W. Rozycki via Libc-alpha wrote:
> Fix a compilation error:
>
> In function '__rawmemchr',
> inlined from '__rawmemchr' at rawmemchr.c:27:1:
> rawmemchr.c:36:12: error: 'memchr' specified bound 18446744073709551615 exceeds maximum object size 9223372036854775807 [-Werror=stringop-overread]
> 36 | return memchr (s, c, (size_t)-1);
> | ^~~~~~~~~~~~~~~~~~~~~~~~~
> cc1: all warnings being treated as errors
> ../o-iterator.mk:9: recipe for target '.../string/rawmemchr.o' failed
>
> introduced with GCC 11 commit d14c547abd48 ("Add -Wstringop-overread
> for reading past the end by string functions.").
OK, please commit. Both the conditional and the version number in the
macro call seem correct in this case.
--
Joseph S. Myers
joseph@codesourcery.com
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2] string: Fix GCC 11 `-Werror=stringop-overread' error
2020-08-31 13:26 [PATCH v2] string: Fix GCC 11 `-Werror=stringop-overread' error Maciej W. Rozycki
2020-09-01 18:13 ` Joseph Myers
@ 2020-09-07 17:01 ` Joseph Myers
2020-09-16 21:39 ` Maciej W. Rozycki
1 sibling, 1 reply; 4+ messages in thread
From: Joseph Myers @ 2020-09-07 17:01 UTC (permalink / raw)
To: Maciej W. Rozycki; +Cc: libc-alpha
I've now committed this patch for Maciej.
--
Joseph S. Myers
joseph@codesourcery.com
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2] string: Fix GCC 11 `-Werror=stringop-overread' error
2020-09-07 17:01 ` Joseph Myers
@ 2020-09-16 21:39 ` Maciej W. Rozycki
0 siblings, 0 replies; 4+ messages in thread
From: Maciej W. Rozycki @ 2020-09-16 21:39 UTC (permalink / raw)
To: Joseph Myers; +Cc: libc-alpha
On Mon, 7 Sep 2020, Joseph Myers wrote:
> I've now committed this patch for Maciej.
Thank you, Joseph!
Maciej
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2020-09-16 21:40 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-31 13:26 [PATCH v2] string: Fix GCC 11 `-Werror=stringop-overread' error Maciej W. Rozycki
2020-09-01 18:13 ` Joseph Myers
2020-09-07 17:01 ` Joseph Myers
2020-09-16 21:39 ` Maciej W. Rozycki
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).