From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ciao.gmane.io (ciao.gmane.io [116.202.254.214]) by sourceware.org (Postfix) with ESMTPS id 805183858C5E for ; Wed, 21 Jun 2023 18:40:11 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 805183858C5E Authentication-Results: sourceware.org; dmarc=fail (p=none dis=none) header.from=gmx.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=m.gmane-mx.org Received: from list by ciao.gmane.io with local (Exim 4.92) (envelope-from ) id 1qC2kU-0004DQ-Ha for gcc-patches@gcc.gnu.org; Wed, 21 Jun 2023 20:40:10 +0200 X-Injected-Via-Gmane: http://gmane.org/ To: gcc-patches@gcc.gnu.org From: Harald Anlauf Subject: Re: [Patch, fortran] PR107900 Select type with intrinsic type inside associate causes ICE / Segmenation fault Date: Wed, 21 Jun 2023 20:40:03 +0200 Message-ID: References: <358e8e69-8fc9-8d00-7fde-9aaa86371c87@gmx.de> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.11.0 Content-Language: en-US In-Reply-To: Cc: fortran@gcc.gnu.org X-Spam-Status: No, score=-3.0 required=5.0 tests=BAYES_00,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,KAM_DMARC_STATUS,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: Message-ID: <20230621184003.aIRoCpC4z5kre_0ptf2tmotVh1c9ox4wyyNP15sDra4@z> Hi Paul, while I only had a minor question regarding gfc_is_ptr_fcn(), can you still try to enlighten me why that second part was necessary? (I believed it to be redundant and may have overlooked the obvious.) Cheers, Harald On 6/21/23 18:12, Paul Richard Thomas via Gcc-patches wrote: > Committed as r14-2022-g577223aebc7acdd31e62b33c1682fe54a622ae27 > > Thanks for the help and the review Harald. Thanks to Steve too for > picking up Neil Carlson's bugs. > > Cheers > > Paul > > On Tue, 20 Jun 2023 at 22:57, Harald Anlauf wrote: >> >> Hi Paul, >> >> On 6/20/23 12:54, Paul Richard Thomas via Gcc-patches wrote: >>> Hi Harald, >>> >>> Fixing the original testcase in this PR turned out to be slightly more >>> involved than I expected. However, it resulted in an open door to fix >>> some other PRs and the attached much larger patch. >>> >>> This time, I did remember to include the testcases in the .diff :-) >> >> indeed! :-) >> >> I've only had a superficial look so far although it looks very good. >> (I have to trust your experience with unlimited polymorphism.) >> >> However, I was wondering about the following helper function: >> >> +bool >> +gfc_is_ptr_fcn (gfc_expr *e) >> +{ >> + return e != NULL && e->expr_type == EXPR_FUNCTION >> + && (gfc_expr_attr (e).pointer >> + || (e->ts.type == BT_CLASS >> + && CLASS_DATA (e)->attr.class_pointer)); >> +} >> + >> + >> /* Copy a shape array. */ >> >> Is there a case where gfc_expr_attr (e).pointer returns false >> and you really need the || part? Looking at gfc_expr_attr >> and the present context, it might just not be necessary. >> >>> I believe that, between the Change.Logs and the comments, it is >>> reasonably self-explanatory. >>> >>> OK for trunk? >> >> OK from my side. >> >> Thanks for the patch! >> >> Harald >> >>> Regards >>> >>> Paul >>> >>> Fortran: Fix some bugs in associate [PR87477] >>> >>> 2023-06-20 Paul Thomas >>> >>> gcc/fortran >>> PR fortran/87477 >>> PR fortran/88688 >>> PR fortran/94380 >>> PR fortran/107900 >>> PR fortran/110224 >>> * decl.cc (char_len_param_value): Fix memory leak. >>> (resolve_block_construct): Remove unnecessary static decls. >>> * expr.cc (gfc_is_ptr_fcn): New function. >>> (gfc_check_vardef_context): Use it to permit pointer function >>> result selectors to be used for associate names in variable >>> definition context. >>> * gfortran.h: Prototype for gfc_is_ptr_fcn. >>> * match.cc (build_associate_name): New function. >>> (gfc_match_select_type): Use the new function to replace inline >>> version and to build a new associate name for the case where >>> the supplied associate name is already used for that purpose. >>> * resolve.cc (resolve_assoc_var): Call gfc_is_ptr_fcn to allow >>> associate names with pointer function targets to be used in >>> variable definition context. >>> * trans-decl.cc (gfc_get_symbol_decl): Unlimited polymorphic >>> variables need deferred initialisation of the vptr. >>> (gfc_trans_deferred_vars): Do the vptr initialisation. >>> * trans-stmt.cc (trans_associate_var): Ensure that a pointer >>> associate name points to the target of the selector and not >>> the selector itself. >>> >>> gcc/testsuite/ >>> PR fortran/87477 >>> PR fortran/107900 >>> * gfortran.dg/pr107900.f90 : New test >>> >>> PR fortran/110224 >>> * gfortran.dg/pr110224.f90 : New test >>> >>> PR fortran/88688 >>> * gfortran.dg/pr88688.f90 : New test >>> >>> PR fortran/94380 >>> * gfortran.dg/pr94380.f90 : New test >>> >>> PR fortran/95398 >>> * gfortran.dg/pr95398.f90 : Set -std=f2008, bump the line >>> numbers in the error tests by two and change the text in two. >> > >