From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by sourceware.org (Postfix) with ESMTPS id 31F2F3854830 for ; Tue, 16 Feb 2021 11:11:25 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 31F2F3854830 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=suse.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=tdevries@suse.de X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 4E527AFFA; Tue, 16 Feb 2021 11:11:24 +0000 (UTC) Date: Tue, 16 Feb 2021 12:11:22 +0100 From: Tom de Vries To: dwz@sourceware.org, jakub@redhat.com, mark@klomp.org Subject: [committed][testsuite] Fix odr tests with clang Message-ID: <20210216111120.GA19100@delia> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.10.1 (2018-07-13) X-Spam-Status: No, score=-12.3 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: dwz@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Dwz mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Feb 2021 11:11:27 -0000 Hi, When running the testsuite with clang, I run into: ... $ make check CC=clang CXX=clang++ ... FAIL: testsuite/dwz.tests/odr-def-decl.sh FAIL: testsuite/dwz.tests/odr-loc.sh FAIL: testsuite/dwz.tests/odr-struct-ns.sh FAIL: testsuite/dwz.tests/odr-struct.sh ... The problem is that clang emits less DIEs. For this bit from odr-loc.cc: ... struct bbb; struct ccc { int member_three; }; struct aaa { struct bbb *member_one; struct ccc *member_two; }; struct aaa var1; ... it ignores the definition of struct ccc, and therefore only has a DW_AT_declaration DIE for ccc. Fix this by adding variables for the type definitions that are ignored by clang. Committed to trunk. Thanks, - Tom [testsuite] Fix odr tests with clang 2021-02-16 Tom de Vries * testsuite/dwz.tests/def2.c (foo): New function. Allocate ao_ref. * testsuite/dwz.tests/odr-def-decl.sh: Update expected counts. * testsuite/dwz.tests/odr-2.cc: Add var. * testsuite/dwz.tests/odr-loc-2.cc: Same. * testsuite/dwz.tests/odr-loc.cc: Same. * testsuite/dwz.tests/odr.cc: Same. --- testsuite/dwz.tests/def2.c | 6 ++++++ testsuite/dwz.tests/odr-2.cc | 2 ++ testsuite/dwz.tests/odr-def-decl.sh | 4 ++-- testsuite/dwz.tests/odr-loc-2.cc | 1 + testsuite/dwz.tests/odr-loc.cc | 1 + testsuite/dwz.tests/odr.cc | 2 ++ 6 files changed, 14 insertions(+), 2 deletions(-) diff --git a/testsuite/dwz.tests/def2.c b/testsuite/dwz.tests/def2.c index c1eacf3..794933f 100644 --- a/testsuite/dwz.tests/def2.c +++ b/testsuite/dwz.tests/def2.c @@ -1,3 +1,9 @@ #include "def.h" ao_ref *p2; + +void +foo (void) +{ + p2 = new ao_ref; +} diff --git a/testsuite/dwz.tests/odr-2.cc b/testsuite/dwz.tests/odr-2.cc index fd033da..8b3dcd2 100644 --- a/testsuite/dwz.tests/odr-2.cc +++ b/testsuite/dwz.tests/odr-2.cc @@ -13,6 +13,8 @@ namespace ns { #if NAMESPACE KIND ns::aaa var2; +KIND ns::bbb var4; #else KIND aaa var2; +KIND bbb var4; #endif diff --git a/testsuite/dwz.tests/odr-def-decl.sh b/testsuite/dwz.tests/odr-def-decl.sh index 943f05e..8905e52 100644 --- a/testsuite/dwz.tests/odr-def-decl.sh +++ b/testsuite/dwz.tests/odr-def-decl.sh @@ -7,13 +7,13 @@ cp $execs/def-decl 1 verify-dwarf.sh 1 cnt=$(readelf -wi 1 | grep -c "DW_AT_name.*:.*ao_ref" || true) -[ $cnt -eq 4 ] +[ $cnt -eq 5 ] $execs/dwz-for-test --odr 1 --devel-ignore-size verify-dwarf.sh 1 cnt=$(readelf -wi 1 | grep -c "DW_AT_name.*:.*ao_ref" || true) -[ $cnt -eq 3 ] +[ $cnt -eq 2 ] rm -f 1 diff --git a/testsuite/dwz.tests/odr-loc-2.cc b/testsuite/dwz.tests/odr-loc-2.cc index 39ef5cf..7cf832b 100644 --- a/testsuite/dwz.tests/odr-loc-2.cc +++ b/testsuite/dwz.tests/odr-loc-2.cc @@ -11,3 +11,4 @@ struct aaa }; struct aaa var2; +struct bbb var4; diff --git a/testsuite/dwz.tests/odr-loc.cc b/testsuite/dwz.tests/odr-loc.cc index 10efd75..953fd66 100644 --- a/testsuite/dwz.tests/odr-loc.cc +++ b/testsuite/dwz.tests/odr-loc.cc @@ -10,6 +10,7 @@ struct aaa }; struct aaa var1; +struct ccc var3; int main (void) diff --git a/testsuite/dwz.tests/odr.cc b/testsuite/dwz.tests/odr.cc index 3f9255b..9505cb3 100644 --- a/testsuite/dwz.tests/odr.cc +++ b/testsuite/dwz.tests/odr.cc @@ -13,8 +13,10 @@ namespace ns { #if NAMESPACE KIND ns::aaa var1; +KIND ns::ccc var3; #else KIND aaa var1; +KIND ccc var3; #endif int