From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 1B5523858C83; Wed, 9 Mar 2022 09:45:13 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1B5523858C83 From: "rguenth at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/104789] [12 Regression] -Wstringop-overflow false positive at -O3 for an unrolled loop Date: Wed, 09 Mar 2022 09:45:12 +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: 12.0 X-Bugzilla-Keywords: diagnostic, missed-optimization X-Bugzilla-Severity: normal X-Bugzilla-Who: rguenth 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: 12.0 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: keywords 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, 09 Mar 2022 09:45:13 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D104789 Richard Biener changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |diagnostic, | |missed-optimization --- Comment #10 from Richard Biener --- I think the -Wstringop-overflow warnings are prone to false positives with = loop unrolling just like the -Warray-bound warnings were which is why those were moved to before loop optimizations. Now all of those cases will re-appear = as -Wstringop-overflow which happens too late since the strlen pass runs quite late. Unrolling sometimes "speculatively" peels iterations that will be never reachable at runtime and that we have difficulty to statically remove. Tha= t's simply hard to avoid. For GCC 13 we might want to experiment with moving the strlen pass before loop optimizations. I'd put it somewhere inbetween PRE and the DOM preceed= ing it.=