From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ciao.gmane.io (ciao.gmane.io [116.202.254.214]) by sourceware.org (Postfix) with ESMTPS id 0A1D33858C60 for ; Wed, 29 Sep 2021 20:10:32 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 0A1D33858C60 Received: from list by ciao.gmane.io with local (Exim 4.92) (envelope-from ) id 1mVfuQ-0004qG-PE for gcc-patches@gcc.gnu.org; Wed, 29 Sep 2021 22:10:30 +0200 X-Injected-Via-Gmane: http://gmane.org/ To: gcc-patches@gcc.gnu.org From: Harald Anlauf Subject: Re: [Patch] Fortran: Avoid var initialization in interfaces [PR54753] Date: Wed, 29 Sep 2021 22:10:25 +0200 Message-ID: References: <40ee9c33-3122-54aa-a43b-655bb280b7fc@codesourcery.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.12.0 In-Reply-To: <40ee9c33-3122-54aa-a43b-655bb280b7fc@codesourcery.com> Content-Language: en-US Cc: fortran@gcc.gnu.org X-Spam-Status: No, score=-2.9 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, NICE_REPLY_A, SPF_HELO_NONE, 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: Wed, 29 Sep 2021 20:10:33 -0000 Hi Tobias, Am 29.09.21 um 10:53 schrieb Tobias Burnus: > 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" ACK. > (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 :-) > > > Regarding the patch, '!= IFSRC_IFBODY' has to be used; "== IFSRC_DECL" > won't work as the the generatedy ENTRY master function has IFSRC_UNKNOWN. I have to admit that the code touched is hard to understand for me. The conditions involved are unfortunately already dense, long lists. (There are PRs related to *missing* default initializations (e.g. PR100440), which I looked at before in that area until I got lost... Of course this needs to be addressed elsewhere.) > OK for mainline? No objections here; the patch seems to work. The commit message has a non-ASCII character (hyphen). Not sure whether that was intended. You may nevertheless want a second opinion. Thanks for the patch! Harald > Tobias > > PS: Some patch reviews are that fast that it is impossible to send the OK; > at least, I did not manage to do for Harald's last two - for the last one > I was at least 4min too late. ;-) > > ----------------- > Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstraße 201, > 80634 München; Gesellschaft mit beschränkter Haftung; Geschäftsführer: > Thomas Heurung, Frank Thürauf; Sitz der Gesellschaft: München; > Registergericht München, HRB 106955