public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/113586] New: ICE: RTL check: expected code 'const_int', have 'reg' in rtx_to_poly_int64, at rtl.h:2398 with -march=rv32gcv -mabi=ilp32e
@ 2024-01-24 16:47 zsojka at seznam dot cz
  2024-01-24 17:16 ` [Bug middle-end/113586] " pinskia at gcc dot gnu.org
  2024-01-26  3:50 ` pinskia at gcc dot gnu.org
  0 siblings, 2 replies; 3+ messages in thread
From: zsojka at seznam dot cz @ 2024-01-24 16:47 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 113586
           Summary: ICE: RTL check: expected code 'const_int', have 'reg'
                    in rtx_to_poly_int64, at rtl.h:2398 with
                    -march=rv32gcv -mabi=ilp32e
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Keywords: ice-on-valid-code
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: zsojka at seznam dot cz
  Target Milestone: ---
              Host: x86_64-pc-linux-gnu
            Target: riscv64-unknown-linux-gnu

Created attachment 57208
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=57208&action=edit
reduced testcase (from gcc.target/riscv/rvv/vsetvl/imm_switch-1.c)

I have a strong feeling of reporting this before, but I can't find the original
PR. Sorry for the dup, if I searched poorly.

This probably needs RTL checking enabled.

Compiler output:
$ riscv64-unknown-linux-gnu-gcc -march=rv32gcv -mabi=ilp32e testcase.c 
during RTL pass: expand
testcase.c: In function 'f_n':
testcase.c:2:6: internal compiler error: RTL check: expected code 'const_int',
have 'reg' in rtx_to_poly_int64, at rtl.h:2398
    2 | void f_n() {
      |      ^~~
0xad3dd3 rtl_check_failed_code1(rtx_def const*, rtx_code, char const*, int,
char const*)
        /repo/gcc-trunk/gcc/rtl.cc:770
0x9fdf35 rtx_to_poly_int64(rtx_def const*)
        /repo/gcc-trunk/gcc/rtl.h:2398
0x9fdf35 rtx_to_poly_int64(rtx_def const*)
        /repo/gcc-trunk/gcc/rtl.h:2389
0x9fdf35 expand_stack_vars
        /repo/gcc-trunk/gcc/cfgexpand.cc:1328
0x1184673 expand_used_vars
        /repo/gcc-trunk/gcc/cfgexpand.cc:2417
0x1188b01 execute
        /repo/gcc-trunk/gcc/cfgexpand.cc:6708
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.

$ riscv64-unknown-linux-gnu-gcc -v
Using built-in specs.
COLLECT_GCC=/repo/gcc-trunk/binary-latest-riscv64/bin/riscv64-unknown-linux-gnu-gcc
COLLECT_LTO_WRAPPER=/repo/gcc-trunk/binary-trunk-r14-8383-20240124073818-g59004711660-checking-yes-rtl-df-extra-riscv64/bin/../libexec/gcc/riscv64-unknown-linux-gnu/14.0.1/lto-wrapper
Target: riscv64-unknown-linux-gnu
Configured with: /repo/gcc-trunk//configure --enable-languages=c,c++
--enable-valgrind-annotations --disable-nls --enable-checking=yes,rtl,df,extra
--with-cloog --with-ppl --with-isl --with-isa-spec=2.2
--with-sysroot=/usr/riscv64-unknown-linux-gnu --build=x86_64-pc-linux-gnu
--host=x86_64-pc-linux-gnu --target=riscv64-unknown-linux-gnu
--with-ld=/usr/bin/riscv64-unknown-linux-gnu-ld
--with-as=/usr/bin/riscv64-unknown-linux-gnu-as --disable-multilib
--disable-libstdcxx-pch
--prefix=/repo/gcc-trunk//binary-trunk-r14-8383-20240124073818-g59004711660-checking-yes-rtl-df-extra-riscv64
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 14.0.1 20240124 (experimental) (GCC)

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

* [Bug middle-end/113586] ICE: RTL check: expected code 'const_int', have 'reg' in rtx_to_poly_int64, at rtl.h:2398 with -march=rv32gcv -mabi=ilp32e
  2024-01-24 16:47 [Bug target/113586] New: ICE: RTL check: expected code 'const_int', have 'reg' in rtx_to_poly_int64, at rtl.h:2398 with -march=rv32gcv -mabi=ilp32e zsojka at seznam dot cz
@ 2024-01-24 17:16 ` pinskia at gcc dot gnu.org
  2024-01-26  3:50 ` pinskia at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-01-24 17:16 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |ice-checking

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
The problem is get_dynamic_stack_size can set size to register due to this
code:
```
      size = plus_constant (Pmode, size, extra);
      size = force_operand (size, NULL_RTX);
      if (size_align > known_align)
        size_align = known_align;

```


Which has been there for a while now.


r7-2051-g7072df0aae0c59 introduced the call to get_dynamic_stack_size that will
then assume the INTVAL (note this was later changed to rtx_to_poly_int64 but
the force_operand was there earlier than that).

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

* [Bug middle-end/113586] ICE: RTL check: expected code 'const_int', have 'reg' in rtx_to_poly_int64, at rtl.h:2398 with -march=rv32gcv -mabi=ilp32e
  2024-01-24 16:47 [Bug target/113586] New: ICE: RTL check: expected code 'const_int', have 'reg' in rtx_to_poly_int64, at rtl.h:2398 with -march=rv32gcv -mabi=ilp32e zsojka at seznam dot cz
  2024-01-24 17:16 ` [Bug middle-end/113586] " pinskia at gcc dot gnu.org
@ 2024-01-26  3:50 ` pinskia at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-01-26  3:50 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
My bet is you might be able to reproduce this issue on aarch64 with SVE and
ilp32 but maybe not due to alignment of the stack there is 16 bytes still.

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

end of thread, other threads:[~2024-01-26  3:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-24 16:47 [Bug target/113586] New: ICE: RTL check: expected code 'const_int', have 'reg' in rtx_to_poly_int64, at rtl.h:2398 with -march=rv32gcv -mabi=ilp32e zsojka at seznam dot cz
2024-01-24 17:16 ` [Bug middle-end/113586] " pinskia at gcc dot gnu.org
2024-01-26  3:50 ` 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).