From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id E0DF83858430 for ; Thu, 14 Apr 2022 21:28:50 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org E0DF83858430 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-306-lFCTfiGGMui5FXLgrXZQoA-1; Thu, 14 Apr 2022 17:28:47 -0400 X-MC-Unique: lFCTfiGGMui5FXLgrXZQoA-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 3583D29AB44F; Thu, 14 Apr 2022 21:28:47 +0000 (UTC) Received: from f35-zws-1 (unknown [10.2.16.249]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 914821400B18; Thu, 14 Apr 2022 21:28:46 +0000 (UTC) Date: Thu, 14 Apr 2022 14:28:45 -0700 From: Kevin Buettner To: "Potharla, Rupesh" Cc: gdb-patches@sourceware.org, "George, Jini Susan" , "Parasuraman, Hariharan" , "Sharma, Alok Kumar" Subject: Re: GDB/Fortran: Support for Assumed Rank Zero. Message-ID: <20220414142845.281b878d@f35-zws-1> In-Reply-To: References: <20220413112753.4c6f1128@f35-zws-1> Organization: Red Hat MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.85 on 10.11.54.7 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-11.3 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H5, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) 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: Thu, 14 Apr 2022 21:28:53 -0000 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" 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= 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 . > > # 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