This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug fortran/49436] Modifying actual arguments in subroutine not detected


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

janus at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |janus at gcc dot gnu.org

--- Comment #1 from janus at gcc dot gnu.org 2011-06-16 12:00:52 UTC ---
(In reply to comment #0)
> 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).

I guess you refer to this part:


(2) If the value of any part of the entity is affected through the dummy
argument, then at any time during the execution of the procedure, either before
or after the deïnition, it may be referenced only through that dummy argument
unless
(a) the dummy argument has the POINTER attribute,
(b) the part is all or part of a pointer subobject, or
(c) the dummy argument has the TARGET attribute, the dummy argument does not
have INTENT (IN), the dummy argument is a scalar object or an assumed-shape
array, and the actual argument is a target other than an array section with a
vector subscript.


And indeed I would interpret it in the same way as you do. However, the
question is whether the standard requires the *compiler* to enforce this
restriction, or if it is simply a restriction that the programmer is supposed
to follow.

Are you aware of any compiler which enforces this restriction?


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]