public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Fix Obj-C++ regressions (PR obj-c++/42156)
@ 2009-11-27 10:20 Jakub Jelinek
  2009-11-27 19:23 ` Jason Merrill
  0 siblings, 1 reply; 2+ messages in thread
From: Jakub Jelinek @ 2009-11-27 10:20 UTC (permalink / raw)
  To: gcc-patches; +Cc: Jason Merrill

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@redhat.com>

	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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] Fix Obj-C++ regressions (PR obj-c++/42156)
  2009-11-27 10:20 [PATCH] Fix Obj-C++ regressions (PR obj-c++/42156) Jakub Jelinek
@ 2009-11-27 19:23 ` Jason Merrill
  0 siblings, 0 replies; 2+ messages in thread
From: Jason Merrill @ 2009-11-27 19:23 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: gcc-patches

OK, seems reasonable.  If ObjC folk want to do something else, they can.

Jason

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-11-27 19:22 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-11-27 10:20 [PATCH] Fix Obj-C++ regressions (PR obj-c++/42156) Jakub Jelinek
2009-11-27 19:23 ` Jason Merrill

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).