https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93988

--- Comment #4 from Tom de Vries <vries at gcc dot gnu.org> ---
(In reply to Tom Tromey from comment #2)
> Also, I see the "__unknown__" there now -- better IMO to let gdb synthesize
> a name instead.

Attempt to synthesize the name in gcc:
...
commit d2b7f315ad976ff18c71eef88098dbf5ab5e6544
Author: Tom de Vries <tdevr...@suse.de>
Date:   Wed May 29 09:42:55 2024 +0200

    [debug] Emit name attribute for complex long and complex long long

    As noted in PR debug/93988, the types "complex long" and "complex long
long"
    have a name attribute with value "__unknown__".

    Fix this by using "complex long" and "complex long long" instead.

    Tested on x86_64.

diff --git a/gcc/dwarf2out.cc b/gcc/dwarf2out.cc
index 4e93262f75a..8ec3856873e 100644
--- a/gcc/dwarf2out.cc
+++ b/gcc/dwarf2out.cc
@@ -14076,6 +14076,19 @@ modified_type_die (tree type, int cv_quals, bool
reverse,
                    TYPE_PRECISION (type));
          add_name_attribute (mod_type_die, name_buf);
        }
+      else if (TREE_CODE (type) == COMPLEX_TYPE
+              && TYPE_NAME (TREE_TYPE (type)) != NULL_TREE)
+       {
+         const char complex_prefix[] = "complex ";
+         const char *part_name
+           = IDENTIFIER_POINTER (TYPE_IDENTIFIER (TREE_TYPE (type)));
+         size_t sizeof_name_buf
+           = sizeof (complex_prefix) + strlen (part_name);
+         char *name_buf = XNEWVEC (char, sizeof_name_buf);
+         snprintf (name_buf, sizeof_name_buf, "%s%s", complex_prefix,
part_name);
+         add_name_attribute (mod_type_die, name_buf);
+         XDELETEVEC (name_buf);
+       }
       else
        {
          /* This probably indicates a bug.  */
...

Reply via email to