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

            Bug ID: 89572
           Summary: ICE in dyn_cast<gcond*, gimple>(gimple*) /
                    get_loop_exit_condition(loop const*)
           Product: gcc
           Version: 9.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: ---

Another __attribute__((returns_twice)) issue.

gcc-9.0.0-alpha20190303 snapshot (r269357), 8.3, 7.3, 6.3, 5.4, 4.9.4 all ICE
when compiling the following testcase w/ -O2 -finline-functions:

int vh, it, k1;

void
vn (void)
{
  ++vh;
  if (vh == 0 && it == 0)
    k1 = -k1;
}

__attribute__ ((returns_twice)) void
ef (int *uw)
{
  while (uw != (void *) 0)
    {
      vn ();
      *uw = 0;
    }
}

void
gu (int *uw)
{
  ef (uw);
}

% gcc-9.0.0-alpha20190303 -O2 -finline-functions -c qnf39r7s.c
during GIMPLE pass: ivopts
qnf39r7s.c: In function 'gu':
qnf39r7s.c:22:1: internal compiler error: Segmentation fault
   22 | gu (int *uw)
      | ^~
0xd6fc4f crash_signal
       
/var/tmp/portage/sys-devel/gcc-9.0.0_alpha20190303/work/gcc-9-20190303/gcc/toplev.c:326
0xe4314d gcond* dyn_cast<gcond*, gimple>(gimple*)
       
/var/tmp/portage/sys-devel/gcc-9.0.0_alpha20190303/work/gcc-9-20190303/gcc/is-a.h:224
0xe4314d get_loop_exit_condition(loop const*)
       
/var/tmp/portage/sys-devel/gcc-9.0.0_alpha20190303/work/gcc-9-20190303/gcc/tree-scalar-evolution.c:913
0xfe2e27 find_loop_location(loop*)
       
/var/tmp/portage/sys-devel/gcc-9.0.0_alpha20190303/work/gcc-9-20190303/gcc/tree-vect-loop-manip.c:1322
0xec2e52 tree_ssa_iv_optimize_loop
       
/var/tmp/portage/sys-devel/gcc-9.0.0_alpha20190303/work/gcc-9-20190303/gcc/tree-ssa-loop-ivopts.c:7538
0xec2e52 tree_ssa_iv_optimize()
       
/var/tmp/portage/sys-devel/gcc-9.0.0_alpha20190303/work/gcc-9-20190303/gcc/tree-ssa-loop-ivopts.c:7628
0xee1f80 execute
       
/var/tmp/portage/sys-devel/gcc-9.0.0_alpha20190303/work/gcc-9-20190303/gcc/tree-ssa-loop.c:513

Reply via email to