public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/114945] New: Sporadic std::vector::resize() -Wstringop-overflow or -Warray-bounds warning with gcc 14
@ 2024-05-04 16:34 nilsgladitz at gmail dot com
2024-05-04 17:49 ` [Bug tree-optimization/114945] [14/15 regression] " pinskia at gcc dot gnu.org
2024-05-07 7:46 ` rguenth at gcc dot gnu.org
0 siblings, 2 replies; 3+ messages in thread
From: nilsgladitz at gmail dot com @ 2024-05-04 16:34 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114945
Bug ID: 114945
Summary: Sporadic std::vector::resize() -Wstringop-overflow or
-Warray-bounds warning with gcc 14
Product: gcc
Version: 14.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: nilsgladitz at gmail dot com
Target Milestone: ---
Created attachment 58103
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=58103&action=edit
Testcase
Initially seen with a Ubuntu specific GCC 14 x86-64 snapshot but also
reproduced with a vanilla arm32 build of GCC 14.1-rc1. Not seen with GCC 13.1.
I see there are a couple of issues which sound similar or related (e.g. bugs
113664, 106185, 105823, 105746) but I can't really tell if this is a duplicate
or regression of a previously fixed issue.
The reduced attached test case compiled with
g++-14 -std=c++20 -O2 case1.cpp
Produces the warning:
/usr/include/c++/14/bits/stl_algobase.h:972:25: warning: ‘void*
__builtin_memset(void*, int, long unsigned int)’ writing 3 bytes into a region
of size 0 overflows the destination [-Wstringop-overflow=]
972 | __builtin_memset(__first, static_cast<unsigned char>(__tmp),
__len);
|
~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Adding -Wall replaces the above warning with this new warning:
/usr/include/c++/14/bits/stl_algobase.h:972:25: warning: ‘void*
__builtin_memset(void*, int, long unsigned int)’ offset [0, 2] is out of the
bounds [0, 0] [-Warray-bounds=]
972 | __builtin_memset(__first, static_cast<unsigned char>(__tmp),
__len);
|
~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Also recreated this on godbolt: https://godbolt.org/z/rYx9q7Ke1
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug tree-optimization/114945] [14/15 regression] Sporadic std::vector::resize() -Wstringop-overflow or -Warray-bounds warning with gcc 14
2024-05-04 16:34 [Bug c++/114945] New: Sporadic std::vector::resize() -Wstringop-overflow or -Warray-bounds warning with gcc 14 nilsgladitz at gmail dot com
@ 2024-05-04 17:49 ` pinskia at gcc dot gnu.org
2024-05-07 7:46 ` rguenth at gcc dot gnu.org
1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-05-04 17:49 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114945
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Summary|[14 regression] Sporadic |[14/15 regression] Sporadic
|std::vector::resize() |std::vector::resize()
|-Wstringop-overflow or |-Wstringop-overflow or
|-Warray-bounds warning with |-Warray-bounds warning with
|gcc 14 |gcc 14
Target Milestone|--- |14.0
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug tree-optimization/114945] [14/15 regression] Sporadic std::vector::resize() -Wstringop-overflow or -Warray-bounds warning with gcc 14
2024-05-04 16:34 [Bug c++/114945] New: Sporadic std::vector::resize() -Wstringop-overflow or -Warray-bounds warning with gcc 14 nilsgladitz at gmail dot com
2024-05-04 17:49 ` [Bug tree-optimization/114945] [14/15 regression] " pinskia at gcc dot gnu.org
@ 2024-05-07 7:46 ` rguenth at gcc dot gnu.org
1 sibling, 0 replies; 3+ messages in thread
From: rguenth at gcc dot gnu.org @ 2024-05-07 7:46 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114945
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|14.0 |14.2
--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
GCC 14.1 is being released, retargeting bugs to GCC 14.2.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-05-07 7:46 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-05-04 16:34 [Bug c++/114945] New: Sporadic std::vector::resize() -Wstringop-overflow or -Warray-bounds warning with gcc 14 nilsgladitz at gmail dot com
2024-05-04 17:49 ` [Bug tree-optimization/114945] [14/15 regression] " pinskia at gcc dot gnu.org
2024-05-07 7:46 ` rguenth at gcc dot gnu.org
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).