aboutsummaryrefslogtreecommitdiff
path: root/gcc/dwarf2codeview.cc
diff options
context:
space:
mode:
authorMark Harmstone <mark@harmstone.com>2024-07-26 20:46:33 +0100
committerMark Harmstone <mark@harmstone.com>2024-08-01 02:36:54 +0100
commit4c88b4e635f6025a897c5d059628e63ec5ba948f (patch)
tree4358c34733a9784df98b0ca6f19acdd2cf0a5fc7 /gcc/dwarf2codeview.cc
parent64fbaf36a3834c394422cdf86985c7cc45179925 (diff)
downloadgcc-4c88b4e635f6025a897c5d059628e63ec5ba948f.zip
gcc-4c88b4e635f6025a897c5d059628e63ec5ba948f.tar.gz
gcc-4c88b4e635f6025a897c5d059628e63ec5ba948f.tar.bz2
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.
Diffstat (limited to 'gcc/dwarf2codeview.cc')
-rw-r--r--gcc/dwarf2codeview.cc7
1 files changed, 5 insertions, 2 deletions
diff --git a/gcc/dwarf2codeview.cc b/gcc/dwarf2codeview.cc
index b16c696..470cbae 100644
--- a/gcc/dwarf2codeview.cc
+++ b/gcc/dwarf2codeview.cc
@@ -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;