From f15b1ea634b3b5533bf65fa3b66f60189ac7b572 Mon Sep 17 00:00:00 2001 From: Dodji Seketeli Date: Wed, 15 May 2019 12:46:56 +0200 Subject: [PATCH] Bug 24560 - Assertion failure on an abixml with an anonymous type 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 --- src/abg-reader.cc | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/abg-reader.cc b/src/abg-reader.cc index 69329d1f..a7e0d55a 100644 --- a/src/abg-reader.cc +++ b/src/abg-reader.cc @@ -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 *types_ptr = ctxt.get_all_type_decls(id); + const vector *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 *types_ptr = ctxt.get_all_type_decls(id); + const vector *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 -- 2.43.5