http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53537
Tobias Burnus <burnus at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2012-05-31
CC| |burnus at gcc dot gnu.org
Target Milestone|--- |4.5.4
Summary|Abstract interface with |[4.5/4.6/4.7/4.8
|import interferes with |Regression] Explicit IMPORT
|only-clause |of renamed USE-associated
| |symbol fails
Ever Confirmed|0 |1
--- Comment #1 from Tobias Burnus <burnus at gcc dot gnu.org> 2012-05-31
15:11:32 UTC ---
Confirmed. The ingredients are:
- The use associated symbol is renamed
- IMPORT explicitly lists the renamed symbol
The following program compiles with GCC 4.3 and 4.4 but not with
4.5/4.6/4.7/4.8:
Error: Parameter 'wp' at (1) has not been declared or is a variable, which does
not reduce to a constant expression
At the "IMPORT :: wp" line (gfc_match_import), the "wp" is found and gets
imported as st->name == "dp", st->n.sym->name == "dp". In check_init_expr,
e->symtree->n.sym is a FL_VARIABLE with name "wp".
module select_precision
integer, parameter :: dp = kind(1.0)
end module select_precision
module ode_types
use select_precision, only: wp => dp
implicit none
interface
subroutine ode_derivative(x)
import :: wp
real(wp) :: x
end subroutine ode_derivative
end interface
end module ode_types
Draft patch (lightly tested):
--- a/gcc/fortran/decl.c
+++ b/gcc/fortran/decl.c
@@ -3188 +3188 @@ gfc_match_import (void)
- if (gfc_find_symtree (gfc_current_ns->sym_root,name))
+ if (gfc_find_symtree (gfc_current_ns->sym_root, name))
@@ -3195 +3195 @@ gfc_match_import (void)
- st = gfc_new_symtree (&gfc_current_ns->sym_root, sym->name);
+ st = gfc_new_symtree (&gfc_current_ns->sym_root, name);