The attached patch (originally by Steve Kargl) fixes a NULL pointer
dereference that may occur when checking for a conflict.
Regtested successfully.
OK for trunk? Backport to active branches?
Thanks,
Harald
2019-03-02 Harald Anlauf <[email protected]>
Steve Kargl <[email protected]>
PR fortran/77583
* symbol.c (check_conflict): Check for valid procedure name
passed to error reporting routine.
2019-03-02 Harald Anlauf <[email protected]>
PR fortran/77583
* gfortran.dg/pr77583.f90: New test.
Index: gcc/fortran/symbol.c
===================================================================
--- gcc/fortran/symbol.c (revision 269332)
+++ gcc/fortran/symbol.c (working copy)
@@ -525,7 +525,7 @@
/* 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))
Index: gcc/testsuite/gfortran.dg/pr77583.f90
===================================================================
--- gcc/testsuite/gfortran.dg/pr77583.f90 (nonexistent)
+++ gcc/testsuite/gfortran.dg/pr77583.f90 (working copy)
@@ -0,0 +1,10 @@
+! { dg-do compile }
+!
+! PR fortran/77583 - ICE in pp_quoted_string, at pretty-print.c:966
+! Contributed by Gerhard Steinmetz <[email protected]>
+
+pure subroutine sub(s)
+contains
+ pure subroutine s ! { dg-error "conflicts with DUMMY argument" }
+ end
+end