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

            Bug ID: 125614
           Summary: ICE on valid code at -O{2,3} with "-fno-dce
                    -fno-tree-fre" on x86_64-linux-gnu: in extract_insn,
                    at recog.cc:2894
           Product: gcc
           Version: 16.0
            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/xsbfYbdE7

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

[572] % 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/17.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 17.0.0 20260604 (experimental) (GCC)
[573] %
[573] % gcctk -O2 -c -fno-dce -fno-tree-fre small.c
small.c: In function ‘a’:
small.c:21:1: error: unrecognizable insn:
   21 | }
      | ^
(insn 15 14 18 4 (set (subreg:HI (subreg:V2QI (reg:HI 111 [ vect__6.14_46 ]) 0)
0)
        (const_int -256 [0xffffffffffffff00])) "small.c":11:10 -1
     (expr_list:REG_EQUAL (const_vector:V2QI [
                (const_int 0 [0])
                (const_int -1 [0xffffffffffffffff])
            ])
        (nil)))
during RTL pass: ira
small.c:21:1: internal compiler error: in extract_insn, at recog.cc:2894
0x2656c5b internal_error(char const*, ...)
        ../../gcc-trunk/gcc/diagnostic-global-context.cc:787
0xa2dec2 fancy_abort(char const*, int, char const*)
        ../../gcc-trunk/gcc/diagnostics/context.cc:1813
0x8adf6b _fatal_insn(char const*, rtx_def const*, char const*, int, char
const*)
        ../../gcc-trunk/gcc/rtl-error.cc:108
0x8adf8d _fatal_insn_not_found(rtx_def const*, char const*, int, char const*)
        ../../gcc-trunk/gcc/rtl-error.cc:116
0x8ac3a9 extract_insn(rtx_insn*)
        ../../gcc-trunk/gcc/recog.cc:2894
0xf93624 ira_remove_insn_scratches(rtx_insn*, bool, _IO_FILE*, rtx_def*
(*)(rtx_def*))
        ../../gcc-trunk/gcc/ira.cc:5468
0xf95f0d remove_scratches
        ../../gcc-trunk/gcc/ira.cc:5512
0xf95f0d ira
        ../../gcc-trunk/gcc/ira.cc:5868
0xf95f0d execute
        ../../gcc-trunk/gcc/ira.cc:6228
/local/home/suz/suz-local/software/local/gcc-trunk/bin/../libexec/gcc/x86_64-pc-linux-gnu/17.0.0/cc1
-quiet -I /usr/local/include -I /local/suz-local/software/local/include
-imultiarch x86_64-linux-gnu -iprefix
/local/home/suz/suz-local/software/local/gcc-trunk/bin/../lib/gcc/x86_64-pc-linux-gnu/17.0.0/
small.c -quiet -dumpbase small.c -dumpbase-ext .c -mtune=generic -march=x86-64
-O2 -fno-dce -fno-tree-fre -o /tmp/ccpe6Jd9.s
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.
[574] %
[574] % cat small.c
int b, c;
int a() {
  char d[8];
  int e = 0;
  if (b)
    goto f;
  if (c) {
    for (int g = 0; g < 8; ++g)
      d[g] = g;
    a();
    d[0] = -d[0];
    d[1] = -d[1];
  f:
    int h;
    if (h)
      __builtin_abort();
    e = d[0];
    e = d[1] + e;
  }
  return e;
}

Reply via email to