[Bug middle-end/97048] [meta-bug] bogus/missing -Wstringop-overread warnings
tonyguil at gmail dot com
gcc-bugzilla@gcc.gnu.org
Tue May 16 17:18:30 GMT 2023
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97048
Tony Guilfoyle <tonyguil at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |tonyguil at gmail dot com
--- Comment #1 from Tony Guilfoyle <tonyguil at gmail dot com> ---
Source file foo.cpp:
#include <vector>
struct T
{
void* p ;
std::vector<char> a[10] ;
} ;
void f (T& t, const std::vector<char>& u, int i)
{
std::vector<char>& v = t.a[i] ;
std::vector<char> w (u.begin(), u.end()) ;
v.resize (v.size() - w.size()) ; // <-- Warning generated here
}
Command line: g++ -std=c++20 -Wall -O3 -c -o foo.obj foo.cpp
g++ --version: g++.exe (MinGW-W64 x86_64-ucrt-posix-seh, built by Brecht
Sanders) 12.2.0
Problem: Spurious warning emitted:
specified bound between 9223372036854775808 and 18446744073709551614 exceeds
maximum object size 9223372036854775807 [-Wstringop-overflow=]
More information about the Gcc-bugs
mailing list