public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Nils-Christian Kempke <nils-christian.kempke@intel.com>
To: gdb-patches@sourceware.org
Cc: tom@tromey.com, Nils-Christian Kempke <nils-christian.kempke@intel.com>
Subject: [PATCH v2 1/4] testsuite, fortran: make mixed-lang-stack less compiler dependent
Date: Wed, 31 Aug 2022 11:36:47 +0200	[thread overview]
Message-ID: <20220831093650.674582-2-nils-christian.kempke@intel.com> (raw)
In-Reply-To: <20220831093650.674582-1-nils-christian.kempke@intel.com>

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 <http://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


  reply	other threads:[~2022-08-31  9:37 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-31  9:36 [PATCH v2 0/4] Adapt Fortran testsuite for ifort Nils-Christian Kempke
2022-08-31  9:36 ` Nils-Christian Kempke [this message]
2022-08-31  9:36 ` [PATCH v2 2/4] testsuite, fortran: Remove self assignment non-statements Nils-Christian Kempke
2022-08-31  9:36 ` [PATCH v2 3/4] testsuite, fortran: adapt tests for ifort's 'start' behavior Nils-Christian Kempke
2022-08-31  9:36 ` [PATCH v2 4/4] testsuite, fortran: make kfail gfortran specific Nils-Christian Kempke
2022-09-19 10:18 ` [PING][PATCH v2 0/4] Adapt Fortran testsuite for ifort Kempke, Nils-Christian
2022-09-19 10:18   ` Kempke, Nils-Christian
2022-09-26 14:02   ` [PING 2][PATCH " Kempke, Nils-Christian
2022-09-26 14:02     ` Kempke, Nils-Christian
2022-10-05 20:23     ` [PING 3][PATCH " Kempke, Nils-Christian
2022-10-05 20:23       ` Kempke, Nils-Christian
2022-10-13  8:52       ` [PING 4][PATCH " Kempke, Nils-Christian
2022-10-13  8:52         ` Kempke, Nils-Christian
2022-10-21  8:15         ` [PING 5][PATCH " Kempke, Nils-Christian
2022-10-21  8:15           ` Kempke, Nils-Christian

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220831093650.674582-2-nils-christian.kempke@intel.com \
    --to=nils-christian.kempke@intel.com \
    --cc=gdb-patches@sourceware.org \
    --cc=tom@tromey.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).