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

            Bug ID: 104947
           Summary: ICE: SSA corruption (Unable to coalesce ssa_names 5
                    and 11 which are marked as MUST COALESCE.)
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Keywords: ice-on-valid-code
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: asolokha at gmx dot com
  Target Milestone: ---

gcc 12.0.1 20220313 snapshot (g:7e28750395889d16a9cba49cd5935ced7dc00ce8) ICEs
when compiling the following testcase w/ -O2 -fno-tree-dce -fno-tree-dse:

int n;

__attribute__ ((returns_twice)) void
foo (void);

void
bar (void);

void
quux (int x)
{
  if (x)
    ++x;
  else
    {
      if (n)
        {
          x = 1;
          foo ();
        }
      else
        bar ();

      if (n)
        {
          ++x;
          ++n;
        }
    }
}

% gcc-12.0.1 -O2 -fno-tree-dce -fno-tree-dse -c ehpnzg5r.c

Unable to coalesce ssa_names 5 and 11 which are marked as MUST COALESCE.
x_5(ab) and  x_11(D)(ab)
during RTL pass: expand
ehpnzg5r.c: In function 'quux':
ehpnzg5r.c:10:1: internal compiler error: SSA corruption
   10 | quux (int x)
      | ^~~~
0xff74bb fail_abnormal_edge_coalesce
       
/var/tmp/portage/sys-devel/gcc-12.0.1_p20220313/work/gcc-12-20220313/gcc/tree-ssa-coalesce.cc:1003
0xff74bb coalesce_partitions
       
/var/tmp/portage/sys-devel/gcc-12.0.1_p20220313/work/gcc-12-20220313/gcc/tree-ssa-coalesce.cc:1425
0xff74bb coalesce_ssa_name(_var_map*)
       
/var/tmp/portage/sys-devel/gcc-12.0.1_p20220313/work/gcc-12-20220313/gcc/tree-ssa-coalesce.cc:1755
0xf89ef1 remove_ssa_form
       
/var/tmp/portage/sys-devel/gcc-12.0.1_p20220313/work/gcc-12-20220313/gcc/tree-outof-ssa.cc:1065
0xf89ef1 rewrite_out_of_ssa(ssaexpand*)
       
/var/tmp/portage/sys-devel/gcc-12.0.1_p20220313/work/gcc-12-20220313/gcc/tree-outof-ssa.cc:1323
0x9d9d56 execute
       
/var/tmp/portage/sys-devel/gcc-12.0.1_p20220313/work/gcc-12-20220313/gcc/cfgexpand.cc:6585

Reply via email to