https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99728
--- Comment #10 from Matthias Kretz (Vir) <kretz at kde dot org> ---
Is this the same issue:
struct A {
double v;
};
struct B {
double v;
B& operator=(const B& rhs) {
v = rhs.v;
return *this;
}
};
// 10 loads & stores
void f(A& a, const A& b) {
for (int i = 0; i < 10; ++i) a = b;
}
// 1 load & store
void f(B& a, const B& b) {
for (int i = 0; i < 10; ++i) a = b;
}
I.e. by turning the aggregate assignment into an explicit assignment of the
fundamental (including vector) type, the issue can be worked around.