re PR fortran/16861 ([4.0 only] segfault with doubly used module)
PR fortran/16861
* resolve.c (resolve_variable): If e->symtree is not set, this
ought to be a FAILURE, and not a segfault.
* gfortran.dg/pr16861.f90: New test.
From-SVN: r98391
diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c
index 16db943..d75704b 100644
--- a/gcc/fortran/resolve.c
+++ b/gcc/fortran/resolve.c
@@ -2111,6 +2111,9 @@
if (e->ref && resolve_ref (e) == FAILURE)
return FAILURE;
+ if (e->symtree == NULL)
+ return FAILURE;
+
sym = e->symtree->n.sym;
if (sym->attr.flavor == FL_PROCEDURE && !sym->attr.function)
{