https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94482
Bug ID: 94482 Summary: Inserting into vector with optimization enabled on x86 generates incorrect result Product: gcc Version: 9.3.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: target Assignee: unassigned at gcc dot gnu.org Reporter: e...@coeus-group.com Target Milestone: --- Created attachment 48193 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=48193&action=edit Test case I'm tyring to implement _mm_insert_epi64 without relying on intrinsics. The GCC-generated executable fails on x86 (but not x86_64) at -O2 and above. AFAICT it works on every other architecture and optimiaztion level I've tried. It happens on every version of GCC I've tested (7 - 9.3.0), in both C and C++ modes. I've attached a test case (generated with C-Reduce, slightly modified to remove some unnecessary macros) which reproduces the issue. Line 4 is interesting; the j field isn't used anywhere but if you remove it the code works (unfortunately not an option in my project). Please let me know if you need any additional information.