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

            Bug ID: 117638
           Summary: [14/15 regression] No loop splitting and bounds check
                    not optimized out with -D_GLIBCXX_ASSERTIONS
           Product: gcc
           Version: 15.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: sjames at gcc dot gnu.org
  Target Milestone: ---

With a modified version of g++.dg/tree-ssa/loop-split-1.C (s/reserve/resize):
```
#include <vector>
#include <cmath>

constexpr unsigned s = 100000000;

int main()
{
    std::vector<float> a, b, c;
    a.resize(s);
    b.resize(s);
    c.resize(s);

    for(unsigned i = 0; i < s; ++i)
    {
        if(i == 0)
            a[i] = b[i] * c[i];
        else
            a[i] = (b[i] + c[i]) * c[i-1] * std::log(i);
    }
}
```

I see the following:
* With GCC 13 using -D_GLIBCXX_ASSERTIONS, we split the loop.
* With GCC 14 and trunk using -D_GLIBCXX_ASSERTIONS, we can't.
* We don't seem able to optimise out the bounds check with GCC 14 and trunk
(and we do it on every iteration!)

Reply via email to