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 B132938618F7 for ; Sun, 29 Oct 2023 19:15:29 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org B132938618F7 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 ARC-Filter: OpenARC Filter v1.0.0 sourceware.org B132938618F7 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=116.202.254.214 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1698606931; cv=none; b=nLUP0WEsE68qfJ8KkAvvW34RNB7Nq/q3UCayITTYlZimXBIx3WNTqZXC1WmPUSov3XLQeGcqWX2XqOxNl9rT2jZXTWrf0gVuAKIzUeWG5u7v3UTz6uOGf/QStMUFGF/SaUbr31nCfyVPMro1ThK/blnfF1Kk5mx0GtFhU1LcEe4= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1698606931; c=relaxed/simple; bh=zviLVff2UFkf8vgJyI8FcOs5M3kxQ/g91h8PUNDg/vQ=; h=To:From:Subject:Date:Message-ID:Mime-Version; b=Qdy1VSnIZf520HhQbZLTOJqrsYNE1bU7IFACyFUdIUgdtt0x8D0Pf0OKGvjbxQjVuMCBZoy6AiX+CRsmmZU4Zlxi+iCfmTApxPZDbX/tdlhju3tGxhmerx024ACwlpy7lQSIiqBHh3PcYPq1RB3G8Otur3DV5JhI5GWRAC8OsDA= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from list by ciao.gmane.io with local (Exim 4.92) (envelope-from ) id 1qxBFw-0007FV-Ie for gcc-patches@gcc.gnu.org; Sun, 29 Oct 2023 20:15:28 +0100 X-Injected-Via-Gmane: http://gmane.org/ To: gcc-patches@gcc.gnu.org From: Harald Anlauf Subject: Re: [Patch, fortran] PR104555 - ICE in gfc_compare_derived_types, at fortran/interface.cc:628 since r10-2912-g70570ec192745095 Date: Sun, 29 Oct 2023 20:15:21 +0100 Message-ID: <0de61835-de8e-4956-aae2-bd831c30e52a@gmx.de> References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit User-Agent: Mozilla Thunderbird Content-Language: en-US In-Reply-To: Cc: fortran@gcc.gnu.org X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,KAM_DMARC_STATUS,KAM_NUMSUBJECT,SPF_HELO_NONE,SPF_PASS,TXREP,WEIRD_PORT 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: <20231029191521.qZpBs_i0zsOnQavv1UA8AtcsPJ4Z-1NPTn2LxdGk2dY@z> Hi Paul, code->expr1->symtree->n.sym->ts = code->expr2->ts; + /* Sometimes the selector expression is given the typespec of the + '_data' field, which is logical enough but inappropraite here. */ s/inappropraite/inappropriate/ + if (code->expr2->ts.type == BT_DERIVED otherwise it LGTM. Thanks for the patch! Harald On 10/29/23 13:29, Paul Richard Thomas wrote: > Bizarrely, since the fix for pr101625, the testcase compiles and runs > correctly with s/select type (y => x)/select type (y => (x))/ ! > > The fix is straightforward and appears to be one of those wrinkles arising > from the use of associate variables as a selector. The fault is reasonable > since the expression is a reference to the _data field, which is of derived > type. However, being a select type selector, the selector must be a > class with that declared type. > > Regtests fine. OK for mainline? > > Paul > > Fortran: Fix a problem with SELECT TYPE selectors [PR104555]. > > 2023-10-29 Paul Thomas > > gcc/fortran > PR fortran/104555 > * resolve.cc (resolve_select_type): If the selector expression > has no class component references and the expression is a > derived type, copy the typespec of the symbol to that of the > expression. > > gcc/testsuite/ > PR fortran/104555 > * gfortran.dg/pr104555.f90: New test. >