https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105651

Jens Maurer <jens.maurer at gmx dot net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jens.maurer at gmx dot net

--- Comment #5 from Jens Maurer <jens.maurer at gmx dot net> ---
Here's a more compact reproducer (gcc 12.1):

#include <string>

void f(const long long v)
{
   std::string line;
   line += " " + std::to_string(v);
}


$ g++ -Wall -O3 -std=c++20 -o test_warning.o -c test_warning.cxx
[...]
     inlined from 'void f(long long int)' at test_warning.cxx:9:15:
/opt/crosstool/x86_64-gcc-12.1.0-glibc-2.12.2/x86_64-unknown-linux-gnu/include/c++/12.1.0/bits/char_traits.h:431:56:
 
warning: 'void* __builtin_memcpy(void*, const void*, long unsigned int)' 
accessing 9223372036854775810 or more bytes at offsets [2, 
9223372036854775807] and 1 may overlap up to 9223372036854775813 bytes 
at offset -3 [-Wrestrict]
   431 |         return static_cast<char_type*>(__builtin_memcpy(__s1, 
__s2, __n));

Reply via email to