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

            Bug ID: 89588
           Summary: [8/9 Regression] ICE in
                    unroll_loop_constant_iterations, at loop-unroll.c:498
           Product: gcc
           Version: 9.0
            Status: UNCONFIRMED
          Keywords: ice-on-valid-code
          Severity: normal
          Priority: P3
         Component: rtl-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: asolokha at gmx dot com
  Target Milestone: ---

gcc-9.0.0-alpha20190303 snapshot (r269357) ICEs when compiling the following
testcase w/ -O1 -fno-tree-loop-optimize:

void
bb (void)
{
  int nv;

#pragma GCC unroll 2
  for (nv = 0; nv <= 2; nv += 2)
    {
    }
}

% gcc-9.0.0-alpha20190303 -O1 -fno-tree-loop-optimize -c hiz1wdrt.c
during RTL pass: loop2_unroll
hiz1wdrt.c: In function 'bb':
hiz1wdrt.c:10:1: internal compiler error: in unroll_loop_constant_iterations,
at loop-unroll.c:498
   10 | }
      | ^
0x65443d unroll_loop_constant_iterations
       
/var/tmp/portage/sys-devel/gcc-9.0.0_alpha20190303/work/gcc-9-20190303/gcc/loop-unroll.c:498
0x65443d unroll_loops(int)
       
/var/tmp/portage/sys-devel/gcc-9.0.0_alpha20190303/work/gcc-9-20190303/gcc/loop-unroll.c:295
0xbcbf0f execute
       
/var/tmp/portage/sys-devel/gcc-9.0.0_alpha20190303/work/gcc-9-20190303/gcc/loop-init.c:584
0xbcbf0f execute
       
/var/tmp/portage/sys-devel/gcc-9.0.0_alpha20190303/work/gcc-9-20190303/gcc/loop-init.c:571

Even though I cannot reproduce the ICE w/ gcc older than 8, it seems the firing
assert has been there forever. -fno-tree-loop-optimize breaks the designed-in
assumption on this this particular transformation is based.

Reply via email to