From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 27A60385AC36; Tue, 30 Nov 2021 12:11:38 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 27A60385AC36 From: "redi at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/103483] context-sensitive ranges change triggers stringop-overread Date: Tue, 30 Nov 2021 12:11:38 +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: redi 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: bug_status see_also everconfirmed cf_reconfirmed_on 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: Tue, 30 Nov 2021 12:11:38 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D103483 Jonathan Wakely changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW See Also| |https://gcc.gnu.org/bugzill | |a/show_bug.cgi?id=3D103332 Ever confirmed|0 |1 Last reconfirmed| |2021-11-30 --- Comment #2 from Jonathan Wakely --- (In reply to Andrew Pinski from comment #1) > I think the warning is correct really. It's wrong. > as if > d is a+1000 it is undefined. Without inlining there is no way to know if d > is any value. It's able to inline the size of the buffer all the way down to the char_traits::copy call, but isn't able to inline the length argument as wel= l. If it can't use the compile-time constant length that is present in the cod= e, it shouldn't bother doing these checks. The middle-end should not assume all code is wrong by default. These bogus stringop warnings in std::string are getting out of hand. See also PR103332 and others.=