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

Steve Kargl sgk@troutmask.apl.washington.edu
Sat Oct 12 07:00:00 GMT 2019


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
>  


-- 
Steve
20170425 https://www.youtube.com/watch?v=VWUpyCsUKR4
20161221 https://www.youtube.com/watch?v=IbCHE-hONow



More information about the Gcc-patches mailing list