Bug 111171 - [14 Regression] ICE: in decompose, at rtl.h:2297 at -O1 on riscv64-unknown-linux-gnu
Summary: [14 Regression] ICE: in decompose, at rtl.h:2297 at -O1 on riscv64-unknown-li...
Status: RESOLVED DUPLICATE of bug 110939
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: 14.0
: P3 normal
Target Milestone: 14.0
Assignee: Not yet assigned to anyone
URL:
Keywords: ice-on-valid-code
Depends on:
Blocks:
 
Reported: 2023-08-27 13:30 UTC by Zdenek Sojka
Modified: 2023-10-02 05:21 UTC (History)
1 user (show)

See Also:
Host: x86_64-pc-linux-gnu
Target: riscv64-unknown-linux-gnu
Build: x86_64-pc-linux-gnu
Known to work: 13.2.1
Known to fail: 14.0
Last reconfirmed:


Attachments
reduced testcase (135 bytes, text/plain)
2023-08-27 13:30 UTC, Zdenek Sojka
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Zdenek Sojka 2023-08-27 13:30:07 UTC
Created attachment 55802 [details]
reduced testcase

Compiler output:
$ riscv64-unknown-linux-gnu-gcc -O testcase.c 
during RTL pass: combine
testcase.c: In function 'foo':
testcase.c:9:1: internal compiler error: in decompose, at rtl.h:2297
    9 | }
      | ^
0x124765c wi::int_traits<std::pair<rtx_def*, machine_mode> >::decompose(long*, unsigned int, std::pair<rtx_def*, machine_mode> const&)
        /repo/gcc-trunk/gcc/rtl.h:2297
0x124765c wide_int_ref_storage<false, true>::wide_int_ref_storage<std::pair<rtx_def*, machine_mode> >(std::pair<rtx_def*, machine_mode> const&)
        /repo/gcc-trunk/gcc/wide-int.h:1030
0x131b806 generic_wide_int<wide_int_ref_storage<false, true> >::generic_wide_int<std::pair<rtx_def*, machine_mode> >(std::pair<rtx_def*, machine_mode> const&)
        /repo/gcc-trunk/gcc/wide-int.h:788
0x131b806 simplify_const_unary_operation(rtx_code, machine_mode, rtx_def*, machine_mode)
        /repo/gcc-trunk/gcc/simplify-rtx.cc:2131
0x132d54d simplify_context::simplify_unary_operation(rtx_code, machine_mode, rtx_def*, machine_mode)
        /repo/gcc-trunk/gcc/simplify-rtx.cc:889
0x132d54d simplify_context::simplify_gen_unary(rtx_code, machine_mode, rtx_def*, machine_mode)
        /repo/gcc-trunk/gcc/simplify-rtx.cc:360
0x2297961 simplify_gen_unary(rtx_code, machine_mode, rtx_def*, machine_mode)
        /repo/gcc-trunk/gcc/rtl.h:3520
0x2297961 simplify_comparison
        /repo/gcc-trunk/gcc/combine.cc:13136
0x229ad85 combine_simplify_rtx
        /repo/gcc-trunk/gcc/combine.cc:6176
0x229cf6b subst
        /repo/gcc-trunk/gcc/combine.cc:5609
0x229d0cc subst
        /repo/gcc-trunk/gcc/combine.cc:5536
0x229d0cc subst
        /repo/gcc-trunk/gcc/combine.cc:5536
0x22a1dac try_combine
        /repo/gcc-trunk/gcc/combine.cc:3339
0x22a9d2d combine_instructions
        /repo/gcc-trunk/gcc/combine.cc:1300
0x22a9d2d rest_of_handle_combine
        /repo/gcc-trunk/gcc/combine.cc:15063
0x22a9d2d execute
        /repo/gcc-trunk/gcc/combine.cc:15107
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-3502-20230827001656-g7997f0d35ef-checking-yes-rtl-df-extra-riscv64/bin/../libexec/gcc/riscv64-unknown-linux-gnu/14.0.0/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-3502-20230827001656-g7997f0d35ef-checking-yes-rtl-df-extra-riscv64
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 14.0.0 20230827 (experimental) (GCC)
Comment 1 Xi Ruoyao 2023-08-28 16:29:44 UTC
Can you try https://gcc.gnu.org/pipermail/gcc-patches/2023-August/627024.html?
Comment 2 Zdenek Sojka 2023-08-28 17:31:00 UTC
(In reply to Xi Ruoyao from comment #1)
> Can you try
> https://gcc.gnu.org/pipermail/gcc-patches/2023-August/627024.html?

The patch
	* combine.cc (simplify_compare_const): Properly handle unsigned
	constants while narrowing comparison of memory and constants.
fixes this ICE on several testcases
Comment 3 Xi Ruoyao 2023-10-02 05:21:58 UTC
The patch is pushed, marking this as a dup of PR110939.

*** This bug has been marked as a duplicate of bug 110939 ***