From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 01E14385B524; Thu, 9 Feb 2023 14:32:26 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 01E14385B524 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1675953147; bh=IaJsgsPIDAI83Q6OYCIOgQNZR7TK4phqeEpTqPMef4M=; h=From:To:Subject:Date:In-Reply-To:References:From; b=Rz/x0VkylSbIUGj80FOTVj/fluw2wGJS2b/TkqzpYVWNMlinqWC4jpZdSyShvsa/1 4V3Wm7hyxUf6YWxJ3y+pb87uGXAeLySG+vjL4ReqbQiX2VeVOUrKSAdLjSaluZVQy+ Twl4tlrD9WSHciTUabPFzJJ0eQdijk3w+LpWyAL4= From: "jakub at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/108737] [13 Regression] Apparent miscompile of infinite loop on gcc trunk in cddce2 pass since r13-3875 Date: Thu, 09 Feb 2023 14:32:26 +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: 13.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: jakub at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P1 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 13.0 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: priority cc short_desc 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 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D108737 Jakub Jelinek changed: What |Removed |Added ---------------------------------------------------------------------------- Priority|P3 |P1 CC| |jakub at gcc dot gnu.org Summary|[13 Regression] Apparent |[13 Regression] Apparent |miscompile of infinite loop |miscompile of infinite loop |on gcc trunk in cddce2 pass |on gcc trunk in cddce2 pass | |since r13-3875 Keywords|needs-bisection | --- Comment #2 from Jakub Jelinek --- The foo definition could be e.g. extern "C" void exit (int); int foo() { static int cnt; if (cnt++ =3D=3D 0) return 1; if (cnt > 42) exit (0); return 0; } Yes, if first invocation of foo returns 0, then it would invoke UB in C++, = but if it returns non-zero and isn't const or pure, it can't be optimized this = way. Started with r13-3875-g9e11ceef165bc074c2fc85b8ddece606b24e710b=