From patchwork Tue Jan 14 12:52:38 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tankut Baris Aktemur X-Patchwork-Id: 37368 Received: (qmail 125354 invoked by alias); 14 Jan 2020 12:52:55 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 125342 invoked by uid 89); 14 Jan 2020 12:52:54 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-23.1 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, SPF_PASS autolearn=ham version=3.3.1 spammy= X-HELO: mga06.intel.com Received: from mga06.intel.com (HELO mga06.intel.com) (134.134.136.31) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 14 Jan 2020 12:52:44 +0000 Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 14 Jan 2020 04:52:41 -0800 Received: from fmsmsx104.amr.corp.intel.com ([10.18.124.202]) by fmsmga004.fm.intel.com with ESMTP; 14 Jan 2020 04:52:41 -0800 Received: from fmsmsx151.amr.corp.intel.com (10.18.125.4) by fmsmsx104.amr.corp.intel.com (10.18.124.202) with Microsoft SMTP Server (TLS) id 14.3.439.0; Tue, 14 Jan 2020 04:52:41 -0800 Received: from FMSEDG002.ED.cps.intel.com (10.1.192.134) by FMSMSX151.amr.corp.intel.com (10.18.125.4) with Microsoft SMTP Server (TLS) id 14.3.439.0; Tue, 14 Jan 2020 04:52:41 -0800 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (104.47.55.172) by edgegateway.intel.com (192.55.55.69) with Microsoft SMTP Server (TLS) id 14.3.439.0; Tue, 14 Jan 2020 04:52:41 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=EMn9gYU6iW2+M5a1KHE7SezWAZexX8KcyejtrcSbk48nhZZ3Bu51MFEFSQwZokE3YRzzr4rgqDgQwmL1AegyatjNBz0pgYr86uh2oyj/2mvXOgvPndyu5O1/gySWWiSWTAavEoQCOFsRx0ny2xKP4HyZbd2BQ8i0GRJn6tU9cEcALOEYuzr4azjf5VpLtNl55V2b/8QRLZfhuNdrtJlWAYwqNtcxlW+k237W4UoNqeYw/IWJ30jpcLcHgNJmUgOSUSnlweAr7fEorEQDEOZBLbegAXSbubtOPccpEA4VJCvgnDBnEkz/faT9c63ijRKwPooR1us81fERT3NgpQGEPg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ymSWqYQNmak11MQuXzKX+/1ItD1St+3k1H9a2ehVgMI=; b=D8JnTvwIRJ+G/ThAFZpEF5460pr9UwE362JMsZHqxR3xKgYrAIAYpQj649wtyqrZv7yVi7r7DvPBb3SyA2NX06lxWGsxOQQTd4ytLcRXz6lAGMk4T1AJovPkEJhwd7hQhCD3P9Ptgo4esptrGxV1UFACBal3dGBv3NDuR69z8T5aZ0lBTUBlkt4RZn+KbQ+1A/GwQGEf6l//HcpwASEb20EWpswZhYg/jdsXdPr4OCqQltv5jB3Emf17uX7i0VTLwZSGHU2hBQb1sy3XbCn++jsmOGcEjSCwGkq1Z8uA4aSj1d3wxKEWbXJVUeTEp5IX9Zqa1GxS7/4u1uZ2PMi9jg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.onmicrosoft.com; s=selector2-intel-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ymSWqYQNmak11MQuXzKX+/1ItD1St+3k1H9a2ehVgMI=; b=zANOA4O2uiKHnvXvnYxTmG0ObrvCfaoWGDd4gAQuS3bobPX+iBEuuexVhc4s9f8sRbjWnbCV/o4YKp2faxd/iLF8NPXMVejzmF++XCUMkuCOtODB3URsjLOfJqPZXYQnPQ15hKbLQntlEUeUqBkoEg/ocVfv6Mrhw+fkH22eTz8= Received: from BYAPR11MB3030.namprd11.prod.outlook.com (20.177.225.91) by BYAPR11MB3797.namprd11.prod.outlook.com (20.178.239.27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2623.9; Tue, 14 Jan 2020 12:52:38 +0000 Received: from BYAPR11MB3030.namprd11.prod.outlook.com ([fe80::2c94:a4bd:2d9c:30b]) by BYAPR11MB3030.namprd11.prod.outlook.com ([fe80::2c94:a4bd:2d9c:30b%6]) with mapi id 15.20.2623.015; Tue, 14 Jan 2020 12:52:38 +0000 From: "Aktemur, Tankut Baris" To: Luis Machado , "tromey@sourceware.org" , "gdb-patches@sourceware.org" Subject: RE: [review v3] testsuite, cp: increase the coverage of testing pass-by-ref arguments Date: Tue, 14 Jan 2020 12:52:38 +0000 Message-ID: References: <20191214095325.3864520AF6@gnutoolchain-gerrit.osci.io> <80c8502f-a350-6a2b-0b72-bbc903f53bc3@linaro.org> In-Reply-To: authentication-results: spf=none (sender IP is ) smtp.mailfrom=tankut.baris.aktemur@intel.com; x-ms-oob-tlc-oobclassifiers: OLM:9508; x-ms-exchange-senderadcheck: 1 x-ms-exchange-transport-forked: True MIME-Version: 1.0 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: oFeOgzknkSc0YlYUcevsij1QndHC0m5AG2KsrbU8pY30RH9jWV0gPoIMZ0PxsSMSCVF5wTq6NRLd+GwNBZ8n6gMdk7YcVM0JW7rXP9Xj5rc= Return-Path: tankut.baris.aktemur@intel.com X-IsSubscribed: yes On Monday, January 13, 2020 9:21 PM, Aktemur, Tankut Baris wrote: > > On Monday, January 13, 2020 8:38 PM, Luis Machado wrote: > > > > On 1/13/20 4:35 PM, Aktemur, Tankut Baris wrote: > > > On Monday, January 13, 2020 7:21 PM, Luis Machado wrote: > > >> > > >> Hi, > > >> > > >> I noticed these new tests fail (in large numbers) for GCC 5.4.x. Is it > > >> expected? If so, it may be worth making this test conditional on newer > > >> GCC versions. > > >> > > > > > > Yes, this is expected. Older GCC versions did not emit certain DWARF attributes > > > (DW_AT_deleted, DW_AT_defaulted). This prevents GDB from making the right > > > pass-by-reference decision. I'll submit a patch for this. > > > > Thanks for clarifying this. > > > > I can submit that patch if you like. I have a box running an older GCC, > > so i noticed that and thought i'd check. > > > > Luis > > Yes, sure. > > Thank you. > > -Baris I've investigated GCC and Clang for this. GCC started emitting DW_AT_deleted and DW_AT_defaulted with version 7. Clang does not emit these attributes; however, it has been emitting DW_AT_calling_convention starting with version 7. This attribute helps the debugger make the right decision in some cases. Based on this, I think the test cases have to be filtered in a somewhat fine-granular manner. Therefore I thought I could save you from the burden of having to go through the code-generating test definition. Below is a patch proposal. -Baris From 86017121c8f1c7d0f0020c7a8da22dba64dad3fd Mon Sep 17 00:00:00 2001 From: Tankut Baris Aktemur Date: Tue, 14 Jan 2020 13:36:09 +0100 Subject: [PATCH] testsuite, cp: add pass-by-ref test expected failures for certain compilers There exist expected failures in the pass-by-ref.exp and pass-by-ref-2.exp tests based on the GCC and Clang version. * GCC version <= 6 and Clang do not emit DW_AT_deleted and DW_AT_defaulted. * Clang version >= 7 emits DW_AT_calling_convention, which helps the debugger make the right calling convention decision in some cases despite lacking the 'defaulted' and 'deleted' attributes. Mark the related tests as XFAIL based on the compiler version. Tested on X86_64 using GCC 5.5.0, 6.5.0, 7.4.0, 8.3.0, 9.2.1; and Clang 5.0.1, 6.0.0, 7.0.0, 8.0.0, 9.0.1, 10.0.0. gdb/testsuite/ChangeLog: 2020-01-14 Tankut Baris Aktemur * gdb.cp/pass-by-ref.exp: Mark some tests as XFAIL based on the GCC/Clang version. * gdb.cp/pass-by-ref-2.exp: Ditto. Change-Id: I1d8440aa438049f7c4da7f4f76f201c48550f1e4 --- gdb/testsuite/gdb.cp/pass-by-ref-2.exp | 6 ++++++ gdb/testsuite/gdb.cp/pass-by-ref.exp | 26 ++++++++++++++++++++++++++ 2 files changed, 32 insertions(+) -- 2.17.1 Intel Deutschland GmbH Registered Address: Am Campeon 10-12, 85579 Neubiberg, Germany Tel: +49 89 99 8853-0, www.intel.de Managing Directors: Christin Eisenschmid, Gary Kershaw Chairperson of the Supervisory Board: Nicole Lau Registered Office: Munich Commercial Register: Amtsgericht Muenchen HRB 186928 diff --git a/gdb/testsuite/gdb.cp/pass-by-ref-2.exp b/gdb/testsuite/gdb.cp/pass-by-ref-2.exp index a83ce8d5d7d..e7b04771eb2 100644 --- a/gdb/testsuite/gdb.cp/pass-by-ref-2.exp +++ b/gdb/testsuite/gdb.cp/pass-by-ref-2.exp @@ -42,6 +42,10 @@ if {![runto_main]} { return -1 } +# GCC version <= 6 and Clang do not emit DW_AT_defaulted and DW_AT_deleted +set is_gcc_6_or_older [test_compiler_info {gcc-[0-6]-*}] +set is_clang [test_compiler_info {clang-*}] + set bp_location [gdb_get_line_number "stop here"] gdb_breakpoint $bp_location gdb_continue_to_breakpoint "end of main" ".*return .*;" @@ -65,6 +69,7 @@ set sig "\"Inlined\:\:Inlined\\(.*Inlined const\&\\)\"" gdb_test "print cbvInlined (inlined)" \ "expression cannot be evaluated .* \\(maybe inlined\\?\\)" +if {$is_gcc_6_or_older || $is_clang} {setup_xfail "*-*-*"} gdb_test "print cbvDtorDel (*dtorDel)" \ ".* cannot be evaluated .* 'DtorDel' is not destructible" \ "type not destructible" @@ -94,6 +99,7 @@ gdb_test "print cbvTwoMCtor (twoMctor)" \ ".* cannot be evaluated .* 'TwoMCtor' is not copy constructible" \ "copy ctor is implicitly deleted" +if {$is_gcc_6_or_older || $is_clang} {setup_xfail "*-*-*"} gdb_test "print cbvTwoMCtorAndCCtor (twoMctorAndCctor)" "12" \ "call cbvTwoMCtorAndCCtor" gdb_test "print twoMctorAndCctor.x" "2" \ diff --git a/gdb/testsuite/gdb.cp/pass-by-ref.exp b/gdb/testsuite/gdb.cp/pass-by-ref.exp index f500710fd43..aff9f9a3c1e 100644 --- a/gdb/testsuite/gdb.cp/pass-by-ref.exp +++ b/gdb/testsuite/gdb.cp/pass-by-ref.exp @@ -369,6 +369,12 @@ proc test_for_class { prefix states cbvfun data_field length} { global ADDED global TRACE + # GCC version <= 6 and Clang do not emit DW_AT_defaulted and DW_AT_deleted + set is_gcc_6_or_older [test_compiler_info {gcc-[0-6]-*}] + set is_clang [test_compiler_info {clang-*}] + # But Clang version >= 7 emits DW_AT_calling_convention for types + set is_clang_6_or_older [test_compiler_info {clang-[0-6]-*}] + with_test_prefix $name { if {[is_copy_constructible $states]} { set expected [expr {$ORIGINAL + $ADDED}] @@ -378,6 +384,19 @@ proc test_for_class { prefix states cbvfun data_field length} { if {$dtor == "explicit"} { gdb_test "print tracer = 0" " = 0" "reset the tracer" } + + if {$cctor == "defaultedIn" || $dtor == "defaultedIn"} { + if {$is_gcc_6_or_older || $is_clang_6_or_older} { + setup_xfail "*-*-*" + } elseif {$is_clang} { + # If this is a pass-by-value case, Clang >= 7's + # DW_AT_calling_convention leads to the right decision. + # Otherwise, it is expected to fail. + if {"defaultedOut" in $states || "explicit" in $states} { + setup_xfail "*-*-*" + } + } + } gdb_test "print ${cbvfun}<$name> (${name}_var)" " = $expected" \ "call '$cbvfun'" gdb_test "print ${name}_var.${data_field}\[0\]" " = $ORIGINAL" \ @@ -389,10 +408,17 @@ proc test_for_class { prefix states cbvfun data_field length} { "cbv argument should not change (item $last_index)" } if {$dtor == "explicit"} { + if {$cctor == "defaultedIn" + && ($is_gcc_6_or_older || $is_clang)} { + setup_xfail "*-*-*" + } gdb_test "print tracer" " = $TRACE" \ "destructor should be called" } } else { + if {$cctor == "deleted" && ($is_gcc_6_or_older || $is_clang)} { + setup_xfail "*-*-*" + } gdb_test "print ${cbvfun}<$name> (${name}_var)" \ ".* cannot be evaluated .* '${name}' is not copy constructible" \ "calling '$cbvfun' should be refused"