public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "tkoenig at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/64958] Warn if INTENT(IN) is changed by passing to no-intent argument
Date: Fri, 06 Feb 2015 14:04:00 -0000	[thread overview]
Message-ID: <bug-64958-4-3p0ZN5B2ES@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-64958-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64958

--- Comment #3 from Thomas Koenig <tkoenig at gcc dot gnu.org> ---
If it is forbidden to modify an actual argument, we could make
a tempoary copy of that argument, pass that to a procedure where
it maches an intent(unknown) dummy argument, then do the comparison.

So, we would replace

subroutine bar(n)
  integer, intent(in) :: n
  call dusty(n)
end subroutine bar

with

subroutine bar(n)
  integer, intent(in) :: n
  integer :: shadow_n

  shadow_n = n
  call dusty(shadow_n)
  if (n /= shadow_n) call _gfortran_runtime_error("bletchful")
end subroutine bar

where dusty has no explicit interface or the first dummy argument
of dusty has unknown intent.

It would probably make most sense for scalar intrinsic types inculding
character variables.  Arrays of intrinsic types might also be a possibility,
but with decreasing return on investment, so to speak.


  parent reply	other threads:[~2015-02-06 14:04 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-06 12:45 [Bug fortran/64958] New: " tkoenig at gcc dot gnu.org
2015-02-06 12:45 ` [Bug fortran/64958] " tkoenig at gcc dot gnu.org
2015-02-06 13:08 ` tkoenig at gcc dot gnu.org
2015-02-06 13:33 ` burnus at gcc dot gnu.org
2015-02-06 14:04 ` tkoenig at gcc dot gnu.org [this message]
2015-03-06 13:52 ` dominiq at lps dot ens.fr

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-64958-4-3p0ZN5B2ES@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).