Commit 81ef977e by Ian Lance Taylor

Don't crash on empty struct created due to recursive reference.

From-SVN: r167881
parent bd9c1f8f
...@@ -9628,7 +9628,13 @@ Field_reference_expression::do_get_tree(Translate_context* context) ...@@ -9628,7 +9628,13 @@ Field_reference_expression::do_get_tree(Translate_context* context)
return error_mark_node; return error_mark_node;
gcc_assert(TREE_CODE(TREE_TYPE(struct_tree)) == RECORD_TYPE); gcc_assert(TREE_CODE(TREE_TYPE(struct_tree)) == RECORD_TYPE);
tree field = TYPE_FIELDS(TREE_TYPE(struct_tree)); tree field = TYPE_FIELDS(TREE_TYPE(struct_tree));
gcc_assert(field != NULL_TREE); if (field == NULL_TREE)
{
// This can happen for a type which refers to itself indirectly
// and then turns out to be erroneous.
gcc_assert(saw_errors());
return error_mark_node;
}
for (unsigned int i = this->field_index_; i > 0; --i) for (unsigned int i = this->field_index_; i > 0; --i)
{ {
field = DECL_CHAIN(field); field = DECL_CHAIN(field);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment