From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mout.gmx.net (mout.gmx.net [212.227.15.15]) by sourceware.org (Postfix) with ESMTPS id DF46D385735D; Tue, 9 May 2023 18:24:19 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org DF46D385735D Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmx.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmx.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.de; s=s31663417; t=1683656657; i=anlauf@gmx.de; bh=gfkO4qYDZ04eXlhhe6gFcASa7/Q+VGTI0n4CZ+IUXjc=; h=X-UI-Sender-Class:Date:Subject:To:Cc:References:From:In-Reply-To; b=erYLpcM7nVerXSr3WSDJ49Sp/86Ba0QmT2oqKmBI9Ze/7YYq9tOF0Les0rCdU/Atu WqvcIqwtmr/hkfL5PQje+vqXSB5CPAEKRQ03v8IXUzvdczxsd6Qj0nm14qdiK6hYm5 Vn6dR9jLx94vIEbgGc3pIwfN8DLU4fgmlMa9h722aB97T5anqJm341pleodSYDgeIf Hjtc/GjViWNAMI5XRtSErBb+bfIyH6xFa6aYBc0J69HQMX3SJ+eA1ADUTSdMT4t+KM 4CVsBoUXSy9AKVxJni7aQv6VP0cR5inldQoj+4lAF141sE+QbSZK2aLoctyTRmJbc+ h6/bNeHIKCbJQ== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Received: from [192.168.178.29] ([93.207.91.40]) by mail.gmx.net (mrgmx004 [212.227.17.190]) with ESMTPSA (Nemesis) id 1N6sn7-1qH2ZK0A7b-018KES; Tue, 09 May 2023 20:24:17 +0200 Message-ID: <9b573e6c-52e0-ce7c-6ae4-9b21a55525e9@gmx.de> Date: Tue, 9 May 2023 20:24:16 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.10.1 Subject: Re: [Patch, fortran] PR97122 - Spurious FINAL ... must be in the specification part of a MODULE To: Paul Richard Thomas , "fortran@gcc.gnu.org" , gcc-patches Cc: "Steven G. Kargl" Newsgroups: gmane.comp.gcc.patches,gmane.comp.gcc.fortran References: Content-Language: en-US From: Harald Anlauf In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:kTGdweM6JwcZSNz9qh+w6Lw1h+E1L55ly/k78UAI+FepgXL1yMC /ahn+GpueMXJj1wz3W36+tnaElWefTbYnBjrCOHryaDuR+sgis0dZpBM1JiPWx+t8zfxEw9 oO0PmkILiu2/6i3M6Gbc8kZHTLEHgkSEDP04rnxclhomxVFFKw9/PrcnG0Jy00REMNssTG1 cPc+zAVbFFEqJUFjZ484g== UI-OutboundReport: notjunk:1;M01:P0:pDrIYex+6GQ=;fBRTwc/B1BNgu/zEBN6j67HPa2B ua9Sq+c6IEP3ITOLoMQKIH0VigWGM5/ieItTpE6NvVhqVQx6vbJN5hbRyjwircEkUBnT//Fmq ri+tlUg+qQC2Bn9TMkSVy8VIJQ+0Ke8qtKNBs+Jm+JLt0Lm+Y5pHoS4av3EOSsKUZc+/PNItj uivV+0uWHugi4EJBkhqknIJnhVv3yMRqmz00Ug//NP+OSLKdJuQOMcvGSLUhGz5MIUwxX1K96 MHuf3wLUJ6JSoG/ARiWoVOEP6u7wBJWkBF1e78+Zn7dJNIn95PFv8qDvn+8+/gmLtH2EzPO9l i36TCVNuGxBXsd2vbn/jsj8usehG4oZdqdQ2PtoEwU70DLLm8w1BEtvteWw9/qBFrwJgXAsl3 0cPk7fdH60M5V+WP27yPCa+r8BXIwS3f6M4djYeeuv3D0g8uCpWbC4WmQjkfzC3fJfm2Rk+k6 4JZDoZGRH4WgZpiwC/IoFCWMqIBF6cQKq2GmpiK6986jVf9TfMBS7gDDLmK5krBdNBp18wp9C 7fajApKoTX0UW/9jy4L+iDlbFtDznMI6BAkV8vX5IktBoXubz9/DWaZIWxef89P195OQvNjhT d7WJu7M5uhDNLR2iZd6aTtmxuR3YYdsoe9uil36qOi4Gd309ykHMgiEts6NTihZ9o8/6Wqlln zbPGJBs441qu3vUfhFgP0QI0cXvBxwXfEum+LSf4lay/z0kNCtxb3y2ZxEIh9GaiOGt0K194G WjYDkRcNOXSQ1e1J/vTXGqpFNPt9D5K8EwkozsG001u1CtFnonLZBxW6cgpcFIx3hifwJSkjV PtkH8K1wskkx0gyDDJhPvKZkDhRz4crevxmp1gz5BxFwV4vh523x7nEynceUeFEljx1tzjDrk gD5llrBV9nl1FEy3YIeIC28GDiPvz6v+I4LacGsVPM8ZTXh9QRgr7Wg6uVqTg0PL0aQ+rlurB o8Jx1Kl9eGWVy0N7vAqdb63msSU= X-Spam-Status: No, score=-5.5 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,NICE_REPLY_A,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 Paul, On 5/9/23 17:51, Paul Richard Thomas via Gcc-patches wrote: > Hi All, > > Thanks to Steve Kargl for the fix. It caused finalize_8.f03 to fail beca= use > this testcase checked that finalizable derived types could not be specif= ied > in a submodule. I have replaced the original test with a test of the pat= ch. > > Thanks also to Malcolm Cohen for guidance on this. > > OK for trunk? the patch looks good to me. However: @@ -11637,8 +11637,9 @@ gfc_match_final_decl (void) block =3D gfc_state_stack->previous->sym; gcc_assert (block); - if (!gfc_state_stack->previous || !gfc_state_stack->previous->previous - || gfc_state_stack->previous->previous->state !=3D COMP_MODULE) + if (gfc_state_stack->previous->previous + && gfc_state_stack->previous->previous->state !=3D COMP_MODULE + && gfc_state_stack->previous->previous->state !=3D COMP_SUBMODULE) { gfc_error ("Derived type declaration with FINAL at %C must be in the" " specification part of a MODULE"); I am wondering if we should keep the protection against a potential NULL pointer dereference (i.e. gfc_state_stack->previous =3D=3D NULL) for possibly invalid code. I have failed to produce a simple testcase, but others may have "better" ideas. I'll leave it to you to amend the patch or leave as is. Thanks, Harald > Paul > > Fortran: Allow declaration of finalizable DT in a submodule [PR97122] > > 2023-05-09 Paul Thomas > Steven G. Kargl > > gcc/fortran > PR fortran/97122 > * decl.cc (variable_decl): Clean up white space issues. > (gfc_match_final_decl): Declaration of finalizable derived type > is allowed in a submodule. > > gcc/testsuite/ > PR fortran/97122 > * gfortran.dg/finalize_8.f03 : Replace testcase that checks > declaration of finalizable derived types in submodules works.