From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 1FB753858C55; Thu, 21 Mar 2024 21:46:57 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1FB753858C55 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1711057617; bh=Iy6H+iTeT4SkklBqGsahb6VSHJrncqQ5AXavqQ0icb0=; h=From:To:Subject:Date:In-Reply-To:References:From; b=VcxMi9J7tpdWQKzfojW/3X9RjWCQeLzpAo4SfQS54vUu6QTfqd2xVAwcKlR544Rzs tgipPVU7kIKzGTkWrP8AygxYmtqUysivZW7Re9CyergaRKYZKuf6HZTcp+Ro0U5nf2 P9JhpxyX+KGgms/xqg/KqUigu/6xgOTCS/8OuDao= From: "pinskia at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/114421] arm-none-eabi thumb -Os (and -O2) incorrectly optimizes out needed class member call Date: Thu, 21 Mar 2024 21:46:56 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 12.3.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: pinskia at gcc dot gnu.org 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 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D114421 --- Comment #5 from Andrew Pinski --- https://en.cppreference.com/w/cpp/language/memory_model#Forward_progress is= a decent reference when it comes to what it means by forward progress in C++. Note C and C++ have slightly different requirements. And C++17 has different from previous versions of C++ also. (In reply to Xi Ruoyao from comment #3) > In C++ there is no "the controlling expression is a constant expression" > exempt, so even while (true); can be optimized out. AFAIK GCC does not > optimize away while (true); in C++, but Clang is actively doing this. Th= ere > is a WG21 paper to add the constant expression exemption for C++ like C (I > cannot remember its Nxxxx ID though). https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2023/p2809r0.html is the paper about C++'s `while(true);`=