]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
final: Fix get_attr_length for asm goto [PR118411]
authorAndrew Pinski <quic_apinski@quicinc.com>
Sat, 11 Jan 2025 04:04:09 +0000 (20:04 -0800)
committerAndrew Pinski <quic_apinski@quicinc.com>
Sun, 12 Jan 2025 02:47:37 +0000 (18:47 -0800)
The problem is for inline-asm goto, the outer rtl insn type
is a jump_insn and get_attr_length does not handle ASM specially
unlike if the outer rtl insn type was just insn.

This fixes the issue by adding support for both CALL_INSN and JUMP_INSN
with asm.

OK? Bootstrapped and tested on x86_64-linux-gnu.

PR middle-end/118411

gcc/ChangeLog:

* final.cc (get_attr_length_1): Handle asm for CALL_INSN
and JUMP_INSNs.

Signed-off-by: Andrew Pinski <quic_apinski@quicinc.com>
gcc/final.cc

index 19c5d390c78a83b12e66a308b64387ed88d3c25c..12c6eb0ac09c34107c80fbee2aa8c713eab0a35a 100644 (file)
@@ -363,7 +363,11 @@ get_attr_length_1 (rtx_insn *insn, int (*fallback_fn) (rtx_insn *))
 
       case CALL_INSN:
       case JUMP_INSN:
-       length = fallback_fn (insn);
+       body = PATTERN (insn);
+       if (GET_CODE (body) == ASM_INPUT || asm_noperands (body) >= 0)
+         length = asm_insn_count (body) * fallback_fn (insn);
+       else
+         length = fallback_fn (insn);
        break;
 
       case INSN: