This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] PR fortran/91513 -- Fix poorly worded error message


In PR fortran/91513, Damian Rouson points out that the Fortran
does contain the words "impure variable".  Damian and I spent
an afternoon together a few weeks ago where I gave Damian a
world wind view of how I see gcc/fortran and go about debugging
problems.  Damian and I both have full schedules, but I was
hoping he would submit the patch to the list.  My time of 
fixing gfortran bugs is running out, so ...

OK to commit?

2019-09-29  Damian Rouson  <damain@sourceryinstitue.org>

	PR fortran/91513
	* resolve.c (resolve_ordinary_assign): Improved error message.

2019-09-29  Damian Rouson  <damain@sourceryinstitue.org>

	PR fortran/91513
	* gfortran.dg/impure_assignment_2.f90: Update dg-error regex.

-- 
Steve
Index: gcc/fortran/resolve.c
===================================================================
--- gcc/fortran/resolve.c	(revision 276269)
+++ gcc/fortran/resolve.c	(working copy)
@@ -10774,9 +10774,12 @@ resolve_ordinary_assign (gfc_code *code, gfc_namespace
 			"component in a PURE procedure",
 			&rhs->where);
 	  else
-	    gfc_error ("The impure variable at %L is assigned to "
-			"a derived type variable with a POINTER "
-			"component in a PURE procedure (12.6)",
+	  /* F2008, C1283 (4).  */
+	    gfc_error ("In a pure subprogram an INTENT(IN) dummy argument "
+			"shall not be used as the expr at %L of an intrinsic "
+			"assignment statement in which the variable is of a "
+			"derived type if the derived type has a pointer "
+			"component at any level of component selection.",
 			&rhs->where);
 	  return rval;
 	}
Index: gcc/testsuite/gfortran.dg/impure_assignment_2.f90
===================================================================
--- gcc/testsuite/gfortran.dg/impure_assignment_2.f90	(revision 276269)
+++ gcc/testsuite/gfortran.dg/impure_assignment_2.f90	(working copy)
@@ -40,7 +40,7 @@ CONTAINS
   PURE FUNCTION give_next3(node)
      TYPE(node_type), intent(in) :: node
      TYPE(node_type) :: give_next
-     give_next = node ! { dg-error "impure variable" }
+     give_next = node ! { dg-error "pure subprogram" }
   END FUNCTION
 END MODULE pr20863
 

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]