From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 32093385DC00; Sat, 4 Apr 2020 15:45:43 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 32093385DC00 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1586015143; bh=oCtXHWf8QsZFOozBL36RWA40yOfPaSn6TPAc77hr7eM=; h=From:To:Subject:Date:In-Reply-To:References:From; b=yv8kj5ZRbxAzVdLvIG+MdqJcpbMIr1CncmS5wl3ROx/Ab0kcmmJgtbfk7SWKzzReU yneqEzhovJ7hvpXGo5k4OmgCce7K0IFch++kTxt1bh8/2JyQ/6P515pCzjcCeQtsoz NbGfM4X3wNpKV/JslTRdv6Wqlht18cPeVbzXsMrU= From: "dimitri.gorokhovik at free dot fr" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/94485] [10.0.1, c++2a] g++ optimizes away necessary code, accepts arbitrary inline asm Date: Sat, 04 Apr 2020 15:45:43 +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: unknown X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: dimitri.gorokhovik at free dot fr X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: 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: Sat, 04 Apr 2020 15:45:43 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D94485 --- Comment #3 from Dimitri Gorokhovik = --- (In reply to Andrew Pinski from comment #2) > Also c++20 changes constexpr is handled which is why inline asm is accept= ed > now IIRC. This code: constexpr auto f() { asm("before:"); constexpr auto r =3D 129; asm("after:"); return r; }; produces: bug-2.cpp: In function =E2=80=98constexpr auto f()=E2=80=99: bug-2.cpp:3:3: error: inline assembly is not a constant expression 3 | asm("before:"); | ^~~ bug-2.cpp:3:3: note: only unevaluated inline assembly is allowed in a =E2=80=98constexpr=E2=80=99 function in C++2a=