From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 1968838708B5; Mon, 29 Jun 2020 20:50:30 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1968838708B5 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1593463830; bh=zy1hG3e8n4H8/aovGPaWU9NRppdF1ntA9E2Fhoi6T60=; h=From:To:Subject:Date:In-Reply-To:References:From; b=t2zCYpvYhVJ6/E7CwFqT2JsFE7gD4eUiw2Rft3bMuJrBA5sBvJcSOm8Z5AnxnOgny 0YGAaFw3E6hn6y0poSgt9JZvfG14xcphHYBiB7rAiwJLKy1S7P0ZaFlzveqhJfTXU2 y8YAJLU07TxqCUL6pNUSW0L7LAwrGTjtKW5Qr/oE= From: "0xe2.0x9a.0x9b at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug other/95971] [10 regression] Optimizer converts a false boolean value into a true boolean value Date: Mon, 29 Jun 2020 20:50:30 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: other X-Bugzilla-Version: 10.1.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: 0xe2.0x9a.0x9b at gmail dot com 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: Mon, 29 Jun 2020 20:50:30 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D95971 --- Comment #10 from Jan Ziak (http://atom-symbol.net) <0xe2.0x9a.0x9b at g= mail dot com> --- I hope you do realize that the code I posted previously is equivalent, or v= ery close to being equivalent, to the following code: struct President { const bool dead =3D false; bool isDead() { return dead; } } president; while(!president.isDead()); if(president.isDead()) { launch_retaliation_nukes(); } With -ffinite-loops enabled, the nukes are going to be launched because the only way that the while-loop can terminate is for President::dead to be true and thus the "const bool dead" can be assumed to be true when execution rea= ches the if-statement after skipping the deleted infinite while loop.=