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 95EE93858C83 for ; Wed, 11 Jan 2023 20:56:39 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 95EE93858C83 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=1673470594; bh=g25sA1iSI6JqlmkOFD9sbJ8sIXNxQ2JCn59sBGXIysI=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=ar0aymm+g2Ltjs1wpNSMrEcwQzYW1eJqy5zQavPfusOYMt+vzYisPwDh2TFWekBrv T32rDl0aPcFDa7+dDDd+os0p3mZbYJXhgf4BRxTD0uoTWElzlUjC7dPTyznWp2Pjss 0sfDj/QXT+hsxVlWtv0qknu76/RZaAct/pX1qlPxAVoczJIhn2ZHZ6FSe727UjZKQu FbfcoXSAXG7+F0vEXsR4FRE16txKnzcDu5nHt3ewSywI7nXuO70isAw05YZT81Ezqi s5LienQEOrHbjKD/9H+/tuKpdXnwke+fjYdPcb9gkL25+yjrPhWZPI7DsYT6P5MZla RaPxG0/KZRRtQ== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Received: from [93.207.86.128] ([93.207.86.128]) by web-mail.gmx.net (3c-app-gmx-bs49.server.lan [172.19.170.102]) (via HTTP); Wed, 11 Jan 2023 21:56:34 +0100 MIME-Version: 1.0 Message-ID: From: Harald Anlauf To: Harald Anlauf Cc: Paul Richard Thomas , Jerry D , fortran Subject: Re: [Patch, fortran] PR37336 (Finalization) - [F03] Finish derived-type finalization Content-Type: text/plain; charset=UTF-8 Date: Wed, 11 Jan 2023 21:56:34 +0100 Importance: normal Sensitivity: Normal In-Reply-To: References: <3cbaf568-84ac-8498-558f-9560fe395d66@gmx.de> <7ab973cd-f62e-28be-36e8-4e44252a4a38@gmx.de> <061aee5b-c27c-3a9f-419d-9893c2d744c4@netcologne.de> <78aafe8c-dcf9-55e6-50ce-c6289ea1f3fe@gmail.com> Content-Transfer-Encoding: quoted-printable X-UI-Message-Type: mail X-Priority: 3 X-Provags-ID: V03:K1:Ln5MUBAaf/txvwo2hCV2O7vUO990nyHZw6veCbrfH9Y9iXw9du/tlOsm6UtxlA83ofttv 5u7VxjW18I50wLGG6hPWMaXjDBOFoCPtxwCUQHAd7XU/ltvITiCueUMlZGs2eqYGM6zoOg3AUQUi oOFTFfkhR+Z4DUDKqhpzTdbyifcHDEGZpunvySeP91i8Vd5t16guBbp60DqaihRCzkkSS7u9PS2L qViVZPCQbDY5IibXFUdh9LV2dFEhIDXFPmsqTmcdB8J2z3MoE6Ahh78nY8oypc/Nko6jm5snDLJY LI= UI-OutboundReport: notjunk:1;M01:P0:4sHZb5Yzs+A=;+e4qV0xc4mLWaOeS+zPuLgtazrx 1HI+5kzh/qxjLbdQP1UmOyCQicpb0nNKRKVIwFMyyxVYIOLwjuDYs8eQiBLrAp4UvJaCj4CXe c7AfpifZ1/kgtWJm7JtD8MFe8MjGyBfpeDfZVdJnR/tBDZJ48UmXhqnDozADKFfF545o/YqYe KAIHHoYVeFVFEhghWQi0LgRusF854Q3MXwZFz67Z1n/PNi+jRy1IRkq2g+D2zaGM83dwX5YV3 keLuRwCu7gOmy/X8L8RrRIArgBjy8Uqk/EtWhwzDxxk10PThXdI3GzTOYAA6Ljyc9wEr3W9R5 wfG718jcm2HuaNTgp6FXu9x9jQzcUJJrQP9L1ASxqpKUSWxoisNj/7YUUC9HvCkQ6gxlEwGNj 0XX+qaXSuq68Rta4VmjyscQmzY9pZaxm5t7o9jrdGdMbUkL3hr54XeEn1vjh/5aip6NNGCO1V LsgqSCg/W/GEMBYZDMm4fAIw9bOXStbh1hrQwA8vRn9c9BbIah+E+fX7PAk+W3UA+Kgp4t4cT /SjUgWptCe+E4RLUwDh4N6NZG/3eMhn42O3q4Qmi+bowyY12nv1hrYJRHoiDuAJ5f8xUFlC+L IgfpILLDYf0Wm6Gxko6/EMbSaYKxm3l6VyAcy/v/edX+e169x+IgGyzBBvV4KiQ6uZ/XJTPqA vJQo0+6hX4PRSWLMjIql2CxM4ZZ8F7woglsnK6kgft/CruL4gf+q2JaKS7O5W+m8QRyn/Mptz f4z1Uh2+bnmTcTkTTo+7hSxTczISZrsWE99cgJQnnjjbELJoqdfx0N83fDWB/qNLNOj4I3Mbv D/p+KMkPC9B8rY3lJAImlWQCXp5t8O5YvHjuHAStKK/Zg= X-Spam-Status: No, score=-5.4 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS,TXREP 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: Dear all, Jerry pointed out to me off-list that I might have left others with confusion=2E Here's a simple example of what I had in my mind when I wrote the previous mail, and sorry for the TOFU: module m implicit none type :: simple integer :: ind contains final :: destructor1 end type simple contains subroutine destructor1(self) type(simple), intent(inout) :: self end subroutine destructor1 end program p use m type(simple) :: ThyType =3D simple(21) type(simple), allocatable :: MyTypeArray(:) MyTypeArray =3D [ThyType] end With the latest patch version I have from Paul: -std=3Df2018 : silent -std=3Dgnu : silent (good so far) -std=3Df2008 : foo=2Ef90:18:25: 18 | MyTypeArray =3D [ThyType] | 1 Warning: The structure constructor at (1) has been finalized=2E This featu= re was removed by f08/0011=2E Use -std=3Df2018 or -std=3Dgnu to eliminate t= he finalization=2E So the question is do we follow the original f2008 text or f08/0011? (For reference, see https://j3-fortran=2Eorg/doc/year/10/10-202r1=2Etxt which says: ``` Which is the correct approach? ANSWER: Approach 4=2E Constructors don't do anything that needs finalization=2E ``` I was trying to argue that the best user experience would be obtained by just doing what the interp says, and voting to draw the line between pre-f08/0011 and f08/0011 / f2018+=2E I am open to what should be done for -std=3Df2003 or -std=3Dlegacy, but then I do not really care, as finalization is not exactly legacy stuff=2E Thanks, Harald > Gesendet: Montag, 09=2E Januar 2023 um 21:42 Uhr > Von: "Harald Anlauf" > An: "Paul Richard Thomas" > Cc: "Jerry D" , "fortran" > Betreff: Aw: Re: Fw: Re: [Patch, fortran] PR37336 (Finalization) - [F03]= Finish derived-type finalization > > Hi Paul, all, > =C2=A0 > this is certainly better, and I am close to saying "go ahead", and > "let's fix any fallout later"=2E >=20 > I am still confused about the handling of F2008 backward compatibility, > even more so after looking at the mentioned interp F08/0011=2E >=20 > When referring to the published standard, this document really has a lot > of "this does not seem to make sense=2E" or "This makes even less sense= =2E=2E=2E" > It appears to be really tough on the F2008 text=2E >=20 > At the risk of sounding stupid, but what line of interpretation do > we normally follow? The published standard as-is, or rather take > into account the interpretation, even if it says that the published > document does not make sense? >=20 > If I understood you correctly, you are trying to implement a > backward compatibility, and the warning you emit refers to the > pre-interp version=2E I haven't looked at the latest standard, > but I guess you spent a lot of time on it: is there a difference > between the interp version and the F2018 version? If not, wouldn't > your/our life be easier if we focus on no-nonsense interpretations? > Or is there a convincing reason to support the pre-interp variant? >=20 > (From a practical point of view, a "F2018+ only" compliant > finalization would be more than most competitors offer=2E=2E=2E :) >=20 > Thanks, > Harald >=20 >=20 > Gesendet:=C2=A0Samstag, 07=2E Januar 2023 um 11:57 Uhr > Von:=C2=A0"Paul Richard Thomas" > An:=C2=A0"Harald Anlauf" > Cc:=C2=A0"Jerry D" , "fortran" > Betreff:=C2=A0Re: Fw: Re: [Patch, fortran] PR37336 (Finalization) - [F03= ] Finish derived-type finalization >=20 > Hi All, > =C2=A0 > Please find attached a patch for trans-array=2Ecc that does what Harald = suggests; ie=2E finalization of array and structure constructors only occur= s with -std=3Df2003/8=2E Two versions of finalize_38=2Ef90 are attached=2E = One which tests -std=3Dgnu/f20018 and the other -std=3Df2008=2E > =C2=A0 > Frankly, I think that this is better=2E Finalization of these expression= s must be handled with a lot of care and was deleted by f2018 for good reas= ons=2E Above all else, the results do not represent defined entities and so= it does not really make sense to finalize them=2E My vote is to go with th= is version of the patch=2E > =C2=A0 > I am struggling a bit with a=C2=A0nit in finalize_45=2E One of the other= processors appears to nullify the pointer component=C2=A0of the result of= =C2=A0construct_t during finalization of the result=2E I can see the sense = in this but do not find any requirement to do so in the standard=2E > =C2=A0 > Given the scale of the overall patch, I am beginning to have a lot of sy= mpathy with Thomas's suggestion that the finalization calls should be moved= to the front end! I will take a quick look to see how easy this would be t= o implement=2E > =C2=A0 > Regards > =C2=A0 > Paul > =C2=A0=C2=A0 >=20 > On Fri, 6 Jan 2023 at 08:34, Harald Anlauf via Fortran wrote:Hi Jerry, >=20 > > Gesendet: Freitag, 06=2E Januar 2023 um 04:08 Uhr > > Von: "Jerry D" > > An: "Harald Anlauf" , "fortra= n" > > Betreff: Re: Fw: Re: [Patch, fortran] PR37336 (Finalization) - [F03] F= inish derived-type finalization > > > > On 1/5/23 1:14 PM, Harald Anlauf via Fortran wrote: > > > Resending as plain text, as the original version did not appear on t= he fortran list=2E=2E=2E > > >=C2=A0 =C2=A0 > > > > > > Gesendet:=C2=A0Donnerstag, 05=2E Januar 2023 um 22:10 Uhr > > > Von:=C2=A0"Harald Anlauf" > > > An:=C2=A0"Paul Richard Thomas" > > > Cc:=C2=A0"fortran@gcc=2Egnu=2Eorg[mailto:fortran@gcc=2Egnu=2Eorg]" <= fortran@gcc=2Egnu=2Eorg[mailto:fortran@gcc=2Egnu=2Eorg]>, "Alessandro Fanfa= rillo" , "Andrew Benson" , "Thomas Koenig" , "Damian Rouson" > > > Betreff:=C2=A0Re: [Patch, fortran] PR37336 (Finalization) - [F03] Fi= nish derived-type finalization > > > > > > Dear Paul, all, > > >=C2=A0 =C2=A0 > > > I had a first look at the patch and the testcases, and I really look= forward to getting this into gfortran=2E > > >=C2=A0 =C2=A0 > > > A few questions surfaced when playing with it, which is why am askin= g for others to comment=2E > > >=C2=A0 =C2=A0 > > > Testcase finalize_38=2Ef90 exhibits a (potential) discrepancy to my = expections when playing with options -std=3Df2018 and -std=3Dgnu (the defau= lt)=2E > > >=C2=A0 =C2=A0 > > > What is the expected behavior of -std=3Dgnu?=C2=A0 My expectation is= that -std=3Dgnu always corresponds to the latest implemented standard (cur= rently F2018), except for possibly allowing for GNU-extensions=2E=C2=A0 Thi= s might imply that corrigenda to a standard or a newer version may lead (ov= er time) to an adjustment of the behavior=2E=C2=A0 Any opinions on it?=C2= =A0 Do we need to always test (in the testsuite) for compliance with older = standards? > > >=C2=A0 =C2=A0 > > > > My understanding is that -std=3Dgnu tends to be the least restrictive = and > > will allow finalize_38=2Ef90 to compile possibly with warnings=2E The > > warnings are to allow the user to know thay are out of current > > compliance, but we should not fail on code that was previously complia= nt > > and less we specify -std=3Df2018 which is more restrictive=2E >=20 > So if e=2Eg=2E finalize_38=2Ef90 compiles without warnings with -std=3Df= 2018, > it should also compile without warnings with -std=3Dgnu, right? >=20 > Harald >=20 >=20 > > Jerry > > > >=C2=A0 > =C2=A0-- > "If you can't explain it simply, you don't understand it well enough" - = Albert Einstein