[gfortran] Fix NULL reference types.

Paul Brook paul@codesourcery.com
Thu Aug 19 21:43:00 GMT 2004

On Thursday 19 August 2004 22:09, Toon Moene wrote:
> Paul Brook wrote:
> > On Thursday 19 August 2004 21:16, Toon Moene wrote:
> >>Paul Brook wrote:
> >>>On Thursday 19 August 2004 18:55, Daniel Jacobowitz wrote:
> >>>>I suspect we know that Fortran's reference types can't trap if they are
> >>>>non-NULL, also.  That might be nice to represent also.
> >>>
> >>>In Fortran they can trap on write, but not on read.
> >>
> >>Are you sure ? In a legal Fortran program you have to pass a legal
> >>(variable, array element, array) as an actual argument to a subprogram.
> >
> > The argument only has to be definable if you actually execute a statement
> > that defines the argument.
> That depends.  There are two cases:
> 	The actual argument has to be valid for reading and
> 	writing.
> 	The actual argument has to be valid to be written into.
> 	According to the standard it is made "undefined" when entering
> 	the subprogram, so you are not supposed to use it after it has
> 	*not* been defined (i.e., set) by the subprogram.
> 	I think this is just to much to assume to be checkable by the
> 	compiler (although full-program-analysis could detect it).

Right, in these two cases we can assume that writes don't trap. INTENT(IN) is 
a non-issue as we never write to those.

There is also the fourth case when the intent is not specified.
In this case the actual argument need be definable only if the dummy argument 
is redefined.

I guess it's arguable as to what this means.

A strict interpretation would be that the actual argument must be definable if 
the dummy argument is ever redefined.
Annother interpretation is that the actual argument only needs to be definable 
if the code path executed happens to redefine the dummy argument.


More information about the Gcc-patches mailing list