From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id A2F6B388C00F; Wed, 30 Dec 2020 12:49:46 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A2F6B388C00F From: "romain.geissler at amadeus dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/98465] Bogus warning stringop-overread wuth -std=gnu++20 -O2 and std::string::insert Date: Wed, 30 Dec 2020 12:49:46 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: middle-end X-Bugzilla-Version: 11.0 X-Bugzilla-Keywords: diagnostic, missed-optimization X-Bugzilla-Severity: normal X-Bugzilla-Who: romain.geissler at amadeus dot com 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: 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: Wed, 30 Dec 2020 12:49:46 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D98465 --- Comment #2 from Romain Geissler --- Hi Martin, Thanks for your investigation. I have a few questions: - Since the warning seems to be fully emitted by system headers, shouldn't= it be silenced by default ? Why isn't it the case here ? On compiler explorer, "x86-64 gcc 10.2" and flags "-std=3Dgnu++20 -O2" I get no warning, yet with= flags "-std=3Dgnu++20 -O2 -Wsystem-headers" I get a -Wstringop-overflow warning a= bout the same problem. Meaning that for stringop-overflow system headers seems t= o be taken into account, but not for stringop-overread, is that expected ? - I understood why you did not reproduce the bug with gcc 11, my test case, and flags "-std=3Dgnu++20 -O2". It looks like Compiler explorer forces "-g"= by default. And it seems debug output generation does affect the warning. With flags "-std=3Dgnu++20 -O2 -g0" (effectively disable debug information gener= ation) I get no warning, while with "-std=3Dgnu++20 -O2 -g" I get the stringop-ove= rread warning. Again, gcc 10 doesn't seem to be impacted by debug output generati= on to trigger this warning, is this expected ? There seems to be a strange interaction between -Wsystem-headers and -g in = gcc 11 which I don't understand. See the following matrix: - "-std=3Dgnu++20 -O2 -Wno-system-headers -g0" --> no warning - "-std=3Dgnu++20 -O2 -Wno-system-headers -g" --> warning - "-std=3Dgnu++20 -O2 -Wsystem-headers -g0" --> warning - "-std=3Dgnu++20 -O2 -Wsystem-headers -g" --> warning (this last matrix was tested on compiler explorer). I am confused. Cheers, Romain=