[Bug target/106544] riscv_print_operand does not check to see if the operands are valid to do INTVAL on them
pinskia at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Sat Aug 6 20:23:59 GMT 2022
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106544
--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to palmer from comment #1)
> Do you have an example of how to trigger the ICE? I don't know what RTL
> checking is and poking around on the internet isn't helping much. I've got
> something I think should fix the problem (just checking CONST_INT_P every
> time), but i'd like to have a test case.
--enable-checking=yes,rtl :)
One example is:
```
void f(int a)
{
asm("#%A0" : : "r"(a));
}
```
Which gives an ICE even without RTL checking:
during RTL pass: final
t.c: In function ‘f’:
t.c:4:1: internal compiler error: in riscv_memmodel_needs_amo_acquire, at
config/riscv/riscv.cc:3635
4 | }
| ^
0x11f105a riscv_memmodel_needs_amo_acquire
../../src/gcc/config/riscv/riscv.cc:3635
0x11f105a riscv_print_operand
../../src/gcc/config/riscv/riscv.cc:3702
0xaebd41 output_operand(rtx_def*, int)
../../src/gcc/final.cc:3676
0xaec1ed output_asm_insn(char const*, rtx_def**)
../../src/gcc/final.cc:3569
0xaedd29 output_asm_insn(char const*, rtx_def**)
../../src/gcc/final.cc:2686
0xaedd29 final_scan_insn_1
../../src/gcc/final.cc:2689
0xaee49b final_scan_insn(rtx_insn*, _IO_FILE*, int, int, int*)
../../src/gcc/final.cc:2939
0xaee744 final_1
../../src/gcc/final.cc:1996
0xaef1f4 rest_of_handle_final
../../src/gcc/final.cc:4284
0xaef1f4 execute
../../src/gcc/final.cc:4364
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.
F also gives a similar ICE.
S does not give an ICE unless RTL checking is turned on.
More information about the Gcc-bugs
mailing list