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 600AE3851174; Wed, 24 Aug 2022 17:54:29 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 600AE3851174 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=codesourcery.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=mentor.com X-IronPort-AV: E=Sophos;i="5.93,261,1654588800"; d="scan'208,217";a="81890458" Received: from orw-gwy-01-in.mentorg.com ([192.94.38.165]) by esa4.mentor.iphmx.com with ESMTP; 24 Aug 2022 09:54:29 -0800 IronPort-SDR: 0ARxIXkL77N7i8ytpZ7nYmW1zp9PX5HRL5hHHcdyRCeGxcKF/UoJ1RLGyn9upiUto0C6fM0eyd jFoOxeGJz/PoZQ9qjaWEyduqAbL4QK2x6e+BDPEGmMipQY9U8sPJrYLaIc3vbov+HKppOw07Qg AfvYAZVDjymF4g+qgeaCk8fIcOoRUWRPMJ1FkwENIr9SHNuhr48rG4aq3FN8zoo2Y4P7Z/NhIk 6QCmSItdTMv98N0ia6OLF5rCi4Q4ey3PG4ZMU5jNvmCnfiycGmM/PbEFqTX4st2K2sIMOl8Ydi tRs= Content-Type: multipart/alternative; boundary="------------Tqg3xS9yvnAFss11jdJohncm" Message-ID: Date: Wed, 24 Aug 2022 19:54:22 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.1.2 Subject: Re: [PATCH] Fortran: improve error recovery while simplifying size of bad array [PR103694] Content-Language: en-US To: Harald Anlauf , fortran , gcc-patches References: From: Tobias Burnus In-Reply-To: X-Originating-IP: [137.202.0.90] X-ClientProxiedBy: svr-ies-mbx-13.mgc.mentorg.com (139.181.222.13) To svr-ies-mbx-12.mgc.mentorg.com (139.181.222.12) X-Spam-Status: No, score=-11.4 required=5.0 tests=BAYES_00,GIT_PATCH_0,HEADER_FROM_DIFFERENT_DOMAINS,HTML_MESSAGE,KAM_DMARC_STATUS,NICE_REPLY_A,SPF_HELO_PASS,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: Message-ID: <20220824175422.Fcd8wBD5k3EGSD62OrVrCSfelsJH71eTNhicOviYHBI@z> --------------Tqg3xS9yvnAFss11jdJohncm Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: quoted-printable Dear Harald, On 23.08.22 22:29, Harald Anlauf via Fortran wrote: the simplification of the size of an array with a bad decl should not be successful. Improve the error recovery for such a situation. [...] Regtested on x86_64-pc-linux-gnu. The PR is marked as a 12/13 regression. Will therefore commit to both. LGTM =E2=80=93 and thanks for taking care of the Fortran bugs! Tobias [PATCH] Fortran: improve error recovery while simplifying size of bad array= [PR103694] gcc/fortran/ChangeLog: PR fortran/103694 * simplify.cc (simplify_size): The size expression of an array cann= ot be simplified if an error occurs while resolving the array spec. gcc/testsuite/ChangeLog: PR fortran/103694 * gfortran.dg/pr103694.f90: New test. --- gcc/fortran/simplify.cc | 5 +++-- gcc/testsuite/gfortran.dg/pr103694.f90 | 11 +++++++++++ 2 files changed, 14 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/gfortran.dg/pr103694.f90 diff --git a/gcc/fortran/simplify.cc b/gcc/fortran/simplify.cc index f992c31e5d7..bc178d54891 100644 --- a/gcc/fortran/simplify.cc +++ b/gcc/fortran/simplify.cc @@ -7536,8 +7536,9 @@ simplify_size (gfc_expr *array, gfc_expr *dim, int k) } for (ref =3D array->ref; ref; ref =3D ref->next) - if (ref->type =3D=3D REF_ARRAY && ref->u.ar.as) - gfc_resolve_array_spec (ref->u.ar.as, 0); + if (ref->type =3D=3D REF_ARRAY && ref->u.ar.as + && !gfc_resolve_array_spec (ref->u.ar.as, 0)) + return NULL; if (dim =3D=3D NULL) { diff --git a/gcc/testsuite/gfortran.dg/pr103694.f90 b/gcc/testsuite/gfortra= n.dg/pr103694.f90 new file mode 100644 index 00000000000..3ed8b2088da --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr103694.f90 @@ -0,0 +1,11 @@ +! { dg-do compile } +! PR fortran/103694 - ICE in gfc_conv_expr_op +! Contributed by G.Steinmetz + +subroutine s + type t + integer :: a(2) + end type + type(t) :: x((0.)/0) + integer :: n =3D size(x(1)%a) ! { dg-error "does not reduce to a constan= t expression" } +end ----------------- 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 --------------Tqg3xS9yvnAFss11jdJohncm--