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 807DC3858418; Thu, 22 Feb 2024 21:32:28 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 807DC3858418 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 807DC3858418 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=212.227.15.15 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1708637559; cv=none; b=qCoQdFA1sroeyCmzRplBVlEN2yDMrZbfv6yUl16gt0DbPjai9vzzM30SGP5LFym1BeWkL3pFP/BCm1RAcaSm++kdxaY9CpYH4U0wjuvpIjc4f/OlITX6SZaAQGtYaPtPt1Q75BdpX04adTMhkD64dtqRN/j4gkmNWWOsWAufTG4= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1708637559; c=relaxed/simple; bh=nyCHF/W1fIQdTfJt88C7CPPtkcbrPYTFvZYY0rDRD6U=; h=DKIM-Signature:Message-ID:Date:MIME-Version:Subject:To:From; b=Ngxl3MJFxOWXdfFgp06Sj1pl+DuGIR5VJBvB5o7JJkB6ik9rd+QoF++THGJ+bjVLZBKnHBJ6jEvzixcFh1Vl3+wmmP5bE1YvTzSXgzJgqUCl07AZ5AN6MVkjXD4ApwV1u08MPH5vW4BF4MQtHd70pwkaldjeHIroohXSeqSGErE= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.de; s=s31663417; t=1708637544; x=1709242344; i=anlauf@gmx.de; bh=nyCHF/W1fIQdTfJt88C7CPPtkcbrPYTFvZYY0rDRD6U=; h=X-UI-Sender-Class:Date:Subject:To:Cc:References:From: In-Reply-To; b=bsfTZU41KUAOFN3/FUX2/D7akaw5AvDgTsCy92WvoOCUGPCGviQjvbd8MsY6oCFE DoZrxkhuo/RtHhOBgY0VU/ciVlTOtY9nSb3FUMFlyQo1hNjWuQFYLCu5pfi+xDszA QUyp6hsd4bGeLYbjpYp/KyfgqfiMpe4XRZBeC3K1F8fHr74ePJTi5S2D4bejvM+x1 /Q2ILTLoHGtFLlHhI3xsOGNvH1dO37N+0Uegaj1Qt4zXNU6+UD32wnFCFH/Jr2+jK HSwRWVXdkrjv2daIyM84G9lE5Mj1x6v6Gowdw8Lv4d8GiYIzrTMchNTbPFV0ekmL7 0pxcvHEFEq0IvSpHhQ== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Received: from [192.168.178.29] ([79.232.149.200]) by mail.gmx.net (mrgmx004 [212.227.17.190]) with ESMTPSA (Nemesis) id 1MAONd-1rnOsd2ZRb-00BtVq; Thu, 22 Feb 2024 22:32:24 +0100 Message-ID: <36c5afe2-07d5-41b2-8410-721f2a54dd51@gmx.de> Date: Thu, 22 Feb 2024 22:32:19 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] Fix fortran/PR114024 To: sgk@troutmask.apl.washington.edu Cc: Jerry D , fortran@gcc.gnu.org, gcc-patches@gcc.gnu.org Newsgroups: gmane.comp.gcc.patches,gmane.comp.gcc.fortran References: <29ba08a7-8218-4591-8c3f-36c17090e497@gmail.com> <3444d912-2e79-4e16-a425-79810d161ebb@gmx.de> <406c0c3a-f9a4-4f40-a44d-2db284060a59@gmx.de> 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:JQrTxr57V7yHo3NXz8jYLEsgsJxjAjkYMUVDuhde0rqTSmaJ01Q 1XQCdrKGcndfQEF7KTo2//4Ii29W3rLZp7WQDXEB78+/gK8SvdmriLOYzKBVMcdlkPj6y+b k/EKgI846mF/DsMDog9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DKIM_VALID_EF,FREEMAIL_FROM,KAM_NUMSUBJECT,RCVD_IN_DNSWL_LOW,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE,WEIRD_PORT 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: On 2/22/24 22:01, Steve Kargl wrote: > On Thu, Feb 22, 2024 at 09:22:37PM +0100, Harald Anlauf wrote: >> On the positive side, it not only seems to fix the cases in question, >> but also substring references etc., like the following: > > If the above passes a regression test, then by all means we should > use it. I did not consider the substring case. Even if unneeded > parentheses are inserted, which may cause generation of a temporary > variable, I hope users are not using 'allocate(x,source=3Dz%re)' is > some deeply nested crazy loops structure. First thing is code correctness. There are cases where the allocation shall preserve the array bounds, which is where we must avoid the parentheses at all cost. But these cases should be very limited. (There are some code comments/TODOs regarding this and an open PR by Tobias(?)). The cases we are currently discussing are even requiring(!) the resetting of the lower bounds to 1, so your suggestion to enforce parentheses does not look unreasonable. BTW: If someone uses allocate in a tight loop, he/she deserves to be punished anyway... > BTW, my patch and I suspect your improved patch also > fixes 'allocate(x,mold=3Dz%re)'. Consider, > > complex z(3) > real, allocatable :: x(:) > z =3D 42ha > allocate(x, mold=3Dz%re) > print *, size(x) > end > > % gfortran13 -o z a.f90 > a.f90:9:25: > > 9 | allocate(x, mold=3Dz%re) > | 1 > internal compiler error: in retrieve_last_ref, at fortran/trans-array.cc= :6070 > 0x247d7a679 __libc_start1 > /usr/src/lib/libc/csu/libc_start1.c:157 > > % gfcx -o z a.f90 && ./z > 3 > Nice! I completely forgot about MOLD... So the only missing pieces are a really comprehensive testcase and successful regtests... Cheers, Harald