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

            Bug ID: 117105
           Summary: ICE on valid code at -O3 with "-fno-code-hoisting
                    -fno-tree-fre -fno-tree-dominator-opts -fno-tree-pre
                    -fno-tree-sra" on x86_64-linux-gnu: in
                    extract_constrain_insn, at recog.cc:2783
           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: ---

It appears to be a recent regression as it doesn't reproduce with 14.2 and
earlier.  

It might be related to https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115521.

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


[576] % gcctk -v
Using built-in specs.
COLLECT_GCC=gcctk
COLLECT_LTO_WRAPPER=/local/suz-local/software/local/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/15.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 15.0.0 20241012 (experimental) (GCC)
[577] %
[577] % gcctk -O3 -fno-code-hoisting -fno-tree-fre -fno-tree-dominator-opts
-fno-tree-pre -fno-tree-sra small.c
small.c: In function ‘main’:
small.c:13:1: error: insn does not satisfy its constraints:
   13 | }
      | ^
(insn 24 55 54 4 (parallel [
            (set (strict_low_part (reg:QI 2 cx [orig:109 e ] [109]))
                (and:QI (subreg:QI (zero_extract:HI (reg/v:HI 2 cx [orig:109 e
] [109])
                            (const_int 8 [0x8])
                            (const_int 8 [0x8])) 0)
                    (reg:QI 1 dx [orig:115 _6 ] [115])))
            (clobber (reg:CC 17 flags))
        ]) "small.c":11:15 728 {*andqi_exthi_1_slp}
     (nil))
during RTL pass: reload
small.c:13:1: internal compiler error: in extract_constrain_insn, at
recog.cc:2783
0x2627345 internal_error(char const*, ...)
        ../../gcc-trunk/gcc/diagnostic-global-context.cc:517
0xa80f6e fancy_abort(char const*, int, char const*)
        ../../gcc-trunk/gcc/diagnostic.cc:1533
0x86bdf4 _fatal_insn(char const*, rtx_def const*, char const*, int, char
const*)
        ../../gcc-trunk/gcc/rtl-error.cc:108
0x86be20 _fatal_insn_not_found(rtx_def const*, char const*, int, char const*)
        ../../gcc-trunk/gcc/rtl-error.cc:118
0x86a05a extract_constrain_insn(rtx_insn*)
        ../../gcc-trunk/gcc/recog.cc:2783
0xfaccf7 check_rtl
        ../../gcc-trunk/gcc/lra.cc:2192
0xfb2191 lra(_IO_FILE*, int)
        ../../gcc-trunk/gcc/lra.cc:2613
0xf622ff do_reload
        ../../gcc-trunk/gcc/ira.cc:5977
0xf622ff execute
        ../../gcc-trunk/gcc/ira.cc:6165
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.
[578] %
[578] % cat small.c
int a;
struct b {
  char c;
  char d;
};
int main() {
  struct b e;
  int f;
  while (a)
    if (f == e.d)
      f = e.c = e.d & 1 >> e.d;
  return 0;
}

Reply via email to