From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 3BDE2385829D; Wed, 14 Feb 2024 18:25:37 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3BDE2385829D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1707935137; bh=cbUGvtauPKgeAa/R/2wJt8lisSwJQ0eGiOW0I89cYrs=; h=From:To:Subject:Date:In-Reply-To:References:From; b=Osm4X/XCYMJyBtTQwIes/4scaSz2n6YNcnqBgm50ZnzM1BK/Kh5EgZ8K50fi9LD3a GTKzMx/TsmDQb/F0SfXrUPDgRifwwCvwtcX7LbnqlIH4ubHVvmpfTBRiy98nkaI+JN 0sBIb72bwxOnB4TGYywh3ng3ZuK3merWdo9IWMZ4= From: "torvalds@linux-foundation.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/113921] Output register of an "asm volatile goto" is incorrectly clobbered/discarded Date: Wed, 14 Feb 2024 18:25:37 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: middle-end X-Bugzilla-Version: 11.4.0 X-Bugzilla-Keywords: inline-asm X-Bugzilla-Severity: normal X-Bugzilla-Who: torvalds@linux-foundation.org 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 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D113921 --- Comment #5 from Linus Torvalds --- (In reply to Linus Torvalds from comment #2) > > So we could make our workaround option be something like >=20 > config GCC_ASM_GOTO_WORKAROUND > def_bool y > depends on CC_IS_GCC && GCC_VERSION < 120100 Replying to myself some more, since that kernel side workaround is actually= in two parts: it does the extra empty inline asm as an extra barrier, but it *also* adds the 'volatile' to the asm with outputs to work around the other= gcc bug. And that other fix ("Mark asm goto with outputs as volatile") is *not* in gcc-12.1.0. It has only made it into gcc-13.2.0 (and it's pending in the gc= c-12 release branch if I read things right). I suspect that other bug doesn't affect Sean's kvm case, because the outputs are always used, but it could affect other kernel code. So we'd want to have at least gcc-13.2 to be safe. Hmm. We could make the "add volatile manually" be the default workaround, though, since it shouldn't matter.=