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

            Bug ID: 102403
           Summary: [12 Regression] ICE in in init_from_control_deps, at
                    gimple-predicate-analysis.cc:2364
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: middle-end
          Assignee: unassigned at gcc dot gnu.org
          Reporter: msebor at gcc dot gnu.org
  Target Milestone: ---

As reported in
https://gcc.gnu.org/pipermail/gcc-patches/2021-September/579736.html, the
following test case reduced from s_fmaf.c triggers an ICE in the new
predicate-analysis module introduced in r12-3640.

$ cat s_fmaf.c && gcc -S -O2 -Wall -Werror s_fmaf.c
int __fmaf (void)
{
  int a = 0;
  int b, c, d, e, f;

  int r = 0;

  switch (b)
    {
    default:
      c |= 1;

    case 0:
      if (c == 0)
        a = 1;

      switch (d) {
      case 15:
        f = c;
        break;

      case 11:
      case 6:
      case 4:
        f = c;
      case 10:
        e = a;
      }

      if (e == 0)
        f = 0;

      r = f;
  }
  return r;
}
s_fmaf.c: In function ‘__fmaf’:
s_fmaf.c:8:3: error: ‘b’ is used uninitialized [-Werror=uninitialized]
    8 |   switch (b)
      |   ^~~~~~
s_fmaf.c:4:7: note: ‘b’ was declared here
    4 |   int b, c, d, e, f;
      |       ^
s_fmaf.c:4:13: error: ‘d’ is used uninitialized [-Werror=uninitialized]
    4 |   int b, c, d, e, f;
      |             ^
s_fmaf.c:4:10: error: ‘c’ may be used uninitialized
[-Werror=maybe-uninitialized]
    4 |   int b, c, d, e, f;
      |          ^
during GIMPLE pass: uninit
s_fmaf.c:1:5: internal compiler error: in init_from_control_deps, at
gimple-predicate-analysis.cc:2364
    1 | int __fmaf (void)
      |     ^~~~~~
0x264d8b4 predicate::init_from_control_deps(vec<edge_def*, va_heap, vl_ptr>
const*, unsigned int)
        /src/gcc/master/gcc/gimple-predicate-analysis.cc:2364
0x264c28c predicate::init_from_phi_def(gphi*)
        /src/gcc/master/gcc/gimple-predicate-analysis.cc:1829
0x264c47a predicate::is_use_guarded(gimple*, basic_block_def*, gphi*, unsigned
int, hash_set<gphi*, false, default_hash_traits<gphi*> >*)
        /src/gcc/master/gcc/gimple-predicate-analysis.cc:1902
0x264c5b3 predicate::is_use_guarded(gimple*, basic_block_def*, gphi*, unsigned
int)
        /src/gcc/master/gcc/gimple-predicate-analysis.cc:1933
0x1672895 find_uninit_use
        /src/gcc/master/gcc/tree-ssa-uninit.c:1092
0x1672b11 warn_uninitialized_phi
        /src/gcc/master/gcc/tree-ssa-uninit.c:1149
0x1673090 execute_late_warn_uninitialized
        /src/gcc/master/gcc/tree-ssa-uninit.c:1275
0x167310b execute
        /src/gcc/master/gcc/tree-ssa-uninit.c:1288
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.

Reply via email to