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

            Bug ID: 89710
           Summary: ICE in dyn_cast<gcond*, gimple>(gimple*) /
                    should_duplicate_loop_header_p
           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-alpha20190310 snapshot (r269561), 8.3, 7.3, 6.3, 5.4, 4.9.4 all ICE
when compiling the following testcase at -O1 (-O2, -O3, -Ofast):

void
gm (int *);

__attribute__ ((returns_twice)) void
jg (void)
{
}

void
eb (void)
{
  int r6 = 0;

  if (r6 != 0)
    gm (&r6);
}

void
gm (int *r6)
{
  jg ();

  for (;;)
    {
      eb ();
      *r6 = 0;
    }
}

% gcc-9.0.0-alpha20190310 -O1 -c ywwoc56m.c
during GIMPLE pass: ch
ywwoc56m.c: In function 'gm':
ywwoc56m.c:19:1: internal compiler error: Segmentation fault
   19 | gm (int *r6)
      | ^~
0xd65daf crash_signal
       
/var/tmp/portage/sys-devel/gcc-9.0.0_alpha20190310/work/gcc-9-20190310/gcc/toplev.c:326
0xe96cb8 gcond* dyn_cast<gcond*, gimple>(gimple*)
       
/var/tmp/portage/sys-devel/gcc-9.0.0_alpha20190310/work/gcc-9-20190310/gcc/is-a.h:224
0xe96cb8 should_duplicate_loop_header_p
       
/var/tmp/portage/sys-devel/gcc-9.0.0_alpha20190310/work/gcc-9-20190310/gcc/tree-ssa-loop-ch.c:103
0xe96cb8 copy_headers
       
/var/tmp/portage/sys-devel/gcc-9.0.0_alpha20190310/work/gcc-9-20190310/gcc/tree-ssa-loop-ch.c:395
0xe96cb8 copy_headers
       
/var/tmp/portage/sys-devel/gcc-9.0.0_alpha20190310/work/gcc-9-20190310/gcc/tree-ssa-loop-ch.c:350
0xe976d1 execute
       
/var/tmp/portage/sys-devel/gcc-9.0.0_alpha20190310/work/gcc-9-20190310/gcc/tree-ssa-loop-ch.c:533

Reply via email to