http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48821
Summary: IMPORT :: dummy_arg is rejected, while "IMPORT"
imports it
Product: gcc
Version: 4.7.0
Status: UNCONFIRMED
Keywords: rejects-valid
Severity: normal
Priority: P3
Component: fortran
AssignedTo: [email protected]
ReportedBy: [email protected]
>From the tread at
http://groups.google.com/group/comp.lang.fortran/browse_thread/thread/468cd06becef7494
The following program compiles with Open64 and PathScale 3.2.99, but it fails
with ifort 11.1 ("error #6485: Dummy args may not be used as IMPORT_name
entities [Y]") and with gfortran:
import :: Y
1
Error: Cannot IMPORT 'y' from host scoping unit at (1) - does not exist.
A simple "IMPORT" works.
>From F2008's "12.4.3.3 IMPORT statement": "The name of an entity made
accessible by an IMPORT statement shall not appear in any of the contexts
described in 16.5.1.4 that cause the host entity of that name to be
inaccessible."
I have not yet fully understood 16.5.1.4, but I am rather sure that the code is
valid -- however, one should check ...
Program by Daniel Carrera:
module types
integer, parameter :: pref = kind(0.0)
end module
use types
contains
pure subroutine rk4_vec(t, Y, dY, h)
real(pref), intent(inout) :: t, Y(:)
real(pref), intent(in) :: h
real(pref), dimension(size(Y)) :: k1, k2, k3, k4
interface
pure function dY(t0, y0)
use types
import :: Y
real(pref), intent(in) :: t0, y0(size(Y))
real(pref) :: dY(size(y0))
end function
end interface
k1 = dY(t, Y)
k2 = dY(t + h/2, Y + k1*h/2)
k3 = dY(t + h/2, Y + k2*h/2)
k4 = dY(t + h , Y + k3*h)
Y = Y + (k1 + 2*k2 + 2*k3 + k4) * h/6
t = t + h
end subroutine
end