This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
Symbols and FL_PARAMETER in "interface; subroutine" versus "contains; subroutine"
- From: Tobias Burnus <burnus at net-b dot de>
- To: "'fortran at gcc dot gnu dot org'" <fortran at gcc dot gnu dot org>
- Date: Wed, 15 Nov 2006 22:23:43 +0100
- Subject: Symbols and FL_PARAMETER in "interface; subroutine" versus "contains; subroutine"
Hi all,
when I implemented IMPORT I missed to check two cases, which promptly
don't work:
(as the example by Harald Anlauf in comment 0 in PR27546 actually
triggers this, this is really my fault)
a) "import :: items" in an interface which is part of a _module_
(otherwise importing of an derived type works, also for module-defined
derived types)
b) Import of constants used in kind expressions.
while for (a) I have a (hopefully correct) idea, I'd like to get some
pointers for (b) since I don't know at which routine of all the *.c
files to look.
Example for (b):
integer, parameter :: dp = 4
interface
subroutine foo(a)
import
real(dp) :: a
end subroutine foo
end interface
end
The "import" only disables the check whether a symbol is in the
interface namespace or not
(in decl.c's variable_decl).
What I currently don't see is the difference between a subroutine in an
interface block and a subroutine in "contains" in the same program. In
the latter case it works, in the former case it ends up in expr.c's
check_init_expr
case EXPR_VARIABLE:
if (e->symtree->n.sym->attr.flavor == FL_PARAMETER)
{
t = simplify_parameter_variable (e, 0);
break;
}
gfc_error ("Parameter '%s' at %L has not been declared or is "
where it fails as FL_PARAMETER does not match, even though "dp" is a
parameter.
I somehow fail to see how this symbol gets propagated or, respectively,
where it gets resolved for subroutines (thus I can do the same for
"subroutine"s in interfaces).
Thanks for any pointer,
Tobias