]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR c++/13387 (assignment to base class corrupts subclass)
authorNathan Sidwell <nathan@codesourcery.com>
Tue, 23 Dec 2003 09:02:12 +0000 (09:02 +0000)
committerNathan Sidwell <nathan@gcc.gnu.org>
Tue, 23 Dec 2003 09:02:12 +0000 (09:02 +0000)
PR c++/13387
* cp-lang.c (cxx_get_alias_set): Correct logic for a base type.

From-SVN: r74968

gcc/cp/ChangeLog
gcc/cp/cp-lang.c

index 9e39313868a9dc41d5858ac99eef1fe1119123fa..69cbbed94b361d1a459c65a989d295a1ae44ac5b 100644 (file)
@@ -1,3 +1,8 @@
+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>
 
        * decl.c (start_function): Do not check
index d9959e031ed975a8faf94854cb212907ff84c24b..94cf4623ee8358f28209cc0644b5a707b7673446 100644 (file)
@@ -292,11 +292,12 @@ ok_to_generate_alias_set_for_type (tree t)
 static HOST_WIDE_INT
 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)
     /* The base variant of a type must be in the same alias set as the
        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++.  */
       !ok_to_generate_alias_set_for_type (t)