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

            Bug ID: 118706
           Summary: ICE on valid code at -O1 and above with
                    "-fno-tree-fre" on x86_64-linux-gnu: in
                    make_bit_field_load, at gimple-fold.cc:7862
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: zhendong.su at inf dot ethz.ch
  Target Milestone: ---

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

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

Likely related: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118704

[522] % 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.1/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.1 20250130 (experimental) (GCC) 
[523] % 
[523] % gcctk -O1 -fno-tree-fre small.c
during GIMPLE pass: ifcombine
small.c: In function ‘main’:
small.c:2:5: internal compiler error: in make_bit_field_load, at
gimple-fold.cc:7862
    2 | int main() {
      |     ^~~~
0x26d5646 internal_error(char const*, ...)
        ../../gcc-trunk/gcc/diagnostic-global-context.cc:517
0xac1c5c fancy_abort(char const*, int, char const*)
        ../../gcc-trunk/gcc/diagnostic.cc:1722
0x832a5d make_bit_field_load
        ../../gcc-trunk/gcc/gimple-fold.cc:7862
0xe76a81 fold_truth_andor_for_ifcombine(tree_code, tree_node*, unsigned long,
tree_code, tree_node*, tree_node*, unsigned long, tree_code, tree_node*,
tree_node*, tree_node**)
        ../../gcc-trunk/gcc/gimple-fold.cc:8779
0x13bc7c5 ifcombine_ifandif
        ../../gcc-trunk/gcc/tree-ssa-ifcombine.cc:976
0x13bcb3c tree_ssa_ifcombine_bb_1
        ../../gcc-trunk/gcc/tree-ssa-ifcombine.cc:1107
0x13bcffa tree_ssa_ifcombine_bb
        ../../gcc-trunk/gcc/tree-ssa-ifcombine.cc:1207
0x13bcffa execute
        ../../gcc-trunk/gcc/tree-ssa-ifcombine.cc:1400
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.
[524] % 
[524] % cat small.c
int a[1][1][3], b;
int main() {
  int c = -1;
  while (b) {
    if (a[c][c][6])
      break;
    if (a[0][0][0])
      break;
  }
}

Reply via email to