https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97053
Richard Biener <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Target Milestone|--- |10.3 Status|UNCONFIRMED |NEW Summary|an O2, O3 codegen bug |[10/11 Regression] an O2, | |O3 codegen bug Component|c++ |tree-optimization CC| |ebotcazou at gcc dot gnu.org, | |jakub at gcc dot gnu.org Last reconfirmed| |2020-09-15 Priority|P3 |P2 Ever confirmed|0 |1 Keywords| |wrong-code --- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> --- Confirmed. It is store-mergings wrong-doing: > diff -u t.ii.194t.widening_mul t.ii.195t.store-merging --- t.ii.194t.widening_mul 2020-09-15 08:15:39.824282586 +0200 +++ t.ii.195t.store-merging 2020-09-15 08:15:39.824282586 +0200 @@ -1,6 +1,10 @@ ;; Function main (main, funcdef_no=26, decl_uid=3207, cgraph_uid=27, symbol_order=26) (executed once) +Coalescing successful! +Merged into 1 stores +New sequence of 2 stores to replace old one of 3 stores +Merging successful! main (int argc, char * * argv) { const size_t len; @@ -11,12 +15,11 @@ <bb 2> [local count: 1073741824]: orig = "XXXXXXXX"; memcpy (&orig, "ABCD", 4); - MEM <char[12]> [(struct Data *)&data + 8B] = {}; data.n = 5; _7 = MEM <long unsigned int> [(char * {ref-all})&orig]; MEM <long unsigned int> [(char * {ref-all})&data + 2B] = _7; - data.s = 88; - data.b = 1; + MEM <unsigned long> [(struct Data *)&data + 8B] = 0; + MEM <unsigned long> [(void *)&data + 16B] = 4294967384; len_11 = strlen (&data.name); printf ("runtime len=%lu\n", len_11); printf ("orig=%s\ncopy=%s\n", &orig, &data.name); we merge data + 8 = {} "across" data + 2 = _7 but fail to see they alias.