From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mout.gmx.net (mout.gmx.net [212.227.17.22]) by sourceware.org (Postfix) with ESMTPS id 399B23858C35; Sun, 17 Mar 2024 20:57:40 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 399B23858C35 Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=gmx.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmx.de ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 399B23858C35 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=212.227.17.22 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1710709062; cv=none; b=EUtqclMJsrBWTIhgZYPy9AKWlyj87oEWPn7AEekxkrnbnMMsV02D2x/ZD4Qn9jFWd0KDs8ffxdeeEFc4ooyM01pgs/NH5n00e4sGAiszYlkagE4Px9Z39Xa4rlLTG06Gn1gKDXpcgU+9ALpN8GJwHJz3X4TrxwZi7tYNGKlTwYs= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1710709062; c=relaxed/simple; bh=t6K0CNHvmYxCoJArLN1lR/dG4ctTYrPMXx5tWro1Kz8=; h=DKIM-Signature:Message-ID:Date:MIME-Version:Subject:To:From; b=VRv6B8K9VbWgMa1sb0a0ShLsrHvwJ5eFwTX2LJsVocWXBghHzxwohYlOICZel0ARtn/relAmLU/hRWUfFovyr0yMsQeUv5wukR/Y/3Pdwo5R6xJN9s4sfCD9Wjps49g10z5ChWRWe/nyUnX/s3tZdGSruMlW2WLqrgIVopx6su0= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmx.de; s=s31663417; t=1710709058; x=1711313858; i=anlauf@gmx.de; bh=Tcc+Tgdw6WI53N488pIEl6jMIV8hhdkLjhD6VBAP1i4=; h=X-UI-Sender-Class:Date:Subject:To:References:From:In-Reply-To; b=uNOlQOSuF9s/7d9F/JI99j10VlpHwiEDb+TQv+tNmZmg87a+Jr1hzt0AW90TKpT6 siwGjC18M7WlWJSWixZqxAIeQb6SaiqxjTVOPWGK4RVF2J2KoC3ayVMacCYTJV3bU aRwBwugEemfUmg9s2CY/Sdtr+q8okhRhYgJ7F6X5S4x6tJl/jGMcLYIjO5eBePKLo 43DiB5H6ujEOUPeZZv3/TrGYZ9L9LP7da3ab0aEtFkytW6wKWHB/cxtGn0Gd3wTkQ HYDPzLjGwBRwpUbC9vv+OVdY+u2bJKufvc3h/0GVpjRi1AmeZ6nO2BDr+2wVFjH1D u+UejvVCl03hQPzLlA== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Received: from [192.168.178.29] ([79.251.4.113]) by mail.gmx.net (mrgmx104 [212.227.17.168]) with ESMTPSA (Nemesis) id 1N1fii-1qoete2aMK-011xlo; Sun, 17 Mar 2024 21:57:38 +0100 Message-ID: <5d5b9838-cc2a-49d0-8746-0a054dc53af8@gmx.de> Date: Sun, 17 Mar 2024 21:57:37 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2 2/2] fortran: Fix specification expression error with dummy procedures [PR111781] To: Mikael Morin , fortran@gcc.gnu.org, gcc-patches@gcc.gnu.org Newsgroups: gmane.comp.gcc.patches,gmane.comp.gcc.fortran References: <20240317165749.1003825-1-mikael@gcc.gnu.org> <20240317165749.1003825-3-mikael@gcc.gnu.org> Content-Language: en-US From: Harald Anlauf In-Reply-To: <20240317165749.1003825-3-mikael@gcc.gnu.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:ayRaiB0+TatwKkL4W/VF3hcNb+rF+3tnFD1/O+AgM0pVIlAq5vS YyzLf2BZJ96IldiNJa+em6X/+n8Mnw6UevR57UfHjIH7aPXHDgm9njC5233CMAi0oFbtVj4 w4wMQmyF+5hhVRvqZTvU5LFtZ49T+6Qv0RDjr+PHf3cvDzwc5s3gsR5kAePsPjzJZ46Fvlt g1ElZ/huTVZCzCr/c651w== UI-OutboundReport: notjunk:1;M01:P0:WsvhaPODaw4=;MdvPASome0iFjwCcWtHZFHIPFoz EsRF+GpnLX9PNjiIFSN0Iwn03MysUQT9VEyEdyXJFCxVB3SMsqWRooTa5ActasjG8glPEpFAL p/s8nVbVTcMvG3KD6x++wOcSSbuuz5+/6RbpdHsewS46dNKb1CKQYsg73YrFKcnsUBLzsOJxB yt68YXZ4NL+q0Jn6bDmrqafEqdOISAD8+mlxi3dIiKz3bOb7mwAc5BVnJTHKM8Wcswy+fuCrP N9d7HB1kBgJ7lwDMcunOTU55s2HDhglCDG8A3KfU5MiGrVrBpKrjtpA7uTaWo5tSuZVUKDuM2 tRKi5zBaekFmVR3TpwJoyvjP2gHrY9ip8OGd1ZVVJp3/7+HujQXisLao99EO1gQSbKiJgxTiw aoxrdmIC3yjSp2Ky3r/tyB95cEKg5c/03rhwkOQViKtugB9P/49an83lJalNgUVMVF9MADjRT bx9inQ6BTFQ1E2H1I2wopCdd39SBAlE7onsBVvBcblZ8ttWibdK7DBQQbE32M+sSVd/j7uAoU w56smwMoMSQ5k9PgNjQ1lDMkYqb22UQmYAXbiua4sY17Qadsg9w/7O4P6YufSS/8y/WhiHu+N g1HsOeUw2jcxGQumFws1ctAHcHj/tPeOszHsNq0i9RkZgqjtLVGwYwW6XbeYDNYcLtFkcDIDv IwxV+4MxQ/BPYS2vKOoZvZMLSYVpxFbU5DjjuGAXhOVKdn8d1iTK5Y8OnwPoI2iJt664NhSMX UZwR/JhmeXPDNFzqZ/pcgTyZr/5dqoZ8r+wPxKRDzg1xo7A4HApg2poqOZ3yJh0OK6QuBr0C8 5qYJBeGV1Aulw27WDVj+aKkd9uWpxn5njYCx4PC7/dH9g= X-Spam-Status: No, score=-12.3 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,GIT_PATCH_0,RCVD_IN_DNSWL_LOW,RCVD_IN_MSPIKE_H2,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: Hi Mikael, thanks for the patch! Regarding the first part of the patch, I think that fixing bad testcases can be done at any time. Retaining identified, broken testcases means that one may hit bogus regressions, hindering progress. The second part of the patch looks at first glance fine to me. And as the patch changes less than its size suggests, in particular due to code refactoring, I don't see a reason to postpone it to stage 1. (On the contrary, deferring it to stage 1 might make future backports from 15 for later patches on top of that code harder. This is my opinion, and others might see this differently.) On 3/17/24 17:57, Mikael Morin wrote: > * expr.cc (check_restricted): Remove the case where symbol is dummy > and declared in the current ns. Use gfc_get_spec_ns to get the > right namespace. Looking at the original and new code, I don't fully understand that part of the commit message: the changed check comes into play when the symbol is *not* in_common, ..., a dummy, ... So technically, we didn't access the (now removed) formal_arg_flag here in those cases. Or am I missing something? > diff --git a/gcc/fortran/expr.cc b/gcc/fortran/expr.cc > index 82a642b01f7..0852bc5f493 100644 > --- a/gcc/fortran/expr.cc > +++ b/gcc/fortran/expr.cc > @@ -3509,19 +3509,13 @@ check_restricted (gfc_expr *e) > if (!check_references (e->ref, &check_restricted)) > break; > > - /* gfc_is_formal_arg broadcasts that a formal argument list is be= ing > - processed in resolve.cc(resolve_formal_arglist). This is done so > - that host associated dummy array indices are accepted (PR23446). > - This mechanism also does the same for the specification expressions > - of array-valued functions. */ > if (e->error > || sym->attr.in_common > || sym->attr.use_assoc > || sym->attr.dummy > || sym->attr.implied_index > || sym->attr.flavor =3D=3D FL_PARAMETER > - || is_parent_of_current_ns (sym->ns) > - || (gfc_is_formal_arg () && (sym->ns =3D=3D gfc_current_ns))) > + || is_parent_of_current_ns (gfc_get_spec_ns (sym))) > { > t =3D true; > break; > diff --git a/gcc/testsuite/gfortran.dg/spec_expr_8.f90 b/gcc/testsuite/g= fortran.dg/spec_expr_8.f90 > new file mode 100644 > index 00000000000..5885810d421 > --- /dev/null > +++ b/gcc/testsuite/gfortran.dg/spec_expr_8.f90 > @@ -0,0 +1,24 @@ > +! { dg-do compile } > +! > +! PR fortran/111781 > +! We used to reject the example below because the dummy procedure g was > +! setting the current namespace without properly restoring it, which br= oke > +! the specification expression check for the dimension of A later on. > +! > +! Contributed by Markus Vikhamar-Sandberg Is the reporter's first name Markus or Rasmus? Thanks, Harald