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

            Bug ID: 123114
           Summary: ICE on valid code at -O{s,2,3} with -fno-tree-vrp on
                    x86_64-linux-gnu: in decompose, at rtl.h:2330
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: rtl-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: zhendong.su at inf dot ethz.ch
  Target Milestone: ---

Compiler Explorer: https://godbolt.org/z/fh63eMdKG

Note:
- fails: trunk
- works: 15.2 and earlier

[513] % gcctk -v
Using built-in specs.
COLLECT_GCC=gcctk
COLLECT_LTO_WRAPPER=/local/home/suz/suz-local/software/local/gcc-trunk/bin/../libexec/gcc/x86_64-pc-linux-gnu/16.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-trunk/configure --disable-bootstrap
--enable-checking=yes --prefix=/local/suz-local/software/local/gcc-trunk
--enable-sanitizers --enable-languages=c,c++ --disable-werror --enable-multilib
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 16.0.0 20251213 (experimental) (GCC) 
[514] % 
[514] % gcctk -O3 small.c; ./a.out
[515] % 
[515] % gcctk -O3 -fno-tree-vrp small.c
during RTL pass: combine
small.c: In function ‘main’:
small.c:13:1: internal compiler error: in decompose, at rtl.h:2330
   13 | }
      | ^
0x25a325b internal_error(char const*, ...)
        ../../gcc-trunk/gcc/diagnostic-global-context.cc:787
0xa17e68 fancy_abort(char const*, int, char const*)
        ../../gcc-trunk/gcc/diagnostics/context.cc:1805
0x8a0dcb wi::int_traits<std::pair<rtx_def*, machine_mode> >::decompose(long*,
unsigned int, std::pair<rtx_def*, machine_mode> const&)
        ../../gcc-trunk/gcc/rtl.h:2330
0x8a0dcb wide_int_ref_storage<false,
false>::wide_int_ref_storage<std::pair<rtx_def*, machine_mode>
>(std::pair<rtx_def*, machine_mode> const&, unsigned int)
        ../../gcc-trunk/gcc/wide-int.h:1099
0x8a0dcb generic_wide_int<wide_int_ref_storage<false, false>
>::generic_wide_int<std::pair<rtx_def*, machine_mode> >(std::pair<rtx_def*,
machine_mode> const&, unsigned int)
        ../../gcc-trunk/gcc/wide-int.h:855
0x8a0dcb wi::binary_traits<std::pair<rtx_def*, machine_mode>,
std::pair<rtx_def*, machine_mode>, wi::int_traits<std::pair<rtx_def*,
machine_mode> >::precision_type, wi::int_traits<std::pair<rtx_def*,
machine_mode> >::precision_type>::result_type wi::mul<std::pair<rtx_def*,
machine_mode>, std::pair<rtx_def*, machine_mode> >(std::pair<rtx_def*,
machine_mode> const&, std::pair<rtx_def*, machine_mode> const&)
        ../../gcc-trunk/gcc/wide-int.h:3050
0x8a0dcb simplify_const_binary_operation(rtx_code, machine_mode, rtx_def*,
rtx_def*)
        ../../gcc-trunk/gcc/simplify-rtx.cc:5759
0x119a4dc simplify_context::simplify_binary_operation(rtx_code, machine_mode,
rtx_def*, rtx_def*)
        ../../gcc-trunk/gcc/simplify-rtx.cc:2764
0x119a59d simplify_context::simplify_gen_binary(rtx_code, machine_mode,
rtx_def*, rtx_def*)
        ../../gcc-trunk/gcc/simplify-rtx.cc:182
0x22704d4 simplify_gen_binary(rtx_code, machine_mode, rtx_def*, rtx_def*)
        ../../gcc-trunk/gcc/rtl.h:3595
0x22704d4 distribute_and_simplify_rtx
        ../../gcc-trunk/gcc/combine.cc:10118
0x2277434 simplify_logical
        ../../gcc-trunk/gcc/combine.cc:7204
0x2277434 combine_simplify_rtx
        ../../gcc-trunk/gcc/combine.cc:6433
0x2278eef subst
        ../../gcc-trunk/gcc/combine.cc:5660
0x22769ca combine_simplify_rtx
        ../../gcc-trunk/gcc/combine.cc:5845
0x2278eef subst
        ../../gcc-trunk/gcc/combine.cc:5660
0x2278e26 subst
        ../../gcc-trunk/gcc/combine.cc:5587
0x2278e26 subst
        ../../gcc-trunk/gcc/combine.cc:5587
0x2279155 subst
        ../../gcc-trunk/gcc/combine.cc:5521
0x227cbfc try_combine
        ../../gcc-trunk/gcc/combine.cc:3387
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.
[516] % 
[516] % cat small.c
volatile int a, b, g;
unsigned short e;
int f;
int main() {
  int c, d;
  while (a) {
    c = e = b << 2;
    d = f;
    g = (c <= 0 && d) || c ? 0 : d;
    a = g;
  }
  return 0;
}

Reply via email to