public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Kevin Buettner <kevinb@redhat.com>
To: "Potharla, Rupesh" <Rupesh.Potharla@amd.com>
Cc: gdb-patches@sourceware.org, "George,
	Jini Susan" <JiniSusan.George@amd.com>,
	"Parasuraman, Hariharan" <Hariharan.Parasuraman@amd.com>,
	"Sharma, Alok Kumar" <AlokKumar.Sharma@amd.com>
Subject: Re: GDB/Fortran: Support for Assumed Rank Zero.
Date: Thu, 14 Apr 2022 14:28:45 -0700	[thread overview]
Message-ID: <20220414142845.281b878d@f35-zws-1> (raw)
In-Reply-To: <DM6PR12MB421940A0CA50A17DAEA19909E7EF9@DM6PR12MB4219.namprd12.prod.outlook.com>

Hi Rupesh,

After reading the comments more closely, I found a few more nits;
see below.  I apologize for missing these on the first pass.

I also have a question about how you're testing with clang / flang.

Kevin

On Thu, 14 Apr 2022 10:30:38 +0000
"Potharla, Rupesh" <Rupesh.Potharla@amd.com> wrote:

> If a variable is passed to function in FORTRAN as an argument the
> variable is treated as an array with rank zero. GDB currently does
> not support the case for assumed rank 0. This patch provides support
> for assumed rank 0 and updates the testcase as well.

Please put two spaces after the period in each sentence.  See:

https://www.gnu.org/prep/standards/standards.html#Comments

> Without patch:
> Breakpoint 1, arank::sub1 (a=<error reading variable:
>   failed to resolve dynamic array rank>) at assumedrank.f90:11
> 11       PRINT *, RANK(a)
> (gdb) p a
> failed to resolve dynamic array rank
> (gdb) p rank(a)
> failed to resolve dynamic array rank
> 
> With patch:
> Breakpoint 1, arank::sub1 (a=0) at assumedrank.f90:11
> 11       PRINT *, RANK(a)
> (gdb) p a
> $1 = 0
> (gdb) p rank(a)
> $2 = 0
> ---
>  gdb/gdbtypes.c                            | 11 +++++++----
>  gdb/gdbtypes.h                            |  1 -
>  gdb/testsuite/gdb.fortran/assumedrank.exp |  7 +++++++
>  gdb/testsuite/gdb.fortran/assumedrank.f90 |  3 +++
>  4 files changed, 17 insertions(+), 5 deletions(-)
> 
> diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c
> index 49ecb199b07..21db5aafc88 100644
> --- a/gdb/gdbtypes.c
> +++ b/gdb/gdbtypes.c
> @@ -2398,10 +2398,13 @@ resolve_dynamic_array_or_string (struct type *type,
>  
>        if (rank == 0)
>  	{
> -	  /* The dynamic property list juggling below was from the original
> -	     patch.  I don't understand what this is all about, so I've
> -	     commented it out for now and added the following error.  */
> -	  error (_("failed to resolve dynamic array rank"));
> +	  /* Rank is zero, if a variable is passed as an argument to a
> +	     function. GDB considers the variable as an array so discard
> +	     the array type and return the target type which is of variable. */

Two spaces after after each period (end of sentence) in above comment, too.

> +          type->main_type->target_type->main_type->dyn_prop_list =
> +                                  type->main_type->dyn_prop_list;
> +          type = TYPE_TARGET_TYPE (type);
> +          return type;
>  	}
>        else if (type->code () == TYPE_CODE_STRING && rank != 1)
>  	{
[...]
> diff --git a/gdb/testsuite/gdb.fortran/assumedrank.exp b/gdb/testsuite/gdb.fortran/assumedrank.exp
> index 69cd168125f..49b03e2f87f 100644
> --- a/gdb/testsuite/gdb.fortran/assumedrank.exp
> +++ b/gdb/testsuite/gdb.fortran/assumedrank.exp
> @@ -14,6 +14,7 @@
>  # along with this program.  If not, see <http://www.gnu.org/licenses/> .
>  
>  # Testing GDB's implementation of ASSUMED RANK arrays.
> +#Until the assumed rank zero is fixed in clang, XFAIL this case for clang.

Given that you've already put a comment about this below, I think the
above comment could be deleted.  However, if you prefer to retain it,
then insert a space after the '#'.

>  if {[skip_fortran_tests]} { return -1 }
>  
> @@ -58,6 +59,12 @@ while { $test_count < 500 } {
>  	    }
>  	}
>  
> +	# xfail rank 0 for clang
> +	if {$test_count == 1 && [test_compiler_info {clang-*}]} {
> +	   xfail "clang compiler does not support rank0"
> +           continue
> +	}
> +
>  	if ($found_final_breakpoint) {
>  	    break
>  	}

I'm not convinced that this is the best way to xfail the rank 0 test.
However, after I applied only your testsuite changes, I couldn't figure
out how to test with flang instead of gfortran.  Can you tell me how
this is done?

Kevin


  reply	other threads:[~2022-04-14 21:28 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-13  9:55 Potharla, Rupesh
2022-04-13 18:27 ` Kevin Buettner
2022-04-14 10:30   ` Potharla, Rupesh
2022-04-14 21:28     ` Kevin Buettner [this message]
2022-04-15 13:33       ` Potharla, Rupesh
2022-04-15 19:31         ` Kevin Buettner
2022-04-16 18:29           ` Potharla, Rupesh
2022-04-18 13:31             ` Tom Tromey
2022-04-18 15:25               ` Potharla, Rupesh
2022-04-20 15:22                 ` Andrew Burgess
2022-04-20 19:08                   ` Potharla, Rupesh
2022-04-22 14:38                     ` Andrew Burgess
2022-04-25  6:33                       ` Potharla, Rupesh
2022-04-25  8:47                         ` Andrew Burgess
2022-04-18 15:33             ` Kevin Buettner
2022-04-19 17:30               ` Kevin Buettner
2022-04-20  0:29                 ` Potharla, Rupesh
2022-04-20  6:32                   ` Kempke, Nils-Christian
2022-04-20 15:38                     ` Kevin Buettner
2022-04-20 15:29                   ` Andrew Burgess
2022-04-20 19:20                     ` Potharla, Rupesh

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=20220414142845.281b878d@f35-zws-1 \
    --to=kevinb@redhat.com \
    --cc=AlokKumar.Sharma@amd.com \
    --cc=Hariharan.Parasuraman@amd.com \
    --cc=JiniSusan.George@amd.com \
    --cc=Rupesh.Potharla@amd.com \
    --cc=gdb-patches@sourceware.org \
    /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).