From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id DE04B3858C2D; Tue, 15 Feb 2022 22:54:55 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org DE04B3858C2D From: "andres at anarazel dot de" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/100442] Spurious -Wstringop-overread error with odd boundaries Date: Tue, 15 Feb 2022 22:54:55 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: tree-optimization X-Bugzilla-Version: 11.1.0 X-Bugzilla-Keywords: diagnostic X-Bugzilla-Severity: normal X-Bugzilla-Who: andres at anarazel dot de X-Bugzilla-Status: RESOLVED X-Bugzilla-Resolution: INVALID 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: Tue, 15 Feb 2022 22:54:56 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D100442 --- Comment #4 from Andres Freund --- > Ending up with an excessive range isn't uncommon in code that freely conv= erts between signed and unsigned integers (e.g., by passing an int to a siz= e_t argument) and involves conditionals like those in tsCompareString(). G= CC must assume the signed integers may be negative and convert to very larg= e positive values. Changing tsCompareString() to take size_t arguments ins= tead of int avoids the warning: That true - and I agree that that code isn't great. But the warning message is quite confusing: A bound of "[184467440737095516= 12, 18446744073709551615]" doesn't sound right from the perspective a compiler user, rather than compiler author. Clearly the lower bound isn't actually 18446744073709551612.=