Commit a3aad0e6 by Jakub Jelinek Committed by Jakub Jelinek

re PR c++/70272 (-flifetime-dse miscompilation starting with r217967)

	PR c++/70272
	* decl.c (begin_destructor_body): Don't insert clobber if
	is_empty_class (current_class_type).

	* g++.dg/opt/flifetime-dse5.C (main): Remove extra semicolon.
	* g++.dg/opt/flifetime-dse6.C: New test.
	* g++.dg/tree-ssa/ehcleanup-1.C: Adjust unreachable count.

From-SVN: r234296
parent b57e6e18
2016-03-17 Jakub Jelinek <jakub@redhat.com>
PR c++/70272
* decl.c (begin_destructor_body): Don't insert clobber if
is_empty_class (current_class_type).
2016-03-17 Marek Polacek <polacek@redhat.com>
PR c++/70194
......
......@@ -14354,7 +14354,9 @@ begin_destructor_body (void)
initialize_vtbl_ptrs (current_class_ptr);
finish_compound_stmt (compound_stmt);
if (flag_lifetime_dse)
if (flag_lifetime_dse
/* Clobbering an empty base is harmful if it overlays real data. */
&& !is_empty_class (current_class_type))
{
/* Insert a cleanup to let the back end know that the object is dead
when we exit the destructor, either normally or via exception. */
......
2016-03-17 Jakub Jelinek <jakub@redhat.com>
PR c++/70272
* g++.dg/opt/flifetime-dse5.C (main): Remove extra semicolon.
* g++.dg/opt/flifetime-dse6.C: New test.
* g++.dg/tree-ssa/ehcleanup-1.C: Adjust unreachable count.
2016-03-17 H.J. Lu <hongjiu.lu@intel.com>
PR driver/70192
......
......@@ -10,4 +10,4 @@ int main() {
C c;
if ( c.a == false )
__builtin_abort();
};
}
// PR c++/70272
// { dg-options -O2 }
// { dg-do run }
struct Empty { };
struct A { A() : a(true) { } bool a; ~A() { if (!a) __builtin_abort(); } };
struct B : Empty { B() : Empty() { } ~B() { } };
struct C : A, B { C() : A(), B() { } ~C() { } };
int main() {
C c;
}
......@@ -26,5 +26,5 @@ t (void)
// { dg-final { scan-tree-dump-times "Empty EH handler" 2 "ehcleanup1" } }
//
// And as a result also contained control flow.
// { dg-final { scan-tree-dump-times "Removing unreachable" 6 "ehcleanup1" } }
// { dg-final { scan-tree-dump-times "Removing unreachable" 4 "ehcleanup1" } }
//
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment