https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94482
Jakub Jelinek <jakub at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Summary|Inserting into vector with |[8/9/10 Regression] |optimization enabled on x86 |Inserting into vector with |generates incorrect result |optimization enabled on x86 | |generates incorrect result Target Milestone|--- |8.5 --- Comment #14 from Jakub Jelinek <jakub at gcc dot gnu.org> --- The above testcase FAILs with all of 7/8/9/10, works with 6. -fno-tree-sra fixes it. Unless BIT_FIELD_REF with a non-SSA_NAME first operand is invalid on the lhs of assignment, I believe this is a SRA bug. Before SRA we have: z.j = { 0, 0, 0, 0 }; BIT_FIELD_REF <z.i, 64, 0> = 1729; _11 = z.j; z ={v} {CLOBBER}; z.j = _11; BIT_FIELD_REF <z.i, 64, 64> = 2; _6 = z.j; z ={v} {CLOBBER}; z.j = _6; _3 = BIT_FIELD_REF <z.i, 64, 0>; if (_3 != 1729) but SRA transforms it into: z$j = { 0, 0, 0, 0 }; BIT_FIELD_REF <z.i, 64, 0> = 1729; _19 = MEM[(union U *)&z]; z$j = _19; _1 = z$j; _11 = _1; z$j ={v} {CLOBBER}; z$j = _11; BIT_FIELD_REF <z.i, 64, 64> = 2; _15 = MEM[(union U *)&z]; z$j = _15; _12 = z$j; _6 = _12; z$j ={v} {CLOBBER}; z$j_22 = _6; MEM[(union U *)&z] = z$j_22; _3 = BIT_FIELD_REF <z.i, 64, 0>; if (_3 != 1729) which is definitely not equivalent.