[Bug fortran/69695] slice of an array retains pointer attribute
mikael at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Sun Feb 7 18:55:00 GMT 2016
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69695
Mikael Morin <mikael at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords|accepts-invalid |wrong-code
CC| |mikael at gcc dot gnu.org
--- Comment #2 from Mikael Morin <mikael at gcc dot gnu.org> ---
(In reply to Joost VandeVondele from comment #0)
> However, the underlying problem is that gfortran doesn't generate a compile
> time error, as the array slice is passed to a subroutine that expects a
> pointer argument.
This seems to be allowed, see 12.5.2.7:
If the dummy argument does not have INTENT (IN), the actual argument shall be a
pointer. Otherwise, the
actual argument shall be a pointer or a valid target for the dummy pointer in a
pointer assignment statement.
Only the target attribute is required, and a(:,2) has the target attribute.
The program is properly rejected with -std=f2003.
So this is probably a plain wrong-code bug.
More information about the Gcc-bugs
mailing list