Commit 1dc7b1f2 by Jason Merrill Committed by Jason Merrill

re PR c++/62017 (AddressSanitizer reports *-buffer-overflow in destructor when…

re PR c++/62017 (AddressSanitizer reports *-buffer-overflow in destructor when multiple virtual inheritance is used)

	PR c++/62017
	* decl.c (begin_destructor_body): Only clobber the as-base part of
	*this.

From-SVN: r215427
parent 1c2c9440
2014-09-20 Jason Merrill <jason@redhat.com>
PR c++/62017
* decl.c (begin_destructor_body): Only clobber the as-base part of
*this.
2014-09-19 Jason Merrill <jason@redhat.com> 2014-09-19 Jason Merrill <jason@redhat.com>
PR c++/61392 PR c++/61392
......
...@@ -13808,10 +13808,12 @@ begin_destructor_body (void) ...@@ -13808,10 +13808,12 @@ begin_destructor_body (void)
/* Insert a cleanup to let the back end know that the object is dead /* Insert a cleanup to let the back end know that the object is dead
when we exit the destructor, either normally or via exception. */ when we exit the destructor, either normally or via exception. */
tree clobber = build_constructor (current_class_type, NULL); tree btype = CLASSTYPE_AS_BASE (current_class_type);
tree clobber = build_constructor (btype, NULL);
TREE_THIS_VOLATILE (clobber) = true; TREE_THIS_VOLATILE (clobber) = true;
tree exprstmt = build2 (MODIFY_EXPR, current_class_type, tree bref = build_nop (build_reference_type (btype), current_class_ptr);
current_class_ref, clobber); bref = convert_from_reference (bref);
tree exprstmt = build2 (MODIFY_EXPR, btype, bref, clobber);
finish_decl_cleanup (NULL_TREE, exprstmt); finish_decl_cleanup (NULL_TREE, exprstmt);
/* And insert cleanups for our bases and members so that they /* And insert cleanups for our bases and members so that they
......
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