[Patch, Fortran, F08] PR 85537: Invalid memory reference at runtime when calling subroutine through procedure pointer

Steve Kargl sgk@troutmask.apl.washington.edu
Wed Mar 27 21:51:00 GMT 2019


On Wed, Mar 27, 2019 at 10:35:33PM +0100, Janus Weil wrote:
> 
> the attached patch implements some missing constraints from Fortran
> 2008 concerning procedure pointer initialization (cf. the standard
> quote in comment #18), thus fixing two accepts-invalid and
> ICE-on-invalid problems.
> 
> It regtests cleanly on x86_64-linux-gnu. Ok for trunk?

Looks OK to me.  Just minor comment.  If there are numbered
constraints in either F2008 or F2018 for each of the if()
conditionals, can you add a comment.  Perhaps, something
like.

         /* F2008:C1089. */
> +      if (attr.proc == PROC_INTERNAL)
> +	{
> +	  gfc_error ("Internal procedure %qs is invalid in "
> +		     "procedure pointer initialization at %L",
> +		     rvalue->symtree->name, &rvalue->where);
> +	  return false;
> +	}

         /* F2008:C1142. */
> +      if (attr.dummy)
> +	{
> +	  gfc_error ("Dummy procedure %qs is invalid in "
> +		     "procedure pointer initialization at %L",
> +		     rvalue->symtree->name, &rvalue->where);
> +	  return false;
> +	}
>      }

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



More information about the Fortran mailing list