This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/31229] New: kind parameter in function declaration fails to find use-associated parameters
- From: "brooks at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 16 Mar 2007 19:15:18 -0000
- Subject: [Bug fortran/31229] New: kind parameter in function declaration fails to find use-associated parameters
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
Bil Kleb posted the following code on comp.lang.fortran on 2007/3/16; Richard
Maine agreed that it is valid but pointed out that it's a consistent weak spot
in many compilers. I tested it on GFortran, and it does indeed fail here.
debian-gfortran:~/test> more kleb1.f90
module kinds
integer, parameter :: dp = selected_real_kind(15)
end module kinds
module test_undeclared_kind; contains
REAL(DP) function declared_dp_before_defined()
use kinds, only: dp
declared_dp_before_defined = 1.0_dp
end function
end module
debian-gfortran:~/test> ~/bin-trunk/bin/gfortran kleb1.f90
kleb1.f90:6.9:
REAL(DP) function declared_dp_before_defined()
1
Error: Parameter 'dp' at (1) has not been declared or is a variable, which does
not reduce to a constant expression
[...]
debian-gfortran:~/test> ~/bin-trunk/bin/gfortran --version
GNU Fortran (GCC) 4.3.0 20070316 (experimental)
--
Summary: kind parameter in function declaration fails to find
use-associated parameters
Product: gcc
Version: 4.3.0
Status: UNCONFIRMED
Keywords: rejects-valid
Severity: normal
Priority: P3
Component: fortran
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: brooks at gcc dot gnu dot org
GCC host triplet: i686-pc-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31229