[Bug debug/93988] New: invalid DWARF emitted for complex integer
tromey at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Sun Mar 1 16:51:00 GMT 2020
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93988
Bug ID: 93988
Summary: invalid DWARF emitted for complex integer
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: debug
Assignee: unassigned at gcc dot gnu.org
Reporter: tromey at gcc dot gnu.org
Target Milestone: ---
Consider this test case:
_Complex int x = 23i;
Compile with -g and examine the resulting DWARF:
<1><31>: Abbrev Number: 3 (DW_TAG_base_type)
<32> DW_AT_byte_size : 8
<33> DW_AT_encoding : 128 (HP_float80)
<34> DW_AT_name : (indirect string, offset: 0x0): complex int
I was surprised to see that "HP_float80" here, but it turns out
that this is just an artifact of dwarf.def claiming:
/* HP extensions. */
DW_ATE (DW_ATE_HP_float80, 0x80) /* Floating-point (80 bit). */
In reality what gcc is doing is just returning:
/* Dwarf2 doesn't know anything about complex ints, so use
a user defined type for it. */
case COMPLEX_TYPE:
if (TREE_CODE (TREE_TYPE (type)) == REAL_TYPE)
encoding = DW_ATE_complex_float;
else
encoding = DW_ATE_lo_user;
break;
There are a couple of ways this could be replaced. One would be to
give a complex base type its own DW_AT_type, holding the underlying
element type.
Another would be to pick a range, like 0xa0-0xaf, and emit
a value like 0xa0 | DW_ATE_signed.
I see in base_type_die that there are other cases that return
DW_ATE_lo_user. These are probably also bugs.
More information about the Gcc-bugs
mailing list