gcc-patches@gcc.gnu.org
[Top] [All Lists]

[PATCH] Fix Obj-C++ regressions (PR obj-c++/42156)

Subject: [PATCH] Fix Obj-C++ regressions PR obj-c++/42156
From: Jakub Jelinek
Date: Fri, 27 Nov 2009 05:16:46 -0500
Hi!

http://gcc.gnu.org/ml/gcc-patches/2009-11/msg01059.html
broke completely Obj-C++.  The problem is the new set_underlying_type
call in build_self_reference, which creates a new type variant.
The ObjC FE apparently isn't prepared to see such a type variant in
objc_build_struct, expects that all type variants have already
TYPE_OBJC_INFO initialized.

The following patch fixes it, bootstrapped/regtested on x86_64-linux, fixes
all the recent obj-c++ regressions.

2009-11-27  Jakub Jelinek  <jakub@xxxxxxxxxx>

        PR obj-c++/42156
        * objc-act.c (objc_build_struct): INIT_TYPE_OBJC_INFO for
        type variants that don't have it initialized yet.

--- gcc/objc/objc-act.c.jj      2009-11-18 15:48:40.000000000 +0100
+++ gcc/objc/objc-act.c 2009-11-26 10:41:05.000000000 +0100
@@ -871,9 +871,16 @@ objc_build_struct (tree klass, tree fiel
      finish_struct(), and then reinstate it afterwards.  */
 
   for (t = TYPE_NEXT_VARIANT (s); t; t = TYPE_NEXT_VARIANT (t))
-    objc_info
-      = chainon (objc_info,
-                build_tree_list (NULL_TREE, TYPE_OBJC_INFO (t)));
+    {
+      if (!TYPE_HAS_OBJC_INFO (t))
+       {
+         INIT_TYPE_OBJC_INFO (t);
+         TYPE_OBJC_INTERFACE (t) = klass;
+       }
+      objc_info
+       = chainon (objc_info,
+                  build_tree_list (NULL_TREE, TYPE_OBJC_INFO (t)));
+    }
 
   /* Point the struct at its related Objective-C class.  */
   INIT_TYPE_OBJC_INFO (s);

        Jakub

<Prev in Thread] Current Thread [Next in Thread>