https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105751
Richard Biener <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Last reconfirmed| |2022-05-30 Status|UNCONFIRMED |NEW Ever confirmed|0 |1 --- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> --- Confirmed. We end up expanding <bb 2> [local count: 1073741824]: _5 = a_2(D) + 8; _6 = &MEM[(const struct array *)a_2(D)]._M_elems; _8 = _5 - _6; __len_9 = (const size_t) _8; if (__len_9 != 0) goto <bb 3>; [50.00%] else goto <bb 4>; [50.00%] <bb 3> [local count: 536870913]: _4 = &MEM[(const struct array *)b_3(D)]._M_elems; _10 = __builtin_memcmp_eq (_6, _4, __len_9); _11 = _10 == 0; <bb 4> [local count: 1073741824]: # _12 = PHI <1(2), _11(3)> return _12; So somehow the size is not known to be 8 and thus the proposed optimized code would compare uninitialized memory?