public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "jakub at gcc dot gnu.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:21:45 +0000 [thread overview] Message-ID: <bug-113921-4-7muItU65Ux@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 #4 from Jakub Jelinek <jakub at gcc dot gnu.org> --- Bisection in the other direction doesn't make much sense, since asm goto with output operands is only supported in GCC 11 and later. Anyway, with gcc 11, I can see something fishy already during expansion: (jump_insn 927 926 1285 191 (parallel [ (set (reg:DI 385 [ value ]) (asm_operands/v:DI ("1: vmread %1, %0 jna %l2 .pushsection "__ex_table","a" .balign 4 .long (1b) - . .long (%l3) - . .long 1 .popsection ") ("=r") 0 [ (reg:DI 386) ] [ (asm_input:DI ("r") /home/sean/go/src/kernel.org/linux/arch/x86/kvm/vmx/vmx_ops.h:97) ] [ (label_ref:DI 959) (label_ref:DI 965) ] /home/sean/go/src/kernel.org/linux/arch/x86/kvm/vmx/vmx_ops.h:97)) (clobber (reg:CC 17 flags)) ]) "/home/sean/go/src/kernel.org/linux/arch/x86/kvm/vmx/vmx_ops.h":97:2 -1 (insn_list:REG_LABEL_TARGET 1253 (insn_list:REG_LABEL_TARGET 959 (nil))) -> 965) ;; succ: 197 count:99052688 (estimated locally) ;; 198 count:99052688 (estimated locally) ;; 192 count:99052688 (estimated locally) (FALLTHRU) ;; basic block 192, loop depth 0, count 99052688 (estimated locally), maybe hot ;; prev block 191, next block 193, flags: (NEW, REACHABLE, RTL, MODIFIED) ;; pred: 191 count:99052688 (estimated locally) (FALLTHRU) (note 1285 927 931 192 [bb 192] NOTE_INSN_BASIC_BLOCK) (jump_insn 931 1285 932 192 (set (pc) (label_ref:DI 1253)) "/home/sean/go/src/kernel.org/linux/arch/x86/kvm/vmx/vmx_ops.h":97:2 807 {jump} (nil) -> 1253) ;; succ: 199 [always] count:99052688 (estimated locally) ... (code_label 1253 1251 1252 199 1127 (nil) [1 uses]) (note 1252 1253 49 199 [bb 199] NOTE_INSN_BASIC_BLOCK) (insn 49 1252 930 199 (set (reg:DI 152 [ _241 ]) (reg/v:DI 151 [ value ])) "/home/sean/go/src/kernel.org/linux/arch/x86/kvm/vmx/vmx_ops.h":107:9 -1 (nil)) (insn 930 49 968 199 (set (reg/v:DI 151 [ value ]) (reg:DI 385 [ value ])) "/home/sean/go/src/kernel.org/linux/arch/x86/kvm/vmx/vmx_ops.h":97:2 -1 (nil)) ;; succ: 200 [always] count:16508781 (estimated locally) (FALLTHRU) (code_label 968 930 969 200 1083 (nil) [5 uses]) (note 969 968 970 200 [bb 200] NOTE_INSN_BASIC_BLOCK) (insn 970 969 971 200 (set (mem:DI (plus:DI (reg/v/f:DI 283 [ vmcs12 ]) (const_int 240 [0xf0])) [19 vmcs12_30(D)->guest_pdptr3+0 S8 A8]) (reg:DI 152 [ _241 ])) "/home/sean/go/src/kernel.org/linux/arch/x86/kvm/vmx/nested.c":4422:25 -1 (nil)) ;; succ: 201 [always] count:55029271 (estimated locally) (FALLTHRU) So, the asm goto sets pseudo 385 and in case it doesn't jump anywhere, it then goes into the 2 pseudo moves but they'd need to be reversed in order to store the asm goto output into gues_pdptr3.
next prev parent reply other threads:[~2024-02-14 18:21 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 [this message] 2024-02-14 18:25 ` torvalds@linux-foundation.org 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-7muItU65Ux@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: linkBe 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).