From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from esa2.mentor.iphmx.com (esa2.mentor.iphmx.com [68.232.141.98]) by sourceware.org (Postfix) with ESMTPS id 340BC3848409; Thu, 22 Jul 2021 16:47:39 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 340BC3848409 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: D9VMed5DMSKWltTBiCTSPq7ws+HPzZGP8nb0hu/D7Ng2P5DHM0eerfiVnU0arSXYAF1ru17Vlt UPPZtAWBt087MMiY97ss955l+m/AL7LUwECP+GpHY9/S+bc84vxteEdcJVl9ZJ4rAWeX48oYVd VMaIsqD12e+2fqB2BGOhWewfv7MxfzvPZ90hY4GVdHpQ5zcAr6zgbenjAXWePbo0m6rVH6cQgd o8HBNJa6LEaAyLgsnD+7C3bXMyBeyzHMKTTdJQs+Mt6E/IzxkyOdWp1RBfRlgnBw9lwhRTOum6 CPbh9sjIKtAjNb/7opVNhUi2 X-IronPort-AV: E=Sophos;i="5.84,261,1620720000"; d="scan'208";a="63822402" Received: from orw-gwy-01-in.mentorg.com ([192.94.38.165]) by esa2.mentor.iphmx.com with ESMTP; 22 Jul 2021 08:47:37 -0800 IronPort-SDR: nz0sZyszwfooIgliqZ9hXIDOf18FZgKAAbNQ1HV/e6/f+9oetQ3tlz7bDle/EBnfeANlgYjvXZ C6apT2rr8NsJTaRDZEDemA+PBIKhnjoiosZKdsS0qEnSLdMcKQOq5wRFXDmMcbbtdkTyH52XX9 N03SgsTDkykQpxjs4Q2orTdXPDbcPFJMkOO6rhSMOrZDUb9CPUV7afJOTw+47NVI3XNj+jJHsf xlJ0esx4OpGl9tQ7ma2a3fS0hawhmgJLbiFmPMECC9CVcRpQHap0JEZK4B5O2aaPVpUUlLzQ13 8P4= Subject: Re: [PATCH] PR fortran/101536 - ICE in gfc_conv_expr_descriptor, at fortran/trans-array.c:7324 To: Harald Anlauf , fortran , gcc-patches References: From: Tobias Burnus Message-ID: Date: Thu, 22 Jul 2021 18:47:27 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.12.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-01.mgc.mentorg.com (139.181.222.1) To svr-ies-mbx-01.mgc.mentorg.com (139.181.222.1) X-Spam-Status: No, score=-5.6 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, KAM_NUMSUBJECT, NICE_REPLY_A, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=no 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: Thu, 22 Jul 2021 16:47:40 -0000 Hi Harald, On 21.07.21 22:22, Harald Anlauf via Fortran wrote: > Another one of Gerhard's infamous testcases. We did not properly detect > and reject array elements of type CLASS as argument to an intrinsic when > it should be an array. > > Regtested on x86_64-pc-linux-gnu. OK for mainline / 11-branch when it > reopens? ... > + class(t), allocatable :: x(:) > + f =3D size (x(1)) ! { dg-error "must be an array" } ... > if (e->ts.type =3D=3D BT_CLASS && gfc_expr_attr (e).class_ok > && CLASS_DATA (e)->attr.dimension > && CLASS_DATA (e)->as->rank) > { > + if (e->ref && e->ref->type =3D=3D REF_ARRAY > + && e->ref->u.ar.type =3D=3D AR_ELEMENT) > + goto error; I think that one is wrong. While CLASS_DATA (e) accesses e->ts.u.derived->c= omponents, which always works, your code assumes that there is only 'c' and not 'x%c' = where 'c' is of type BT_CLASS and 'x' is of type BT_DERIVED. I wonder whether it works if you simply remove 'return true;' as gfc_add_class_array_ref sets 'e->rank =3D CLASS(e)->rank (and adds an AR_FULL ref, if needed). In the nonerror case, the 'return true' is obtained via: if (e->rank !=3D 0 && e->ts.type !=3D BT_PROCEDURE) return true; And, otherwise, it falls through to the error. OK if that works =E2=80=93 but please also add a test like type t class(*), allocatable :: c(:) end type t type(t) :: x x%c =3D [1,2,3,4] print *, size(x%c) print *, size(x%c(1)) ! { dg-error ... } end Thanks, 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