https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61203
Bug ID: 61203 Summary: [4.7/4.8/4.9/4.10 Regression] g++.old-deja/g++.jason/rvalue2.C FAILs with -O2 -fno-inline Product: gcc Version: 4.10.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: zsojka at seznam dot cz Created attachment 32809 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=32809&action=edit reduced testcase I think the code has defined behaviour. The temporal object created by A() is afaict alive when the pointer comparison is being done (but it is not when the result of the comparison is being used)... but it might easily happen that I am wrong; I am certainly not an C++ expert, the code is quite artificial. Attached is a reduced testcase. Output: $ g++ -O2 testcase.C $ ./a.out a.out: testcase.C:16: int main(): Assertion `!r' failed. Aborted Tested revisions: trunk r210490 - fail 4.9 r210307 - fail 4.8 r210303 - fail 4.7 r210302 - fail 4.6 r197894 - OK