From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pj1-x1035.google.com (mail-pj1-x1035.google.com [IPv6:2607:f8b0:4864:20::1035]) by sourceware.org (Postfix) with ESMTPS id CA9D63858D32; Wed, 21 Jun 2023 16:12:38 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org CA9D63858D32 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pj1-x1035.google.com with SMTP id 98e67ed59e1d1-25ee8d84b4fso3285406a91.0; Wed, 21 Jun 2023 09:12:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1687363955; x=1689955955; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=a/FCkucUu6MSy84bkqwZObvm6zAFgtkv3M/kbnx9Vkk=; b=XTju2/6a62vVaL5Y+H/V0qOnuBfzalxV9DI+7KZhK+7W0BBGxNkGCfRhyPspbaToXw oe7v7Kth1XmPsqX3AnXvp0pSeBjfv78B0nLPZlYjC+ImlNmi0RMdjGV8CxtEwaMpscgm tqILcxfo0vjHFN+xiGbSsR0tL/6/gNqjf8qNR3ql8gKotHTiM2vg8W3TYO4zekarmibL eFa3HFonLi9UErSkfrz32Ohit+MI3/fH0oBTbA1wDSf/4AAPUbxVDqTbWX/m6PJcUn7M 0Ngc+6lkbclT3T65PARqc6HNQCA0wpf/rZwxrfxD7v+1DyLs7hldzVMF7IfVigcUpfTz pCnQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687363955; x=1689955955; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=a/FCkucUu6MSy84bkqwZObvm6zAFgtkv3M/kbnx9Vkk=; b=X5P/gXjOY2KI+3AwdJ5k0pq/RE4koa2L9qzz4tEJRw5NkxGYRpYqJ3eDuWXi9bCyNy ti9ePWPVs2CO6WO2aMwI7e8SwhJbvGcrZ0pWPB9AG48k38ArXbgbYGrTpiBiAO2AC3wZ IfJtw3bFh3O0IUa6JXRUXWnLEF0JFN9/KwxYeRPRii5QQ3OthT2xYYd7tImpAuntOicB m6xUCiaIrIIl2/wUqDFh/g3H6PvdmKvbj6TPuelr0TqbA7QGeaFSFH9VqnMpxEJveuml A+g5NEDwm8haO6nL0kJGJQcW0HkcY6PUcesgRcoTg29Ossvbla1nXhq0AqCb7ZQfUt4K 1YGQ== X-Gm-Message-State: AC+VfDyl4h3r3YxYVdmqk0Yr43uCaeBwB1jThYZr7wOMjiU7jkbtigpa BUcoTjFYIyuk0UM6rR2lEA1gKyaRy7H7lr13l4c= X-Google-Smtp-Source: ACHHUZ74Fw7ChvxmAh/2niMgdcCMjhHEUZz931zTe+8nwU14yyLRXsxBg6+xltyGwZUlWJTd5Uw10QrqCSzFAiGM2h0= X-Received: by 2002:a17:90a:8984:b0:25b:e766:6c40 with SMTP id v4-20020a17090a898400b0025be7666c40mr16518671pjn.20.1687363954982; Wed, 21 Jun 2023 09:12:34 -0700 (PDT) MIME-Version: 1.0 References: <358e8e69-8fc9-8d00-7fde-9aaa86371c87@gmx.de> In-Reply-To: From: Paul Richard Thomas Date: Wed, 21 Jun 2023 17:12:22 +0100 Message-ID: Subject: Re: [Patch, fortran] PR107900 Select type with intrinsic type inside associate causes ICE / Segmenation fault To: Harald Anlauf Cc: "fortran@gcc.gnu.org" , gcc-patches , Steve Kargl Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-1.5 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: 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. > -- "If you can't explain it simply, you don't understand it well enough" - Albert Einstein