public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "torvalds@linux-foundation.org" <gcc-bugzilla@gcc.gnu.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	[thread overview]
Message-ID: <bug-113921-4-xTpxp16Nzw@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-113921-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113921

--- Comment #5 from Linus Torvalds <torvalds@linux-foundation.org> ---
(In reply to Linus Torvalds from comment #2)
>
> So we could make our workaround option be something like
> 
>    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 gcc-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.

  parent reply	other threads:[~2024-02-14 18:25 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-14 17:19 [Bug c/113921] New: " seanjc at google dot com
2024-02-14 18:00 ` [Bug middle-end/113921] " jakub at gcc dot gnu.org
2024-02-14 18:13 ` torvalds@linux-foundation.org
2024-02-14 18:16 ` torvalds@linux-foundation.org
2024-02-14 18:21 ` jakub at gcc dot gnu.org
2024-02-14 18:25 ` torvalds@linux-foundation.org [this message]
2024-02-14 18:40 ` jakub at gcc dot gnu.org
2024-02-14 19:07 ` jakub at gcc dot gnu.org
2024-02-14 20:31 ` jakub at gcc dot gnu.org
2024-02-15  8:00 ` rguenth at gcc dot gnu.org
2024-02-15  8:21 ` jakub at gcc dot gnu.org
2024-02-15 14:56 ` cvs-commit at gcc dot gnu.org
2024-02-15 15:14 ` cvs-commit at gcc dot gnu.org
2024-02-15 15:17 ` cvs-commit at gcc dot gnu.org
2024-02-15 15:20 ` cvs-commit at gcc dot gnu.org
2024-02-15 15:22 ` jakub at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-113921-4-xTpxp16Nzw@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).