From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ej1-x635.google.com (mail-ej1-x635.google.com [IPv6:2a00:1450:4864:20::635]) by sourceware.org (Postfix) with ESMTPS id 29C933858429; Sat, 17 Sep 2022 19:49:49 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 29C933858429 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-ej1-x635.google.com with SMTP id u9so56418641ejy.5; Sat, 17 Sep 2022 12:49:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:references :in-reply-to:subject:to:from:date:from:to:cc:subject:date; bh=kWgtn5jUui/bBFALqCHYSYj/RddD4UPP/P8FtrILGbY=; b=MJofQoHkkU+wM3S0fjPiVLASKNpyR1SeOHNzxCwivSGbY19GKaEGUfVkcuqSf6r4xl eJ6mntWYSMJNeS30Fhg5QEt9FkjYS50Q3asZf/bMPb+RJZTx8Q9/xg0U+nBinSiKuEgl M4pT/x8JwqjBP3TTyNGzRAFicwzfoSfCR5AO8OZ0VIjCTmAmPNvPbvx1o65TcTe5JVMs 9yy446BZSv9ggDvs1AjsNdoTSFepiU5jLZAHf0EyhHmpvp6oVwKGc/6XybV37GkN88Bk ypkS8WQBDq5aDPUBLKNTJmFyjg2NzihyukabYbwVpax/mjhxVAGeIdbnB/DbQeRerdSL cixg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:references :in-reply-to:subject:to:from:date:x-gm-message-state:from:to:cc :subject:date; bh=kWgtn5jUui/bBFALqCHYSYj/RddD4UPP/P8FtrILGbY=; b=uf9gjl1ToG/ISJukrsBYVUvhLIzYHKRiOk2Aw+2LJf1yCJXaMLJ9v0vvCr77c+NB77 ZFI7UxNh/xzHlHXLfto0u9XuOgq3QzP1BF86TahEDzzUWr5tSqDfcCORFFEbR8kHuSle qj69EE0+bCA59kkC/oahktDEnosfM08x6iFzSE3OPIxdGTZKRDn64TL1gy7RI9HAFybE phC0Y+bL71vIdDipwBjrZv6MAXTl3rViLIxju8CqUM5f2KkE3pj3BD4K+J7s4RxLKtne ooXQoXvrtAtX9i4Z6+WZhzwELDuJbWPbHn3vh+24ja3bzJx5/MTGAxbV1iujMTm4o4ZF VZhg== X-Gm-Message-State: ACrzQf2YK1N9sV84BOlCLDMoDPSjaklejzxl8+olp+oXai+Lnm0iZl/O xL0hOj84/jSYf+BaScZJk68= X-Google-Smtp-Source: AMsMyM47cDMgRlbj982Nu74Bt3v0V7/SIKeX6sdLK6+O8n+tXGGfrcpriM1CT9SkuJSkcUiMP94k6w== X-Received: by 2002:a17:907:9609:b0:77d:98fa:7d4f with SMTP id gb9-20020a170907960900b0077d98fa7d4fmr7775466ejc.628.1663444187735; Sat, 17 Sep 2022 12:49:47 -0700 (PDT) Received: from ?IPv6:::1? ([2001:4bb8:102:d6c4::222d:6a02]) by smtp.gmail.com with ESMTPSA id va6-20020a17090711c600b0076feb45e2d7sm6070320ejb.135.2022.09.17.12.49.46 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 17 Sep 2022 12:49:47 -0700 (PDT) Date: Sat, 17 Sep 2022 21:49:43 +0200 From: Bernhard Reutner-Fischer To: Mikael Morin , Thomas Koenig , Mikael Morin , gcc-patches@gcc.gnu.org, fortran@gcc.gnu.org Subject: =?US-ASCII?Q?Re=3A_=5BPATCH_09/10=5D_fortran=3A_Support_clobb?= =?US-ASCII?Q?ering_of_variable_subreferences_=5BPR88364=5D?= In-Reply-To: <3edab734-f5bb-5557-ff98-b0ce47d7c510@orange.fr> References: <20220916202439.549820-1-mikael@gcc.gnu.org> <20220916202439.549820-10-mikael@gcc.gnu.org> <3edab734-f5bb-5557-ff98-b0ce47d7c510@orange.fr> Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-2.9 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,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: On 17 September 2022 21:33:22 CEST, Mikael Morin = wrote: >Le 17/09/2022 =C3=A0 19:03, Thomas Koenig via Fortran a =C3=A9crit=C2=A0: >>=20 >> Hi Mikael, >>=20 >>> This adds support for clobbering of partial variable references, when >>> they are passed as actual argument and the associated dummy has the >>> INTENT(OUT) attribute=2E >>> Support includes array elements, derived type component references, >>> and complex real or imaginary parts=2E >>>=20 >>> This is done by removing the check for lack of subreferences, which is >>> basically a revert of r9-4911-gbd810d637041dba49a5aca3d085504575374ac6= f=2E >>> This removal allows more expressions than just array elements, >>> components and complex parts, but the other expressions are excluded b= y >>> other conditions: substrings are excluded by the check on expression >>> type (CHARACTER is excluded), KIND and LEN references are rejected by >>> the compiler as not valid in a variable definition context=2E >>>=20 >>> The check for scalarness is also updated as it was only valid when the= re >>> was no subreference=2E >>=20 >> First, thanks a lot for digging into this subject=2E I have looked thro= ugh >> the patch series, and it looks very good so far=2E I second that! The series looks plausible IMO=2E >>=20 >> I have a concern about this part, though=2E=C2=A0 My understanding at t= he >> time was that it is not possible to clobber an individual array >> element, but that this clobbers anything off the pointer that this >> is based on=2E >>=20 >Well, we need the middle-end guys to give a definitive answer on this top= ic, but I think it would be a very penalizing limitation if that was the ca= se=2E I have assumed that the clobber spanned the value it was applied on,= neither more nor less, so just the array element in case of array elements= =2E I would assume the same, fwiw=2E Let's blame the ME iff something goes amiss then, but I doubt it will=2E >> So, >>=20 >> =C2=A0 integer, dimension(3) :: a >>=20 >> =C2=A0 a(1) =3D 1 >> =C2=A0 a(3) =3D 3 >> =C2=A0 call foo(a(1)) >>=20 >> would also invalidate the store to a(3)=2E=C2=A0 Is my understanding co= rrect? > >I think it was the case before patch 2 in in the series, because the clob= ber was applied to the symbol decl, so in the case of the expression A(1), = it was applied to A which is the full array=2E After patch 2, the clobber = is applied to the expression A(1), so the element alone=2E Yep=2E >> If so, I think this we cannot revert that patch (which was introduced >> because of a regression)=2E >>=20 >The testcase from the patch was not specifically checking lack of side-ef= fect clobbers, so I have double-checked with the following testcase, which = should lift your concerns=2E >I propose to keep the patch with the testcase added to it=2E What do you= think? I cannot approve it but the series looks good to me=2E Thanks!