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

            Bug ID: 104700
           Summary: ICE on valid code at -O2 and -O3 with -fno-tree-ccp
                    -fno-tree-dce -fno-tree-vrp on x86_64-linux-gnu: in
                    find_or_generate_expression, at tree-ssa-pre.cc:2795
           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: ---

It appears to be a recent regression.

[627] % 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/12.0.1/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-trunk/configure --disable-bootstrap
--prefix=/local/suz-local/software/local/gcc-trunk --enable-languages=c,c++
--disable-werror --enable-multilib --with-system-zlib
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 12.0.1 20220226 (experimental) [master r12-7395-gafeaaf4b352] (GCC)
[628] %
[628] % gcctk -O2 -fno-tree-ccp -fno-tree-dce -fno-tree-vrp small.c
during GIMPLE pass: pre
small.c: In function ‘main’:
small.c:2:5: internal compiler error: in find_or_generate_expression, at
tree-ssa-pre.cc:2795
    2 | int main() {
      |     ^~~~
0x1005c10 find_or_generate_expression
        ../../gcc-trunk/gcc/tree-ssa-pre.cc:2795
0x1005132 create_expression_by_pieces
        ../../gcc-trunk/gcc/tree-ssa-pre.cc:2951
0x10095b1 insert_into_preds_of_block
        ../../gcc-trunk/gcc/tree-ssa-pre.cc:3159
0x100b134 do_pre_regular_insertion
        ../../gcc-trunk/gcc/tree-ssa-pre.cc:3416
0x100b134 insert
        ../../gcc-trunk/gcc/tree-ssa-pre.cc:3809
0x100b134 execute
        ../../gcc-trunk/gcc/tree-ssa-pre.cc:4433
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.
[629] %
[629] % cat small.c
int a, b;
int main() {
  int c = 2, d, e = 0;
  if (a)
    e = 2;
  int f, g = -(1L | (e && f && f & e));
  if (g)
  L:
    g = c;
  c = 0;
  d = e * g;
  if (d)
    goto L;
  while (e) {
    int i = (a && b) * i;
  }
  return 0;
}

Reply via email to