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] [F2003/F2008 difference] PURE functions and pointer dummy arguments / DECL_PURE_P issue
Date: Tue, 28 Aug 2012 08:40:00 -0000	[thread overview]
Message-ID: <bug-54389-4-B3ejKsILjg@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-54389-4@http.gcc.gnu.org/bugzilla/>

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54389

Tobias Burnus <burnus at gcc dot gnu.org> 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 <burnus at gcc dot gnu.org> 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;


  reply	other threads:[~2012-08-28  8:40 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-28  8:10 [Bug fortran/54389] New: [F2003/F2008 difference] PURE functions and pointer dummy arguments burnus at gcc dot gnu.org
2012-08-28  8:40 ` burnus at gcc dot gnu.org [this message]
2012-08-28 18:18 ` [Bug fortran/54389] [F2003/F2008 difference] PURE functions and pointer dummy arguments / DECL_PURE_P issue 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-B3ejKsILjg@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: link
Be 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).