public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/106544] New: riscv_print_operand does not check to see if the operands are valid to do INTVAL on them
@ 2022-08-06  4:53 pinskia at gcc dot gnu.org
  2022-08-06 20:18 ` [Bug target/106544] " palmer at gcc dot gnu.org
  2022-08-06 20:23 ` pinskia at gcc dot gnu.org
  0 siblings, 2 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-08-06  4:53 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 106544
           Summary: riscv_print_operand does not check to see if the
                    operands are valid to do INTVAL on them
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Keywords: ice-checking, ice-on-invalid-code, inline-asm
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: pinskia at gcc dot gnu.org
  Target Milestone: ---
            Target: riscv

riscv_print_operand currently does not check to see if CONST_INT_P is true on
the operand before calling INTVAL on it.

This can cause an ICE with RTL checking and inline-asm with these used.

See aarch64_print_operand in config/aarch64/aarch64.cc for an examples on how
to fix this.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug target/106544] riscv_print_operand does not check to see if the operands are valid to do INTVAL on them
  2022-08-06  4:53 [Bug target/106544] New: riscv_print_operand does not check to see if the operands are valid to do INTVAL on them pinskia at gcc dot gnu.org
@ 2022-08-06 20:18 ` palmer at gcc dot gnu.org
  2022-08-06 20:23 ` pinskia at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: palmer at gcc dot gnu.org @ 2022-08-06 20:18 UTC (permalink / raw)
  To: gcc-bugs

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

palmer at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |palmer at gcc dot gnu.org

--- Comment #1 from palmer at gcc dot gnu.org ---
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.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug target/106544] riscv_print_operand does not check to see if the operands are valid to do INTVAL on them
  2022-08-06  4:53 [Bug target/106544] New: riscv_print_operand does not check to see if the operands are valid to do INTVAL on them pinskia at gcc dot gnu.org
  2022-08-06 20:18 ` [Bug target/106544] " palmer at gcc dot gnu.org
@ 2022-08-06 20:23 ` pinskia at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-08-06 20:23 UTC (permalink / raw)
  To: gcc-bugs

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.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-08-06 20:23 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-06  4:53 [Bug target/106544] New: riscv_print_operand does not check to see if the operands are valid to do INTVAL on them pinskia at gcc dot gnu.org
2022-08-06 20:18 ` [Bug target/106544] " palmer at gcc dot gnu.org
2022-08-06 20:23 ` pinskia at gcc dot gnu.org

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).