From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mout.gmx.net (mout.gmx.net [212.227.17.21]) by sourceware.org (Postfix) with ESMTPS id 46BF93858D20; Thu, 28 Mar 2024 22:27:31 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 46BF93858D20 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 46BF93858D20 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=212.227.17.21 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1711664854; cv=none; b=Fk2we93KV4y+ZJaSrnr1OYnh7Rq82qH4NX7OEj6RD9fc7/ZI9pQtzFVWzqjhNaPtBJKgij2XJ5z8vARnK2YRwjIvNXyEJCk6lng+OG/TxLLxWe6dkHqqyDHwoLQafYykX3gpWtXWof8g5flEJeCxAUf5xcA6L/phBUjHR17uww4= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1711664854; c=relaxed/simple; bh=EmGTF2N7VD5I+dTnGysgZqxDR9Er+o/ftJyNBzPK9G0=; h=DKIM-Signature:Message-ID:Date:MIME-Version:Subject:To:From; b=E91i1GdqHzZtr4w5s3Nb6pkIvJKEnQ1JAvY6lLGA/1xK+rJ2yGnXODJ6+d89MdqTXzTrZhcpxjt0Ux4/Nnsq1q7jNXyZNjnoi59eGPvvGAVOvayHUSqay95lDoJesuUx+0ZwSuk458y5a/5Eq7Pd6EJQsqT0G2Fs9b6PoiHRfew= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmx.de; s=s31663417; t=1711664849; x=1712269649; i=anlauf@gmx.de; bh=rnu/FxZevaGMZnLzZKMuav5H22lDadl9jvLi/s2mozE=; h=X-UI-Sender-Class:Date:Subject:To:Cc:References:From: In-Reply-To; b=A5zG8HsTpeTNETR8kvAAnQ/4oJDg7dU055h044HkRL2c4a3BWhRLpFO1oCHZS1GV nHDflqvYhgPP0t5wb2lGqYdIbUi1k3udlDnyiFvcG9WuNxYk7eLQcyNa50dvHiefm 7pku6tuOPPIprV/RctBDQ4OcLOBWzG2qfaex4IYRGRZ5tDx6wBjc41K8dblp7iD86 LF3oo63PoEq87mPqvvTWuOK4Rln7qcrW7uEJIC7lTEhFaB8P3FT9IEDiT3bBRuUGw ykD8qdAmFybc4i4iQFvD6iFhX4xvaNYaGMEt6XJHnwOHDrdClbAt5HA9bSx1ANPEl Ph5FBR955Bi46PoRzQ== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Received: from [192.168.178.29] ([93.207.88.174]) by mail.gmx.net (mrgmx104 [212.227.17.168]) with ESMTPSA (Nemesis) id 1MuDbx-1shNBk2X9h-00uWtm; Thu, 28 Mar 2024 23:27:29 +0100 Message-ID: Date: Thu, 28 Mar 2024 23:27:28 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [Patch, fortran] PR110987 and PR113885 - gimplifier ICEs and wrong results in finalization To: Paul Richard Thomas , "fortran@gcc.gnu.org" , gcc-patches Cc: chilikin.k@gmail.com 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:LSLC3wnGXCYVTjJSEboiKI48hrUpj9PzUptOKq6eoezQOvxZ8ON tC9A9AtwDS+Iyg4NNg8qyXslSlli1rSwbo26/0PkgWJOutXFaf60b4/ljLTH4HEQMNlANvh ld61uQeRswf+cuL5AMEsg0mQzQL/t9ZenUMKVNC0YsRoyhrRdVRZY2jN5HXRqvH/VpxSxGe ARxfSUsfF5pLg9ulxsEBA== UI-OutboundReport: notjunk:1;M01:P0:FKUh+ampi/4=;txKWpjfbkuHK1DLHAVQOy8Y1YFH kjU3DU1XvN+2oPALte2URcMiKCOchQ8xE1XoHvbA+3lK34lpwZBh4nsfQT2M356xppebBC9zV uply4cXoy/mMvjFpEC1WehVwnFRFd2HiB4kFZKVCA3DIxnysHLEfPQXnmjNbRuOxh9eVqsAPk 9A7Cf5Mmkp6ux5jBxeVh1Ew7UvnRu5x/P6NcPk7sehsrikCeZnVH7wg+4Al0yv3sDWlhF/mKX iDXEtPb2gVuySpDrGin7RR3ma/3n/s1EA7GzGJv00+eJvwoVuvCp/9jwi3WDco85GacV8xxBz YlhVuyt07IcLuSKpyr5Ovx9lVAhH+x3cwAkb6uyqx/Y84I4ehKhVE83vqswNBx1pR7pCBivji DjX49XPcMS3S5slwrUKA5fOgpan+KHvpXdfgBI96FV+T0kiypwzDaaTrYdBwV+bRsY45t9zxV aP5gFL9iy/yRT40jxbFKl4HlzsX6u3FXbxZrvDaamxmbEUW+/AMAHMkguS/NTFtIUeEGhz+Tl nvricIdiYvAPQWk0dDGt2dyQdnxQqpp5dqHHJ6UhhvJuCRCLPlSyRmtSeQrGlkizinnntWzbI cqauLadECauRBJoI+ytA+gjnd0AuQuR9J3gSGIU4aM44c8hmrAlhW2CktDrWf+fU5hRKog3hn +RgKfxfpWESG+C4wwqbf0Wew46UZewc4fc91gDupNAkgxrTL/g64tNCuTUS3wxUxms5hYM3s8 kM/Q1gqx8+rR9VQ/dJ3dQ4/0b1YiWgRZLjFWirZ1QT/xAYjnfWEjOLB3mhpr5vxefvV2tienF e7Fa1qUbskSD0Mqw+f0et5Vzabk/8K/V8ETb00cXi2WB4= X-Spam-Status: No, score=-5.3 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_H3,RCVD_IN_MSPIKE_WL,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: Hi Paul, Am 28.03.24 um 16:39 schrieb Paul Richard Thomas: > Hi All, > > The attached patch has two elements: > > (i) A fix for gimplifier ICEs with derived type having no components. Th= e > reporter himself suggested (thanks Kirill!): > > - if (derived && derived->attr.zero_comp) > + if (derived && (derived->components =3D=3D NULL)) > > As far as I can tell, this is the correct fix. I tried setting > attr.zero_comp in resolve.cc for all the OK types without components but > this caused all sorts of fallout. > > (ii) Final calls were occurring in the wrong place for finalizable > elemental function calls within scalarizer loops. This caused incorrect > results even for derived types with components. This is also fixed. yes, this looks good here. > It should be noted that finalizer calls from the rhs of an assignment ar= e > occurring at the wrong time, since F2018/24-7.5.6.3 requires: > "If an executable construct references a nonpointer function, the result= is > finalized after execution of the innermost executable construct containi= ng > the reference.", while in the present implementation, this happening jus= t > before assignment to the lhs temporary. Fixing this is going to be reall= y > tough and invasive, so I decided that getting the right results and the > correct number of finalization should be sufficient for the 14-branch > release. As it happens, I had been mulling over how to do this for > finalizations hidden in constructors and other contexts than assignment > (eg. write statements or allocation with source). It's a few months away > and will be appropriate for stage 1. > > Regtests on x86_64 - OK for mainline and then, after a bit, for backport= ing > to 13-branch? The patch looks rather "conservative" (read: safe) and appears to fix the regressions very well, so go ahead as planned. Thanks for the patch! Harald > Regards to all > > Paul > > Fortran: Fix a gimplifier ICE/wrong result with finalization [PR104555] > > 2024-03-28 Paul Thomas > > gcc/fortran > PR fortran/36337 > PR fortran/110987 > PR fortran/113885 > * trans-expr.cc (gfc_trans_assignment_1): Place finalization > block before rhs post block for elemental rhs. > * trans.cc (gfc_finalize_tree_expr): Check directly if a type > has no components, rather than the zero components attribute. > Treat elemental zero component expressions in the same way as > scalars. > > > gcc/testsuite/ > PR fortran/113885 > * gfortran.dg/finalize_54.f90: New test. > * gfortran.dg/finalize_55.f90: New test. > > gcc/testsuite/ > PR fortran/110987 > * gfortran.dg/finalize_56.f90: New test. >