This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/36271] [4.3 regression] Missed error with assignment to INTENT(IN) argument
- From: "burnus at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 20 May 2008 15:26:44 -0000
- Subject: [Bug fortran/36271] [4.3 regression] Missed error with assignment to INTENT(IN) argument
- References: <bug-36271-6318@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #2 from burnus at gcc dot gnu dot org 2008-05-20 15:26 -------
> Works for me with 4.4.0.
Well, it also "works" for me with 4.3.1 and 4.4.0 (in the sense that _no_ error
is shown).
However, I would claim that the program is valid as neither obs nor objs(n)%x
itself is changed, but only the target to which objs(n)%x points to.
For completeness, the program is also accepted by NAG f95, g95.
However, it is rejected by ifort, openf95 and sunf95.
gfortran changed when my pointer intent patch was checked in around January
2007. (see PR29624)
* * *
If a dummy argument is a derived-type object with a pointer component, then the
pointer as a pointer is a subobject of the dummy argument, but the target of
the pointer is not. Therefore, the restrictions on subobjects of the dummy
object apply to the pointer in contexts where it is used as a pointer, but not
in contexts where it is dereferenced to indicate its target.
Similarly, the INTENT restrictions on pointer dummy arguments apply only to the
association of the dummy argument; they do not restrict the operations allowed
on its target.
A pointer object with the INTENT (IN) attribute shall not appear as
(1) A pointer-object in a nullify-stmt,
(2) A data-pointer-object or proc-pointer-object in a pointer-assignment-stmt,
(3) An allocate-object in an allocate-stmt or deallocate-stmt, or
(4) An actual argument in a reference to a procedure if the associated dummy
argument is a pointer with the INTENT (OUT) or INTENT (INOUT) attribute.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36271