https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68547
Bug ID: 68547 Summary: incorrect optimization Product: gcc Version: 5.2.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: rtl-optimization Assignee: unassigned at gcc dot gnu.org Reporter: jan.sm...@alcatel-lucent.com Target Milestone: --- Created attachment 36841 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=36841&action=edit test case $ g++ test.cc -o test -O2 -Wall && ./test DEL element[1]=200 volatile DEL element[1]=200 last_element_index=2 (should be 2) volatile DEL element[1]=200 DEL element[1]=200 last_element_index=1 (should be 2) $ g++ test.cc -o test -O0 -Wall && ./test DEL element[1]=200 volatile DEL element[1]=200 last_element_index=2 (should be 2) volatile DEL element[1]=200 DEL element[1]=200 last_element_index=2 (should be 2)