This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[gccgo] Don't crash when using an undefined type as an anonymous field
- From: Ian Lance Taylor <iant at google dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Mon, 21 Dec 2009 21:48:39 -0800
- Subject: [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;