From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 From: Nils-Christian Kempke To: gdb-patches@sourceware.org Cc: tom@tromey.com, Nils-Christian Kempke 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-Spam-Status: No, score=-10.3 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org 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: , X-List-Received-Date: Wed, 31 Aug 2022 09:37:12 -0000 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