https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84505
Bug ID: 84505 Summary: [8 Regression] store-merging miscompilation on i586 in xemacs package starting with r254391 Product: gcc Version: 7.0 Status: UNCONFIRMED Keywords: wrong-code Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: marxin at gcc dot gnu.org CC: jakub at gcc dot gnu.org Target Milestone: --- I'm still reducing the test-case, but with: $ gcc -O2 -m32 alloc.i -funroll-loops -fdump-tree-optimized=/tmp/bad.txt -c -o /tmp/bad.s -S -fno-strict-aliasing I see following difference in tree-optimized dump: $ diff -u /tmp/good.txt /tmp/bad.txt -U20 --- /tmp/good.txt 2018-02-21 19:15:26.081205161 +0100 +++ /tmp/bad.txt 2018-02-21 19:23:04.898349760 +0100 @@ -9831,50 +9831,49 @@ free_marker (Lisp_Object ptr) { struct Lisp_Marker * FFT_ptr; struct Lisp_Free * marker_free_list.705_1; long int consing_since_gc.706_2; long unsigned int consing_since_gc.707_3; long unsigned int _4; long int _5; long unsigned int total_consing.708_6; long unsigned int _7; int profiling_active.709_8; int gc_count_num_marker_freelist.711_10; int _11; long int prephitmp_31; long int pretmp_40; <bb 2> [local count: 1431]: FFT_ptr_15 = (struct Lisp_Marker *) ptr_14(D); unchain_marker (ptr_14(D)); - MEM[(unsigned int *)FFT_ptr_15] = 3735928559; - MEM[(unsigned int *)FFT_ptr_15 + 4B] = 3735928559; MEM[(unsigned int *)FFT_ptr_15 + 8B] = 3735928559; MEM[(unsigned int *)FFT_ptr_15 + 12B] = 3735928559; MEM[(unsigned int *)FFT_ptr_15 + 16B] = 3735928559; MEM[(unsigned int *)FFT_ptr_15 + 20B] = 3735928559; marker_free_list.705_1 = marker_free_list; MEM[(struct Lisp_Free *)FFT_ptr_15].chain = marker_free_list.705_1; marker_free_list = FFT_ptr_15; - MEM[(struct lrecord_header *)FFT_ptr_15].type = 69; + MEM[(void *)FFT_ptr_15] = 3735928389; + MEM[(unsigned int *)FFT_ptr_15 + 4B] = 3735928559; consing_since_gc.706_2 = consing_since_gc; consing_since_gc.707_3 = (long unsigned int) consing_since_gc.706_2; _4 = consing_since_gc.707_3 + 4294967272; _5 = (long int) _4; consing_since_gc = _5; total_consing.708_6 = total_consing; _7 = total_consing.708_6 + 4294967272; total_consing = _7; profiling_active.709_8 = profiling_active; if (profiling_active.709_8 != 0) goto <bb 3>; [33.00%] else goto <bb 4>; [67.00%] <bb 3> [local count: 472]: profile_record_unconsing (24); pretmp_40 = consing_since_gc; <bb 4> [local count: 1429]: # prephitmp_31 = PHI <pretmp_40(3), _5(2)> I suspect later 2 stores: + MEM[(void *)FFT_ptr_15] = 3735928389; + MEM[(unsigned int *)FFT_ptr_15 + 4B] = 3735928559; which overwrite: MEM[(struct Lisp_Free *)FFT_ptr_15].chain = marker_free_list.705_1; It's probably connected with aliasing analysis that allows store motion after the *.chain store.