This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[gccgo] Don't crash when using an undefined type as an anonymous field


I committed this patch to the gccgo branch to avoid a crash when using
an undefined type as an anonymous field in a struct.

Ian


Index: types.cc
===================================================================
--- types.cc	(revision 155357)
+++ types.cc	(working copy)
@@ -5164,7 +5164,14 @@ Named_type::add_embedded_methods_for_typ
 	  is_pointer = true;
 	}
       Named_type* fntype = ftype->named_type();
-      gcc_assert(fntype != NULL);
+      if (fntype == NULL)
+	{
+	  Forward_declaration_type *fdtype = ftype->forward_declaration_type();
+	  gcc_assert(fdtype != NULL);
+	  Type* t = fdtype->real_type();
+	  gcc_assert(t->is_error_type());
+	  continue;
+	}
 
       Method::Field_indexes* sub_field_indexes = new Method::Field_indexes();
       sub_field_indexes->next = field_indexes;

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]