public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/49436] New: Modifying actual arguments in subroutine not detected
@ 2011-06-16 11:13 tjf at rsc dot anu.edu.au
  2011-06-16 12:01 ` [Bug fortran/49436] " janus at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: tjf at rsc dot anu.edu.au @ 2011-06-16 11:13 UTC (permalink / raw)
  To: gcc-bugs

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

           Summary: Modifying actual arguments in subroutine not detected
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: tjf@rsc.anu.edu.au
              Host: i686-pc-linux-gnu


Created attachment 24544
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=24544
Nonconforming code that compiles happily

There's an aspect of the f95 standard that seems to not be enforced by
gfortran.

As I interpret it, the standard says that if an object passed as an actual
argument is also accessible in a subprogram through other means, then this can
only be modified through the corresponding dummy argument (12.4.1.6).

The attached code violates this by modifying a directly inside subroutine c,
rather than through the dummy argument n.  With gfortran 4.6.0 on
i686-pc-linux-gnu this nonconforming code compiles happily, even with -Wall
-std=f95 -pedantic.

When run, two 15s are printed despite the value 2 being passed as intent(in)
(clearly the argument is passed by reference).


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-06-16 16:34 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-06-16 11:13 [Bug fortran/49436] New: Modifying actual arguments in subroutine not detected tjf at rsc dot anu.edu.au
2011-06-16 12:01 ` [Bug fortran/49436] " janus at gcc dot gnu.org
2011-06-16 12:04 ` burnus at gcc dot gnu.org
2011-06-16 16:34 ` kargl at gcc dot gnu.org

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).