From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id BBDAA385043C; Thu, 25 Feb 2021 12:09:59 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org BBDAA385043C From: "rguenth at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/99101] optimization bug with -ffinite-loops Date: Thu, 25 Feb 2021 12:09:59 +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.0 X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: rguenth at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: rguenth 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: Thu, 25 Feb 2021 12:09:59 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D99101 --- Comment #15 from Richard Biener --- Further simplified, but still depends on -ffinite-loops volatile int xx; int main() { int jobs_ =3D 1; int at_eof_ =3D 0; while (1) { for (int i =3D 0; i < jobs_; i++) { if (at_eof_) continue; at_eof_ =3D 1; __builtin_printf ("1\n"); if (xx) return 1; } jobs_ =3D 0; } return 0; } if one exchanges the at_eof_ test with a function call like if (at_eof ()) = then the side-effect of at_eof() marks the if necessary by means of the block being control dependent on itself.=