2013-05-28 Dominique d'Humieres <dominiq@lps.ens.fr>
PR fortran/57435
* module.c (check_for_ambiguous): Avoid null pointer deref.
2013-05-28 Tobias Burnus <burnus@net-b.de>
PR fortran/57435
* testsuite/gfortran.dg/use_29.f90: New.
@@ -4530,7 +4530,7 @@ check_for_ambiguous (gfc_symbol *st_sym, pointer_info *info)
module_locus locus;
symbol_attribute attr;
- if (st_sym->name == gfc_current_ns->proc_name->name)
+ if (gfc_current_ns->proc_name && st_sym->name == gfc_current_ns->proc_name->name)
{
gfc_error ("'%s' of module '%s', imported at %C, is also the name of the "
"current program unit", st_sym->name, module_name);
@@ -0,0 +1,15 @@
+! { dg-do compile }
+!
+! PR fortran/57435
+!
+! Contributed by Lorenz Hüdepohl
+!
+module precision
+end module precision
+ contains
+ use precision ! { dg-error "Unexpected USE statement in CONTAINS section" }
+module stressten_rt ! { dg-error "Unexpected MODULE statement in CONTAINS section" }
+ use precision ! { dg-error "Unexpected USE statement in CONTAINS section" }
+ implicit none ! { dg-error "Unexpected IMPLICIT NONE statement in CONTAINS section" }
+
+! { dg-error "Unexpected end of file" "" { target "*-*-*" } 0 }