Bug 24560 - Assertion failure on an abixml with an anonymous type
authorDodji Seketeli <dodji@redhat.com>
Wed, 15 May 2019 10:46:56 +0000 (12:46 +0200)
committerDodji Seketeli <dodji@redhat.com>
Wed, 15 May 2019 10:46:56 +0000 (12:46 +0200)
When reading an abixml file, we should not try to re-use an anonymous
class, union or enum because by construction two anonymous unions of
the same (internal) name don't necessarily designate the same type.
We already do that in the ELF/DWARF reader so we need to update the
abixml reader too.

Fixed thus.

* src/abg-reader.cc (read_context::maybe_canonicalize_type): Delay
canonicalization of union types too.
(build_class_decl, build_union_decl): Do not try to re-use
anonymous types.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
src/abg-reader.cc

index 69329d1..a7e0d55 100644 (file)
@@ -843,6 +843,7 @@ public:
     if (!force_delay
        && !type_has_non_canonicalized_subtype(t)
        && !is_class_type(t)
+       && !is_union_type(t)
        && !is_wip_type(t)
        // Below are types that *must* be canonicalized only after
        // they are added to their context; but then this function
@@ -4200,7 +4201,9 @@ build_class_decl(read_context&            ctxt,
 
   ABG_ASSERT(!id.empty());
   class_decl_sptr previous_definition, previous_declaration;
-  const vector<type_base_sptr> *types_ptr = ctxt.get_all_type_decls(id);
+  const vector<type_base_sptr> *types_ptr = 0;
+  if (!is_anonymous)
+    types_ptr = ctxt.get_all_type_decls(id);
   if (types_ptr)
     {
       // Lets look at the previous declarations and the first previous
@@ -4602,7 +4605,9 @@ build_union_decl(read_context& ctxt,
 
   ABG_ASSERT(!id.empty());
   union_decl_sptr previous_definition, previous_declaration;
-  const vector<type_base_sptr> *types_ptr = ctxt.get_all_type_decls(id);
+  const vector<type_base_sptr> *types_ptr = 0;
+  if (!is_anonymous)
+    types_ptr = ctxt.get_all_type_decls(id);
   if (types_ptr)
     {
       // Lets look at the previous declarations and the first previous