public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "burnus at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/54389] New: [F2003/F2008 difference] PURE functions and pointer dummy arguments Date: Tue, 28 Aug 2012 08:10:00 -0000 [thread overview] Message-ID: <bug-54389-4@http.gcc.gnu.org/bugzilla/> (raw) http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54389 Bug #: 54389 Summary: [F2003/F2008 difference] PURE functions and pointer dummy arguments Classification: Unclassified Product: gcc Version: 4.8.0 Status: UNCONFIRMED Keywords: diagnostic, rejects-valid Severity: normal Priority: P3 Component: fortran AssignedTo: unassigned@gcc.gnu.org ReportedBy: burnus@gcc.gnu.org Broad up in the comp.lang.fortran "Function questions?" thread https://groups.google.com/forum/?fromgroups=#!topic/comp.lang.fortran/r4PVbtaBnFM Ian Harvey remarks there that Fortran 2008 removed a restriction regarding PURE. Fortran 2003 has: "C1272 In a pure subprogram any designator with a base object that [...] is a dummy argument of a pure function, is a dummy argument with INTENT (IN) of a pure subroutine [...] shall not be used in the following contexts: [...]" Fortran 2008 changed it to: "C1283 In a pure subprogram any designator with a base object that [...] is a dummy argument with the INTENT (IN) attribute [...] shall not be used [...]" Note: Both standards (F2003:C1266, F2008:C1276) require that all *nonpointer* dummy arguments to pure *functions* have the INTENT(IN) or VALUE attribute. However, there is no such restriction for pointers. Hence, an INTENT(OUT) or INTENT(INOUT) pointer is allowed - also for functions - and it may be used in pointer assignments (both sides), variable definition contexts etc. - like in a normal procedure. Currently, the following program is rejected with: Error: Variable 'ptr' can not appear in a variable definition context (assignment) at (1) in PURE procedure (As a side remark: I wonder whether it should be made clearer that this applies to a pure FUNCTION rather than to a pure SUBROUTINE. And the error message feels a bit incomplete, maybe one should add the procedure name at the end.) PURE INTEGER FUNCTION foo (ptr) INTEGER, INTENT(INOUT), POINTER :: ptr ptr = ptr + 1 foo = 1 END FUNCTION foo
next reply other threads:[~2012-08-28 8:10 UTC|newest] Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top 2012-08-28 8:10 burnus at gcc dot gnu.org [this message] 2012-08-28 8:40 ` [Bug fortran/54389] [F2003/F2008 difference] PURE functions and pointer dummy arguments / DECL_PURE_P issue burnus at gcc dot gnu.org 2012-08-28 18:18 ` burnus at gcc dot gnu.org 2012-09-12 10:01 ` Joost.VandeVondele at mat dot ethz.ch 2012-09-12 10:30 ` burnus at gcc dot gnu.org 2012-09-13 19:49 ` burnus at gcc dot gnu.org 2015-10-20 14:14 ` dominiq at lps dot ens.fr 2024-04-22 19:45 ` anlauf at gcc dot gnu.org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-54389-4@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).