From: Dodji Seketeli Date: Mon, 18 Sep 2017 14:03:18 +0000 (+0200) Subject: Avoid adding the same data member twice in the DWARF reader X-Git-Tag: upstream/1.0~26 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=445567c42f03c7def1b81ea1bafd6ec3c7a52e0f;p=platform%2Fupstream%2Flibabigail.git Avoid adding the same data member twice in the DWARF reader When we face two equivalent highly recursive structs/classes, it can happen that a given data member be added twice to the type. When comparing two versions of a binary in which the data member happens to have been removed from the second version, we thus trigger an assert because a given data member has been "removed twice". This happens on the example provided in PR libabigail/17948 -- which is too big to be added to the test suite. This patch hopefully fixes the issue by looking harder at the data structure to make sure that we don't add the same data member twice. * src/abg-dwarf-reader.cc (add_or_update_class_type): After a we try to create a data member type, look *again* if the data member wasn't added recursively by the creation of the data member type. Signed-off-by: Dodji Seketeli --- diff --git a/src/abg-dwarf-reader.cc b/src/abg-dwarf-reader.cc index f7860061..602ac7e4 100644 --- a/src/abg-dwarf-reader.cc +++ b/src/abg-dwarf-reader.cc @@ -13041,6 +13041,13 @@ add_or_update_class_type(read_context& ctxt, if (!t) continue; + // The call to build_ir_node_from_die above could have + // triggered the adding of a data member named 'n' into + // result. So let's check again if the variable is + // already a member of this class. + if (lookup_var_decl_in_scope(n, result)) + continue; + if (!is_static) // We have a non-static data member. So this class // cannot be a declaration-only class anymore, even if