From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20171 invoked by alias); 28 Aug 2012 08:40:11 -0000 Received: (qmail 20159 invoked by uid 22791); 28 Aug 2012 08:40:09 -0000 X-SWARE-Spam-Status: No, hits=-4.3 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00,KHOP_THREADED X-Spam-Check-By: sourceware.org Received: from localhost (HELO gcc.gnu.org) (127.0.0.1) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 28 Aug 2012 08:39:56 +0000 From: "burnus at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/54389] [F2003/F2008 difference] PURE functions and pointer dummy arguments / DECL_PURE_P issue Date: Tue, 28 Aug 2012 08:40:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: fortran X-Bugzilla-Keywords: diagnostic, rejects-valid, wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: burnus at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Keywords CC Summary Message-ID: In-Reply-To: References: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2012-08/txt/msg01840.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54389 Tobias Burnus changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |wrong-code CC| |burnus at gcc dot gnu.org Summary|[F2003/F2008 difference] |[F2003/F2008 difference] |PURE functions and pointer |PURE functions and pointer |dummy arguments |dummy arguments / | |DECL_PURE_P issue --- Comment #1 from Tobias Burnus 2012-08-28 08:39:54 UTC --- Post script: I think one can argue that the F2008 change makes sense: If one has specified INTENT(OUT)/INTENT(INOUT), it doesn't make sense to treat it as INTENT(IN). Additionally, the pointer attribute of the actual and dummy argument already ensures that certain alias issues do not occur. (I looked at the Fortran 2003 corrigenda 1 to 5 and at the Fortran 2008 corrigendum 1 - and at some IR, but I couldn't find anything relevant there.) I am not 100% sure whether it matches with DECL_PURE_P. It actually doesn't seems so do so: DECL_PURE_P This predicate holds if the function can only read its arguments, but may also read global memory. Hence, we need to be careful with it for declaring (implicitly) pure functions. * * * Side note: The following code is wrong due to IMPURE ELEMENTAL: if (sym->attr.pure || sym->attr.elemental) { if (sym->attr.function && !gfc_return_by_reference (sym)) DECL_PURE_P (fndecl) = 1;