------- Comment #3 from burnus at gcc dot gnu dot org 2007-07-24 13:28 ------- The following patch works for the original example; it also works in principle for the additional example, but there the error message is printed three times.
Index: gcc/fortran/expr.c =================================================================== --- gcc/fortran/expr.c (revision 126873) +++ gcc/fortran/expr.c (working copy) @@ -2397,6 +2397,15 @@ break; } + if (sym->attr.dummy && sym->ns->proc_name != NULL + && sym->ns->proc_name->attr.elemental) + { + gfc_error ("Dummy argument '%s' of elemental function '%s' " + "cannot appear in a specification expression at %L", + sym->name, sym->ns->proc_name->name, &e->where); + break; + } + /* gfc_is_formal_arg broadcasts that a formal argument list is being processed in resolve.c(resolve_formal_arglist). This is done so that host associated dummy array indices are accepted (PR23446). Index: gcc/fortran/resolve.c =================================================================== --- gcc/fortran/resolve.c (revision 126873) +++ gcc/fortran/resolve.c (working copy) @@ -3771,7 +3779,7 @@ if (!seen) { if (specification_expr) - gfc_error ("Variable '%s',used in a specification expression, " + gfc_error ("Variable '%s', used in a specification expression, " "is referenced at %L before the ENTRY statement " "in which it is a parameter", sym->name, &cs_base->current->loc); -- burnus at gcc dot gnu dot org changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |burnus at gcc dot gnu dot | |org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31259