This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/71859] ICE on same variable/subroutine name (verify_gimple failed)
- From: "kargl at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 13 Jul 2016 18:35:49 +0000
- Subject: [Bug fortran/71859] ICE on same variable/subroutine name (verify_gimple failed)
- Auto-submitted: auto-generated
- References: <bug-71859-4@http.gcc.gnu.org/bugzilla/>
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);