public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Andrew Burgess <andrew.burgess@embecosm.com>
To: Tom de Vries <tdevries@suse.de>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH] gdb/fortran: Handle dynamic string types when printing types
Date: Wed, 15 Jul 2020 16:11:58 +0100	[thread overview]
Message-ID: <20200715151158.GF2737@embecosm.com> (raw)
In-Reply-To: <5835b135-0c83-e273-6693-b0c97a7bee35@suse.de>

* Tom de Vries <tdevries@suse.de> [2020-07-15 15:03:29 +0200]:

> On 7/14/20 12:03 PM, Andrew Burgess wrote:
> > +gdb_test "ptype say_string" \
> > +    "type = void \\(character\\*\\(\\*\\), integer\\(kind=8\\)\\)"
> 
> With gcc 7.5.0, I run into:
> ...
> (gdb) ptype say_string^M
> type = void (character*(*), integer(kind=4))^M
> (gdb) FAIL: gdb.fortran/ptype-on-functions.exp: ptype say_string
> ...
> but it passes for me with gcc 8.4.0.
> 
> This looks related to this ( https://gcc.gnu.org/gcc-8/changes.html ):
> ...
> Character variables longer than HUGE(0) elements are now possible on
> 64-bit targets. Note that this changes the procedure call ABI for all
> procedures with character arguments on 64-bit targets, as the type of
> the hidden character length argument has changed. The hidden character
> length argument is now of type INTEGER(C_SIZE_T).
> ...

Thanks for bringing this to my attention.  I've committed the patch
below to resolve this failure.

Thanks,
Andrew

---

From 7d44f7715f23f73243f686a37c123a9c039faf78 Mon Sep 17 00:00:00 2001
From: Andrew Burgess <andrew.burgess@embecosm.com>
Date: Wed, 15 Jul 2020 16:05:24 +0100
Subject: [PATCH] gdb/testsuite: Update test pattern in ptype-on-functions.exp

It was pointed out that the recently added test
gdb.fortran/ptype-on-functions.exp fails on older versions of
gfortran.  This is because the ABI for passing string lengths changed
from a 4-byte to 8-byte value (on some targets).

This change is documented here:
  https://gcc.gnu.org/gcc-8/changes.html.

  Character variables longer than HUGE(0) elements are now possible on
  64-bit targets. Note that this changes the procedure call ABI for
  all procedures with character arguments on 64-bit targets, as the
  type of the hidden character length argument has changed. The hidden
  character length argument is now of type INTEGER(C_SIZE_T).

This commit just relaxes the pattern to accept any size of integer for
the string length argument.

gdb/testsuite/ChangeLog:

	* gdb.fortran/ptype-on-functions.exp: Make the result pattern more
	generic.
---
 gdb/testsuite/ChangeLog                          | 5 +++++
 gdb/testsuite/gdb.fortran/ptype-on-functions.exp | 2 +-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/gdb/testsuite/gdb.fortran/ptype-on-functions.exp b/gdb/testsuite/gdb.fortran/ptype-on-functions.exp
index dde6f48b853..9d447530c26 100644
--- a/gdb/testsuite/gdb.fortran/ptype-on-functions.exp
+++ b/gdb/testsuite/gdb.fortran/ptype-on-functions.exp
@@ -45,7 +45,7 @@ gdb_test "ptype fun_ptr" \
     "type = PTR TO -> \\( integer\\(kind=4\\) \\(\\) \\(REF TO -> \\( integer\\(kind=4\\) \\)\\) \\)"
 
 gdb_test "ptype say_string" \
-    "type = void \\(character\\*\\(\\*\\), integer\\(kind=8\\)\\)"
+    "type = void \\(character\\*\\(\\*\\), integer\\(kind=\\d+\\)\\)"
 
 gdb_test "ptype say_array" \
     "type = void \\(integer\\(kind=4\\) \\(:,:\\)\\)"
-- 
2.25.4


      reply	other threads:[~2020-07-15 15:12 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-14 10:03 Andrew Burgess
2020-07-15  2:10 ` Simon Marchi
2020-07-15  7:52   ` Andrew Burgess
2020-07-15 13:03 ` Tom de Vries
2020-07-15 15:11   ` Andrew Burgess [this message]

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=20200715151158.GF2737@embecosm.com \
    --to=andrew.burgess@embecosm.com \
    --cc=gdb-patches@sourceware.org \
    --cc=tdevries@suse.de \
    /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).