]> sourceware.org Git - libabigail.git/commitdiff
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 69329d1f1cb572b472ca16d159e192c484e1c799..a7e0d55ae5c2681c7fb7588e28bd7d00d7207905 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
This page took 0.041929 seconds and 5 git commands to generate.