Commit c5e003cf by Jason Merrill Committed by Jason Merrill

re PR c++/70259 (-flifetime-dse=2 bug with empty bases)

	PR c++/70259
	* decl.c (start_preparsed_function): Don't clobber an empty base.

From-SVN: r234267
parent da0ad263
2016-03-16 Jason Merrill <jason@redhat.com>
PR c++/70259
* decl.c (start_preparsed_function): Don't clobber an empty base.
2016-03-16 Jakub Jelinek <jakub@redhat.com>
PR c++/70147
......
......@@ -14121,6 +14121,8 @@ start_preparsed_function (tree decl1, tree attrs, int flags)
&& (flag_lifetime_dse > 1)
&& DECL_CONSTRUCTOR_P (decl1)
&& !DECL_CLONED_FUNCTION_P (decl1)
/* Clobbering an empty base is harmful if it overlays real data. */
&& !is_empty_class (current_class_type)
/* We can't clobber safely for an implicitly-defined default constructor
because part of the initialization might happen before we enter the
constructor, via AGGR_INIT_ZERO_FIRST (c++/68006). */
......
// PR c++/70259
// { dg-options -O2 }
// { dg-do run }
struct Empty { };
struct A { A() : a(true) { } bool a; };
struct B : Empty { B() : Empty() { } };
struct C : A, B { C() : A(), B() { } };
int main() {
C c;
if ( c.a == false )
__builtin_abort();
};
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