DWARF represents voids in DW_TAG_const_type and DW_TAG_volatile_type
DIEs by the absence of a DW_AT_type attribute, which we weren't handling
correctly.
gcc/
* dwarf2codeview.cc (get_type_num_const_type): Handle missing
DW_AT_type attribute.
(get_type_num_volatile_type): Likewise.
---
gcc/dwarf2codeview.cc | 36 ++++++++++++++++++++++++------------
1 file changed, 24 insertions(+), 12 deletions(-)
diff --git a/gcc/dwarf2codeview.cc b/gcc/dwarf2codeview.cc
index 470cbae7110..f7107021bc7 100644
--- a/gcc/dwarf2codeview.cc
+++ b/gcc/dwarf2codeview.cc
@@ -2344,23 +2344,26 @@ get_type_num_const_type (dw_die_ref type, bool
in_struct)
bool is_volatile = false;
base_type = get_AT_ref (type, DW_AT_type);
- if (!base_type)
- return 0;
/* Handle case when this is a const volatile type - we only need one
LF_MODIFIER for this. */
- if (dw_get_die_tag (base_type) == DW_TAG_volatile_type)
+ if (base_type && dw_get_die_tag (base_type) == DW_TAG_volatile_type)
{
is_volatile = true;
base_type = get_AT_ref (base_type, DW_AT_type);
- if (!base_type)
- return 0;
}
- base_type_num = get_type_num (base_type, in_struct, false);
- if (base_type_num == 0)
- return 0;
+ if (!base_type)
+ {
+ base_type_num = T_VOID;
+ }
+ else
+ {
+ base_type_num = get_type_num (base_type, in_struct, false);
+ if (base_type_num == 0)
+ return 0;
+ }
ct = (codeview_custom_type *) xmalloc (sizeof (codeview_custom_type));
@@ -2383,13 +2386,22 @@ get_type_num_const_type (dw_die_ref type, bool
in_struct)
static uint32_t
get_type_num_volatile_type (dw_die_ref type, bool in_struct)
{
+ dw_die_ref base_type;
uint32_t base_type_num;
codeview_custom_type *ct;
- base_type_num = get_type_num (get_AT_ref (type, DW_AT_type), in_struct,
- false);
- if (base_type_num == 0)
- return 0;
+ base_type = get_AT_ref (type, DW_AT_type);
+
+ if (base_type)
+ {
+ base_type_num = get_type_num (base_type, in_struct, false);
+ if (base_type_num == 0)
+ return 0;
+ }
+ else
+ {
+ base_type_num = T_VOID;
+ }
ct = (codeview_custom_type *) xmalloc (sizeof (codeview_custom_type));
--
2.44.2