https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66648
Bug ID: 66648 Summary: [4.9/5/6 regression] incorrect memcpy expansion with unrolled_loop strategy at -O2 Product: gcc Version: 6.0 Status: UNCONFIRMED Keywords: wrong-code Severity: normal Priority: P3 Component: target Assignee: unassigned at gcc dot gnu.org Reporter: ebotcazou at gcc dot gnu.org Target Milestone: --- Target: x86_64-*-linux Created attachment 35840 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=35840&action=edit Testcase One of the numerous paths of ix86_expand_set_or_movmem using the unrolled_loop strategy can generate wrong code (buffer overflow) at -O2, when VRP is able to compute a minimum copying size. Compile and run the attached testcase with -O2 -mstringop-strategy=unrolled_loop -mtune=nocona on a x86-64/Linux machine.