From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from esa4.mentor.iphmx.com (esa4.mentor.iphmx.com [68.232.137.252]) by sourceware.org (Postfix) with ESMTPS id B36B93858423; Sat, 2 Oct 2021 18:01:49 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org B36B93858423 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=codesourcery.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=mentor.com IronPort-SDR: B4HO3+iA5foOk7Q3l79JQJgLd7XRAOs0xRl2HWyBpqtuk+G/lWAJXoLVxrv/n2ABZP+MQYMIPa ubDXRwuEinY3DvhD4n7Nl86uDAPWbVioUe6caXai1e9+l94hJG0yQWI2XZVPmcFuWcZeu6e0yo mlMTU3idibVwSRCleGNhFfcN36KZEsTN971J5qjzqR2uc5PQMNcwW+ZnA6AYCtzeBiMZVDST9o HVakgXHqp4AyS7K3IQbEAWb3yAxGVLDgMkTzmnZpt1hq9s4ghX7zoL74/0IOwHjCwHtLxvZxv6 3pg= X-IronPort-AV: E=Sophos;i="5.85,342,1624348800"; d="scan'208";a="66749129" Received: from orw-gwy-01-in.mentorg.com ([192.94.38.165]) by esa4.mentor.iphmx.com with ESMTP; 02 Oct 2021 10:01:46 -0800 IronPort-SDR: PJrPFGovFGzN2qJ8PKF3j6/5an0R0RshfCqH8sRF+JO1iG/Z10hxjd+Bp8s6zNy9cQjgpabvqp CWbpPdgVrVsHf/C+OJ8aLccNpdSK/3cGJ939UYowDVC5apDhod/kyJSxka/OhyRFDeAlKNwqmP NWEn0CzlouR225Dfx3qhJ9Fx3GXPnPn9ZGKryTsXcOp3LCb5+QZVnx+TqTmKH/oTDVcuO/Cktk 0DVUjdAG8Gxwd+EZndLgvVd94VlWlrR64VH3ln648z4NrgM/Ye7KUDQA2Glyrz3n7Tdbm18NNi B/A= Subject: Re: [Patch] Fortran: Avoid var initialization in interfaces [PR54753] To: Tobias Burnus , gcc-patches , fortran Newsgroups: gmane.comp.gcc.patches,gmane.comp.gcc.fortran References: <40ee9c33-3122-54aa-a43b-655bb280b7fc@codesourcery.com> From: Sandra Loosemore Message-ID: <0131e2d5-be68-d3b1-b90f-6640c358e1ab@codesourcery.com> Date: Sat, 2 Oct 2021 12:01:40 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0 MIME-Version: 1.0 In-Reply-To: <40ee9c33-3122-54aa-a43b-655bb280b7fc@codesourcery.com> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-ClientProxiedBy: SVR-ORW-MBX-09.mgc.mentorg.com (147.34.90.209) To svr-orw-mbx-04.mgc.mentorg.com (147.34.90.204) X-Spam-Status: No, score=-4.5 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, NICE_REPLY_A, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 Oct 2021 18:01:51 -0000 On 9/29/21 2:53 AM, Tobias Burnus wrote: > Found when looking at F2018:C839 / PR54753. > > For INTENT(OUT) the dummy variable (might) also be default initialized > or deallocated. However, with assumed rank, that causes issues, which > C839 prevents. In the current GCC implementation, missing C839 constraint > diagnostic, but also rejects-valid/ice-on-valid appears. > > There are three issues, this patch solves the first: > > * reject-valid issue due to adding the initializer also to a dummy >   argument which is in an INTERFACE block. Having initializers in >   INTERFACE blocks is pointless and causes for the attached testcase >   the bogus error: >   "Assumed-rank variable y at (1) may only be used as actual argument" > > (Except for wasting resources and this error, they should be ignored > in trans*.c and usually do not cause any further harm.) > > > I think Sandra has a nearly ready patch to do the C839 constraint > diagnostic, which needs the attached patch to do the checks. > > The third issue is that GCC currently gives either an ICE or the > above error message when declaring a procedure with a valid > assumed-rank intent(out) dummy. This has still to be solved as well. > But first I wanted to unblock Sandra's C839 work with this patch :-) This has indeed allowed me to make progress on adding the diagnostic, but I'm seeing some test regressions on x86_64-linux-gnu that are due to this patch alone: FAIL: gfortran.dg/default_initialization_3.f90 -O0 execution test FAIL: gfortran.dg/default_initialization_3.f90 -O1 execution test FAIL: gfortran.dg/default_initialization_3.f90 -O2 execution test FAIL: gfortran.dg/default_initialization_3.f90 -O3 -fomit-frame-pointer -funroll-loops -fpeel-loops -ftracer -finline-functions execution test FAIL: gfortran.dg/default_initialization_3.f90 -O3 -g execution test FAIL: gfortran.dg/default_initialization_3.f90 -Os execution test It is failing with STOP 5, so I guess it is over-eagerly removing initialization in something that is not an interface. BTW, I think it would be better to open a new issue for this and the "third issue" you describe for this than to tag them with PR54753, since these initialization bugs aren't really related to the missing diagnostic in that issue except so far as the bogus error/crashes make it impossible to test for the missing diagnostic. Personally, I find it really confusing to track which bugs have really been fixed when multiple bugs that need different fixes are lumped together in the same issue... there might be patches committed for such a mashed-up issue, but which parts have been fixed and which not, and when is it safe to close the issue? :-S -Sandra