diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index 489ae1bc0cb4ea95ae28196e124de308d94d3e71..9f4234900b6880cc7fb3b6d9a3abd67381c52165 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,3 +1,10 @@
+2019-03-03  Harald Anlauf  <anlauf@gmx.de>
+	    Steven G. Kargl  <kargl@gcc.gnu.org>
+
+	PR fortran/77583
+	* symbol.c (check_conflict): Check for valid procedure name
+	passed to error reporting routine.
+
 2019-03-03  Thomas Koenig  <tkoenig@gcc.gnu.org>
 
 	PR fortran/72714
diff --git a/gcc/fortran/symbol.c b/gcc/fortran/symbol.c
index c8a1f842d353f877e0697162d4f7224c93344b0f..0eb413084d14bd4561966a893ffec0f438d77646 100644
--- a/gcc/fortran/symbol.c
+++ b/gcc/fortran/symbol.c
@@ -525,7 +525,7 @@ check_conflict (symbol_attribute *attr, const char *name, locus *where)
   /* The copying of procedure dummy arguments for module procedures in
      a submodule occur whilst the current state is COMP_CONTAINS. It
      is necessary, therefore, to let this through.  */
-  if (attr->dummy
+  if (name && attr->dummy
       && (attr->function || attr->subroutine)
       && gfc_current_state () == COMP_CONTAINS
       && !(gfc_new_block && gfc_new_block->abr_modproc_decl))
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index e7b54ea788216df7dff1cb8dd42a73d0ac509037..4e8fd0242cfbf8266c12a677e02810631e267c09 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2019-03-03  Harald Anlauf  <anlauf@gmx.de>
+
+	PR fortran/77583
+	* gfortran.dg/pr77583.f90: New test.
+
 2019-03-03  Thomas Koenig  <tkoenig@gcc.gnu.org>
 
 	PR fortran/72714
diff --git a/gcc/testsuite/gfortran.dg/pr77583.f90 b/gcc/testsuite/gfortran.dg/pr77583.f90
new file mode 100644
index 0000000000000000000000000000000000000000..c2ee074429777132890346c7b29162a9f5131f18
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/pr77583.f90
@@ -0,0 +1,10 @@
+! { dg-do compile }
+!
+! PR fortran/77583 - ICE in pp_quoted_string, at pretty-print.c:966
+! Contributed by Gerhard Steinmetz <gerhard.steinmetz.fortran@t-online.de>
+
+pure subroutine sub(s)
+contains
+   pure subroutine s  ! { dg-error "conflicts with DUMMY argument" }
+   end
+end