From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 0D77D3858003; Thu, 2 Dec 2021 21:03:22 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 0D77D3858003 From: "msebor at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/103534] [12 regression] Spurious -Wstringop-overflow warning with std::string concatencation Date: Thu, 02 Dec 2021 21:03:21 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 12.0 X-Bugzilla-Keywords: diagnostic X-Bugzilla-Severity: normal X-Bugzilla-Who: msebor at gcc dot gnu.org X-Bugzilla-Status: NEW 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: keywords cf_reconfirmed_on everconfirmed blocked cc bug_status Message-ID: In-Reply-To: References: 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 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 02 Dec 2021 21:03:22 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D103534 Martin Sebor changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |diagnostic Last reconfirmed| |2021-12-02 Ever confirmed|0 |1 Blocks| |88443 CC| |msebor at gcc dot gnu.org Status|UNCONFIRMED |NEW --- Comment #1 from Martin Sebor --- The warning is for the memcpy() call in BB 12 with _73 being in the reported excessive range: [local count: 172868773]: _209 =3D D.41961._M_dataplus._M_p; _103 =3D _69 + 16; __builtin_memcpy (_103, _209, _73); <<< 27->12 (T) _73 : long unsign= ed int [18446744073709551600, +INF] The range comes from BB 27: =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D BB 27 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Imports: _73=20=20 Exports: _73=20=20 _73 long unsigned int [0, 0][18446744073709551600, +INF] __size_74 const long unsigned int [0, 16] [local count: 523844769]: if (_73 !=3D 0) goto ; [33.00%] else goto ; [67.00%] 27->12 (T) _73 : long unsigned int [18446744073709551600, +INF] 27->12 (T) __size_74 : const long unsigned int [0, 15] 27->13 (F) _73 : long unsigned int [0, 0] 27->13 (F) __size_74 : const long unsigned int [16, 16] The magic 16 most likely has to do with the small internal std::string buff= er that's 16 bytes big. Referenced Bugs: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D88443 [Bug 88443] [meta-bug] bogus/missing -Wstringop-overflow warnings=