https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102421
--- Comment #9 from Andrew Pinski <pinskia at gcc dot gnu.org> --- Unincluded testcase: #include <vector> template<typename ValueType> struct BasicVector { ValueType& operator[](int i) { return x_[i]; } ValueType operator[](int i) const { return x_[i]; } ValueType x_[3]; }; typedef int ivec1[3]; typedef BasicVector<double> RVec1; void foo ( std::vector<RVec1> &x_, std::vector<RVec1> &xp_, int homenr, unsigned short* cFREEZE, const ivec1* nFreeze) { auto xp = xp_; auto x = x_; for (int i = 0; i < homenr; i++) { const int g = cFREEZE[i]; for (int d = 0; d < 3; d++) { if (nFreeze[g][d] == 0) x[i][d] = xp[i][d]; } } }