From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from esa4.mentor.iphmx.com (esa4.mentor.iphmx.com [68.232.137.252]) by sourceware.org (Postfix) with ESMTPS id 322923858D35; Wed, 29 Sep 2021 07:48:27 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 322923858D35 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=codesourcery.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=mentor.com IronPort-SDR: KU8vKUYyik17RDNxw3de7dSXs8TdzHoVfCmF7CPy8PvAiJOfYkJepUkjaAjmg/ojRWAgaNaona gM2zlrLCzqeqBnD8f9IHKFE3NXmxPo3kShiD+Z1sQYZ5GmM/qGRLk7KDu5IuNRz6PjdJCnOSP9 x871FbGiCtFou4D6ZuxWXBLpj3AEEda9HbVQh6L2S4m10wY1TF4zLQteabG0322NspEo9x8FWT 0QcWp1sG3YSr+x+bcXDb460dkqvMrG1+964Z7wFPcdfLrocrQ5ImD/DDdSjUl6lcK50qoA8LeC iZ9j0s0MpqPNWPf1MwC+lhoJ X-IronPort-AV: E=Sophos;i="5.85,331,1624348800"; d="scan'208";a="66599455" Received: from orw-gwy-02-in.mentorg.com ([192.94.38.167]) by esa4.mentor.iphmx.com with ESMTP; 28 Sep 2021 23:48:26 -0800 IronPort-SDR: C9QS2+sWCwTyzUYiOxIhdGb8l0Z+qLf+3sFgEcr7U8sWdKbQEQQhIUxe9swsnJAaFhT13bR9GZ GLUych7H/UTknIr2BAxqz6O92g63sTFHdrhILUV3bPdiNwe6sHUces6YgcyxOwaMI/5VIO9lhO OBRJv+Sp/+kIDigKt7YSAL2C8MRay0V0LEt2wZUJcZmExT1Y2Bm3AaNSDkBG6U3yAOffrvpqa4 74n0ENIAyouilsQmVns8V1fgDFFBPCD5sKEPp/6wx8FxCwh228UhMDDHmVbUwGJRLyAvFpvTA9 Zg8= Subject: Re: [Patch] Fortran: Fix same_type_as From: Tobias Burnus To: gcc-patches , fortran CC: Sandra Loosemore References: Message-ID: <38f03820-1bb4-d410-6dc7-134149dcb45c@codesourcery.com> Date: Wed, 29 Sep 2021 09:48:20 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.14.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: quoted-printable Content-Language: en-US X-Originating-IP: [137.202.0.90] X-ClientProxiedBy: svr-ies-mbx-09.mgc.mentorg.com (139.181.222.9) To svr-ies-mbx-01.mgc.mentorg.com (139.181.222.1) X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, NICE_REPLY_A, SPF_HELO_PASS, SPF_PASS, TXREP 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: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Sep 2021 07:48:28 -0000 Early ping ;-) =E2=80=93 but actually I do want to explain some parts of m= y patch, what I forgot in my first patch email. Note that while "class(t)" is of declared type when unallocated/unassociated, "class(*)" is not. Thus, when unassociated/unallocated, "same_type_as(class_star, class_star)" is .false. Code wise, this implies the extra check for class_star._vtab =3D=3D NULL while class_t._vtab is always set and, thus, class._vtab->hash is always available. (Unchanged in this patch, but probably not obvious without reading the standard.) On 28.09.21 18:25, Tobias Burnus wrote: > - if (UNLIMITED_POLY (a)) > + bool unlimited_poly_a =3D UNLIMITED_POLY (a); > + bool unlimited_poly_b =3D UNLIMITED_POLY (b); Those variables are needed as we add component refs later, which then cause UNLIMITED_POLY to evaluate false. UNLIMITED_POLY operates on on expr->ts =E2=80=93 thus, it already caters for derived-type accesses. > + if (unlimited_poly_a) > { > - tmp =3D gfc_class_vptr_get (a->symtree->n.sym->backend_decl); This caused the ICE as backend_decl was NULL. Additionally, it assumes that the sym and not some component of it is the requested unlimited-polymorphic object. Without the latter issue, a simple gfc_get_symbol_decl() around the argument would be sufficient. > + se1.want_pointer =3D 1; > + gfc_add_vptr_component (a); The gfc_add_vptr_component handles expr->ref->type =3D=3D REF_COMPONENT properly. As also used for the "else if" branch, DT are handled properly. I think the rest of the patch is obvious. Tobias ----------------- Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstra=C3=9Fe 201= , 80634 M=C3=BCnchen; Gesellschaft mit beschr=C3=A4nkter Haftung; Gesch=C3= =A4ftsf=C3=BChrer: Thomas Heurung, Frank Th=C3=BCrauf; Sitz der Gesellschaf= t: M=C3=BCnchen; Registergericht M=C3=BCnchen, HRB 106955