https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107798
Andrew Pinski <pinskia at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Resolution|--- |INVALID Status|UNCONFIRMED |RESOLVED --- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> --- The code has undefined behavior in it due to: (*m)[i] as *m array is only specified for 0..3 but you are doing it as 0..9. You can instead do: A *d = &m[0][0]; for (unsigned int i = 0; i < 3 * 3 && ((d)[i].flag || (d)[i].v.size()); ++i) And this will work correctly.