diff mbox series

PR fortran/91513 -- Fix poorly worded error message

Message ID 20191012045615.GA1772@troutmask.apl.washington.edu
State New
Headers show
Series PR fortran/91513 -- Fix poorly worded error message | expand

Commit Message

Steve Kargl Oct. 12, 2019, 4:56 a.m. UTC
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.

Comments

Steve Kargl Oct. 12, 2019, 4:58 a.m. UTC | #1
On Fri, Oct 11, 2019 at 09:56:15PM -0700, Steve Kargl wrote:
> In PR fortran/91513, Damian Rouson points out that the Fortran
> does contain the words "impure variable".

Geez. That is a messed up sentence.

In PR fortran/91513, Damian Rouson points out that the Fortran
*standard* does *not* contain the words "impure variable.

(It's late, and I'm tired!)

>  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
>
Janne Blomqvist Oct. 12, 2019, 7:35 a.m. UTC | #2
On Sat, Oct 12, 2019 at 7:58 AM Steve Kargl
<sgk@troutmask.apl.washington.edu> wrote:
>
> On Fri, Oct 11, 2019 at 09:56:15PM -0700, Steve Kargl wrote:
> > In PR fortran/91513, Damian Rouson points out that the Fortran
> > does contain the words "impure variable".
>
> Geez. That is a messed up sentence.
>
> In PR fortran/91513, Damian Rouson points out that the Fortran
> *standard* does *not* contain the words "impure variable.
>
> (It's late, and I'm tired!)
>
> >  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

Ok
diff mbox series

Patch

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