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

            Bug ID: 110392
           Summary: ICE at -O3 with "-w -O3 -Wall -fno-tree-vrp
                    -fno-tree-dominator-opts -fno-tree-copy-prop
                    -fno-tree-fre -fno-tree-ccp -fno-tree-forwprop": in
                    find_var_cmp_const, at
                    gimple-predicate-analysis.cc:257
           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 regression from 12.*, and affects 13.* and later.

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

[528] % 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/14.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
--disable-multilib
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 14.0.0 20230623 (experimental) [master r14-924-gd709841ae0f] (GCC)
[529] %
[529] % gcctk -w -O3 -Wall -fno-tree-vrp -fno-tree-dominator-opts
-fno-tree-copy-prop -fno-tree-fre -fno-tree-ccp -fno-tree-forwprop small.c
during GIMPLE pass: uninit
small.c: In function ‘b’:
small.c:2:6: internal compiler error: in find_var_cmp_const, at
gimple-predicate-analysis.cc:257
    2 | void b() {
      |      ^
0x8c4b9b find_var_cmp_const
        ../../gcc-trunk/gcc/gimple-predicate-analysis.cc:257
0x1d636a3 uninit_analysis::overlap(gphi*, unsigned int, hash_set<gphi*, false,
default_hash_traits<gphi*> >*, predicate const&)
        ../../gcc-trunk/gcc/gimple-predicate-analysis.cc:649
0x1d631a8 uninit_analysis::is_use_guarded(gimple*, basic_block_def*, gphi*,
unsigned int, hash_set<gphi*, false, default_hash_traits<gphi*> >*)
        ../../gcc-trunk/gcc/gimple-predicate-analysis.cc:2226
0x1d637d9 uninit_analysis::is_use_guarded(gimple*, basic_block_def*, gphi*,
unsigned int)
        ../../gcc-trunk/gcc/gimple-predicate-analysis.cc:2264
0x1213ee0 find_uninit_use
        ../../gcc-trunk/gcc/tree-ssa-uninit.cc:1243
0x1214916 warn_uninitialized_phi
        ../../gcc-trunk/gcc/tree-ssa-uninit.cc:1313
0x1214916 execute_late_warn_uninitialized
        ../../gcc-trunk/gcc/tree-ssa-uninit.cc:1434
0x1214916 execute
        ../../gcc-trunk/gcc/tree-ssa-uninit.cc:1451
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.
[530] %
[530] % cat small.c
int a;
void b() {
  int c, d, f, g, i;
  if (a)
    goto L2;
  for (;;) {
    g = 2;
    for (;;) {
      if (f)
      L1:
        if (d)
          break;
      g | f && c;
      if (c)
        goto L1;
      i = ~c;
    L2:
      c = i;
    }
  }
}

Reply via email to