Commit 5d027e7b by Nathan Sidwell Committed by Nathan Sidwell

re PR c++/13387 (assignment to base class corrupts subclass)

	PR c++/13387
	* cp-lang.c (cxx_get_alias_set): Correct logic for a base type.

From-SVN: r74968
parent 4b8a63d6
2003-12-23 Nathan Sidwell <nathan@codesourcery.com>
PR c++/13387
* cp-lang.c (cxx_get_alias_set): Correct logic for a base type.
2003-12-22 Mark Mitchell <mark@codesourcery.com> 2003-12-22 Mark Mitchell <mark@codesourcery.com>
* decl.c (start_function): Do not check * decl.c (start_function): Do not check
......
...@@ -292,11 +292,12 @@ ok_to_generate_alias_set_for_type (tree t) ...@@ -292,11 +292,12 @@ ok_to_generate_alias_set_for_type (tree t)
static HOST_WIDE_INT static HOST_WIDE_INT
cxx_get_alias_set (tree t) cxx_get_alias_set (tree t)
{ {
if (CLASS_TYPE_P (t) && TYPE_CONTEXT (t) && CLASS_TYPE_P (TYPE_CONTEXT (t)) if (TREE_CODE (t) == RECORD_TYPE
&& TYPE_CONTEXT (t) && CLASS_TYPE_P (TYPE_CONTEXT (t))
&& CLASSTYPE_AS_BASE (TYPE_CONTEXT (t)) == t) && CLASSTYPE_AS_BASE (TYPE_CONTEXT (t)) == t)
/* The base variant of a type must be in the same alias set as the /* The base variant of a type must be in the same alias set as the
complete type. */ complete type. */
t = TYPE_CONTEXT (t); return get_alias_set (TYPE_CONTEXT (t));
if (/* It's not yet safe to use alias sets for some classes in C++. */ if (/* It's not yet safe to use alias sets for some classes in C++. */
!ok_to_generate_alias_set_for_type (t) !ok_to_generate_alias_set_for_type (t)
......
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