From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id BCA913857BA4; Wed, 28 Sep 2022 13:27:14 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org BCA913857BA4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1664371634; bh=88hkVtC6u8r/WG4WyhG/G0fEVXN0kG5iFk4c2H8Kcqw=; h=From:To:Subject:Date:From; b=Jog9J/Ik9brKuL2o5D2wr1TG2Qu+JmS12esDRExS4gAnPCEG5+ed2LoXdqbsRfvkb XbrlgCbv2zfUmPO40+5dM6bLsXpXkORQ6DLv5HIcTg8SM4kgG7IUOlhZC+OhHDY3e4 e0z1bKwnDqCZ2TMiLbnLrFwk9xB543Zb6ojXqIjM= From: "joerg.richter@pdv-fs.de" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/107069] New: string assignment triggers warning Date: Wed, 28 Sep 2022 13:27:14 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 12.2.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: joerg.richter@pdv-fs.de X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D107069 Bug ID: 107069 Summary: string assignment triggers warning Product: gcc Version: 12.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: joerg.richter@pdv-fs.de Target Milestone: --- cat > t.cc < std::string f() { std::string r; r =3D "C"; return r; } EOF /tools/pkg/gcc/12.2.0/bin/g++ -Wall -Wextra -Werror -std=3Dgnu++20 -O2 -c -o t.cc.o t.cc gives: ...gcc/12.2.0/include/c++/12.2.0/bits/char_traits.h:431:56: error: 'void* __builtin_memcpy(void*, const void*, long unsigned int)' accessing 9223372036854775810 or more bytes at offsets [2, 9223372036854775807] and 17 may overlap up to 9223372036854775813 bytes at offset -3 [-Werror=3Drestric= t] 431 | return static_cast(__builtin_memcpy(__s1, __s2, __n)); |=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20 ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~=