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

            Bug ID: 97077
           Summary: Missed loop unrolling with range for over initializer
                    list
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: bmburstein at gmail dot com
  Target Milestone: ---

In the following code:

#include <initializer_list>

int foo(int);

int main() {
    for(int i=0; i<5; ++i) {
        foo(i);
    }
    for(int i : {0,1,2,3,4}) {
        foo(i);
    }
}

The 2 loops should probably produce identical output. However, the output I see
here https://godbolt.org/z/z1We36 (using the trunk from 2020-09-15) shows that
the first loop (the traditional one) is indeed unrolled as expected, but the
second one is not.

Reply via email to