https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77983
Bug ID: 77983 Summary: [5/6/7 Regression] destructor call optimized out Product: gcc Version: 6.2.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: doko at gcc dot gnu.org Target Milestone: --- Created attachment 39808 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=39808&action=edit test case [forwarded from https://launchpad.net/bugs/1577891] seen with 5, 6 and trunk, works with 4.8 and 4.9. $ g++-4.8 -O1 -g -ggdb test.cpp && ./a.out Before:000102030405060708090a0b0c0d0e0f10111213 After :0000000000000000000000000000000000000000 $ g++-6 -O1 -g -ggdb test.cpp && ./a.out Before:000102030405060708090a0b0c0d0e0f10111213 After :000102030405060708090a0b0c0d0e0f10111213 $ g++-6 -O0 -g -ggdb test.cpp && ./a.out Before:000102030405060708090a0b0c0d0e0f10111213 After :0000000000000000000000000000000000000000