https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93988
Tom de Vries <vries at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |vries at gcc dot gnu.org --- Comment #3 from Tom de Vries <vries at gcc dot gnu.org> --- Using this: ... commit cccb4b98b86e50d087ea9ec8eea95d2149eaa393 Author: Tom de Vries <tdevr...@suse.de> Date: Wed May 29 08:43:34 2024 +0200 [debug] Fix dwarf for complex int type The proposal https://dwarfstd.org/issues/210218.2.html was accepted into dwarf v6, and introduces 4 new base type encodings: - DW_ATE_complex_signed - DW_ATE_imaginary_signed - DW_ATE_complex_unsigned - DW_ATE_imaginary_unsigned Add these, and use DW_ATE_complex_signed/DW_ATE_complex_unsigned to emit debug info for complex int. PR debug/93988 diff --git a/gcc/dwarf2out.cc b/gcc/dwarf2out.cc index 5b064ffd78a..4e93262f75a 100644 --- a/gcc/dwarf2out.cc +++ b/gcc/dwarf2out.cc @@ -13331,6 +13331,15 @@ base_type_die (tree type, bool reverse) case COMPLEX_TYPE: if (SCALAR_FLOAT_TYPE_P (TREE_TYPE (type))) encoding = DW_ATE_complex_float; + else if (INTEGRAL_TYPE_P (TREE_TYPE (type))) + { + if (!(dwarf_version >= 6 || !dwarf_strict)) + encoding = DW_ATE_lo_user; + else if (TYPE_UNSIGNED (TREE_TYPE (type))) + encoding = DW_ATE_complex_unsigned; + else + encoding = DW_ATE_complex_signed; + } else encoding = DW_ATE_lo_user; break; diff --git a/include/dwarf2.def b/include/dwarf2.def index 66c7fa1220f..7ed43e5cb3c 100644 --- a/include/dwarf2.def +++ b/include/dwarf2.def @@ -728,6 +728,11 @@ DW_ATE (DW_ATE_UTF, 0x10) /* DWARF 5. */ DW_ATE (DW_ATE_UCS, 0x11) DW_ATE (DW_ATE_ASCII, 0x12) +/* DWARF 6. */ +DW_ATE (DW_ATE_complex_signed, 0x13) +DW_ATE (DW_ATE_imaginary_signed, 0x14) +DW_ATE (DW_ATE_complex_unsigned, 0x15) +DW_ATE (DW_ATE_imaginary_unsigned, 0x16) DW_ATE_DUP (DW_ATE_lo_user, 0x80) DW_ATE_DUP (DW_ATE_hi_user, 0xff) ... we get: ... <1><39>: Abbrev Number: 4 (DW_TAG_base_type) <3a> DW_AT_byte_size : 8 <3b> DW_AT_encoding : 19 (unknown type) <40> DW_AT_name : complex int ...