Fix ICE when using -gcodeview with empty struct
Empty structs result in empty LF_FIELDLIST types, which are valid, but we weren't accounting for this and assuming they had to contain subtypes. gcc/ * dwarf2codeview.cc (get_type_num_struct): Fix NULL pointer dereference.
This commit is contained in:
parent
64fbaf36a3
commit
4c88b4e635
1 changed files with 5 additions and 2 deletions
|
@ -2858,8 +2858,11 @@ get_type_num_struct (dw_die_ref type, bool in_struct, bool *is_fwd_ref)
|
|||
ct2 = ct->next;
|
||||
ct->next = NULL;
|
||||
|
||||
if (ct->lf_fieldlist.last_subtype->kind == LF_INDEX)
|
||||
ct->lf_fieldlist.last_subtype->lf_index.type_num = last_type;
|
||||
if (ct->lf_fieldlist.last_subtype
|
||||
&& ct->lf_fieldlist.last_subtype->kind == LF_INDEX)
|
||||
{
|
||||
ct->lf_fieldlist.last_subtype->lf_index.type_num = last_type;
|
||||
}
|
||||
|
||||
add_custom_type (ct);
|
||||
last_type = ct->num;
|
||||
|
|
Loading…
Add table
Reference in a new issue