* [PATCH] Fix ICE when using -gcodeview with empty struct
@ 2024-07-28 22:41 Mark Harmstone
2024-07-30 20:49 ` Jeff Law
0 siblings, 1 reply; 2+ messages in thread
From: Mark Harmstone @ 2024-07-28 22:41 UTC (permalink / raw)
To: gcc-patches; +Cc: Mark Harmstone
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.
---
gcc/dwarf2codeview.cc | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/gcc/dwarf2codeview.cc b/gcc/dwarf2codeview.cc
index b16c6960f63..470cbae7110 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;
--
2.44.2
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] Fix ICE when using -gcodeview with empty struct
2024-07-28 22:41 [PATCH] Fix ICE when using -gcodeview with empty struct Mark Harmstone
@ 2024-07-30 20:49 ` Jeff Law
0 siblings, 0 replies; 2+ messages in thread
From: Jeff Law @ 2024-07-30 20:49 UTC (permalink / raw)
To: Mark Harmstone, gcc-patches
On 7/28/24 4:41 PM, Mark Harmstone wrote:
> 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.
OK
jeff
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-07-30 20:49 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-07-28 22:41 [PATCH] Fix ICE when using -gcodeview with empty struct Mark Harmstone
2024-07-30 20:49 ` Jeff Law
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).