I noticed that cooked_index_entry::full_name can return the canonical
string when there is no parent entry.
Regression tested on x86-64 Fedora 34.
 const char *
 cooked_index_entry::full_name (struct obstack *storage) const
 {
-  if ((flags & IS_LINKAGE) != 0)
+  if ((flags & IS_LINKAGE) != 0 || parent_entry == nullptr)
     return canonical;
 
   const char *sep = nullptr;
     case language_ada:
       sep = ".";
       break;
-    }
 
-  if (sep == nullptr)
-    return canonical;
+    default:
+      return canonical;
+    }
 
-  if (parent_entry != nullptr)
-    parent_entry->write_scope (storage, sep);
+  parent_entry->write_scope (storage, sep);
   obstack_grow0 (storage, canonical, strlen (canonical));
   return (const char *) obstack_finish (storage);
 }