From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id eG4fE/QrD2O8WDAAWB0awg (envelope-from ) for ; Wed, 31 Aug 2022 05:37:56 -0400 Received: by simark.ca (Postfix, from userid 112) id 4C69F1E4A7; Wed, 31 Aug 2022 05:37:56 -0400 (EDT) Authentication-Results: simark.ca; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.a=rsa-sha256 header.s=default header.b=o6LsYWnm; dkim-atps=neutral X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RDNS_DYNAMIC,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from sourceware.org (ip-8-43-85-97.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id EE1861E222 for ; Wed, 31 Aug 2022 05:37:55 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 47BDD383CCFD for ; Wed, 31 Aug 2022 09:37:55 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 47BDD383CCFD DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1661938675; bh=Gx2kqZmNFN7EqcKhWAU1hK1O3+5J8UVVvFHA163Mt/U=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=o6LsYWnmepoRM57Wcx8JN/JfZToI+PfJlv91bMXr9/ZQiYAWb3rGLglDUzesaF1Ji mYYLuHy11pHiVnnH+g9gZBpF98FCRi3w454uM5EMqyZrLEwUSQwNHDPV0Wjjzbg9u2 IuVbUr2XZhh4ITM1bb1jXDky8NTcWVnIOf2FVwTw= Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by sourceware.org (Postfix) with ESMTPS id 95E3F383CCE3 for ; Wed, 31 Aug 2022 09:37:10 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 95E3F383CCE3 X-IronPort-AV: E=McAfee;i="6500,9779,10455"; a="321550816" X-IronPort-AV: E=Sophos;i="5.93,277,1654585200"; d="scan'208";a="321550816" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 31 Aug 2022 02:37:09 -0700 X-IronPort-AV: E=Sophos;i="5.93,277,1654585200"; d="scan'208";a="673281460" Received: from labpcdell3650-003.iul.intel.com (HELO localhost) ([172.28.49.87]) by fmsmga008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 31 Aug 2022 02:37:08 -0700 To: gdb-patches@sourceware.org Subject: [PATCH v2 1/4] testsuite, fortran: make mixed-lang-stack less compiler dependent Date: Wed, 31 Aug 2022 11:36:47 +0200 Message-Id: <20220831093650.674582-2-nils-christian.kempke@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220831093650.674582-1-nils-christian.kempke@intel.com> References: <20220831093650.674582-1-nils-christian.kempke@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Nils-Christian Kempke via Gdb-patches Reply-To: Nils-Christian Kempke Cc: tom@tromey.com Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb-patches" In the gdb.fortran/mixed-lang-stack.exp test when somewhere deep in a bunch of nested function calls we issue and test a 'info args' command for the mixed_func_1b function (when in that function's frame). The signature of the function looks like subroutine mixed_func_1b(a, b, c, d, e, g) use type_module implicit none integer :: a real(kind=4) :: b real(kind=8) :: c complex(kind=4) :: d character(len=*) :: e character(len=:), allocatable :: f TYPE(MyType) :: g and usually one would expect arguments a, b, c, d, e, and g to be emitted here. However, due to some compiler dependent treatment of the e array the actual output in the test (with gfortran/ifx) is (gdb) info args a = 1 b = 2 c = 3 d = (4,5) e = 'abcdef' g = ( a = 1.5, b = 2.5 ) _e = 6 where the compiler generated '_e' is emitted as the length of e. While ifort also generates an additional length argument, the naming (which is up to the compilers here I think, I could not find anything in the Fortran standard about this) is different and we see (gdb) info args a = 1 b = 2 c = 3 d = (4,5) e = 'abcdef' g = ( a = 1.5, b = 2.5 ) .tmp.E.len_V$4a = 6 To make both outputs pass the test, I kept the additional argument for now and made the regex for the emitted name of the last variable match any arbitrary name. --- gdb/testsuite/gdb.fortran/mixed-lang-stack.exp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/gdb/testsuite/gdb.fortran/mixed-lang-stack.exp b/gdb/testsuite/gdb.fortran/mixed-lang-stack.exp index 5bed3be8697..f8ff3bd5f5d 100644 --- a/gdb/testsuite/gdb.fortran/mixed-lang-stack.exp +++ b/gdb/testsuite/gdb.fortran/mixed-lang-stack.exp @@ -169,6 +169,13 @@ proc run_tests { lang } { set g_val_pattern "\\( a = 1.5, b = 2.5 \\)" } + # The last argument here in info args is compiler generated. It + # contains length of the passed array e (we are in mixed_func_1b here). + # For gfortran and ifx the compilers conveniently named this '_e', + # ifort however prints .tmp.E.len_V$4a. As is seems unreasonable to + # test for an artificially created name and as at the same time all + # 3 tested compilers emit this argument, we only check for its + # existence and its value (6). set args_pattern [multi_line \ "a = 1" \ "b = 2" \ @@ -176,7 +183,7 @@ proc run_tests { lang } { "d = ${d_pattern}" \ "e = ${e_pattern}" \ "g = ${g_val_pattern}" \ - "_e = 6" ] + ".* = 6" ] gdb_test "info args" $args_pattern \ "info args in frame #7" -- 2.25.1 Intel Deutschland GmbH Registered Address: Am Campeon 10, 85579 Neubiberg, Germany Tel: +49 89 99 8853-0, www.intel.de Managing Directors: Christin Eisenschmid, Sharon Heck, Tiffany Doon Silva Chairperson of the Supervisory Board: Nicole Lau Registered Office: Munich Commercial Register: Amtsgericht Muenchen HRB 186928