https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71859
--- Comment #4 from kargl at gcc dot gnu.org --- (In reply to Gerhard Steinmetz from comment #0) > When using the same name for a variable and a subroutine (invalid), > experimental (--enable-checking=yes) versions 7, 6 and maybe older > ones (not tested) give an ICE. > No ICE for release versions 4.9, 5, 6, 7. > > > $ cat z1.f90 > program p > call s(1) > x = abs(s) > end > subroutine s(n) > print *, n > end > Index: check.c =================================================================== --- check.c (revision 238185) +++ check.c (working copy) @@ -72,6 +72,11 @@ type_check (gfc_expr *e, int n, bt type) static bool numeric_check (gfc_expr *e, int n) { + /* Users sometime use a subroutine designator as an actual argument to + an intrinsic subprogram that expects an argument with a numeric type. */ + if (e->symtree->n.sym->attr.subroutine) + goto bandaid; + if (gfc_numeric_ts (&e->ts)) return true; @@ -86,6 +91,8 @@ numeric_check (gfc_expr *e, int n) return true; } +bandaid: + gfc_error ("%qs argument of %qs intrinsic at %L must be a numeric type", gfc_current_intrinsic_arg[n]->name, gfc_current_intrinsic, &e->where);