[gfortran] Fix NULL reference types.

Toon Moene toon@moene.indiv.nluug.nl
Thu Aug 19 21:34:00 GMT 2004


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:

INTENT(INOUT):
	The actual argument has to be valid for reading and
	writing.

INTENT(OUT):
	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).

Hope this helps,

-- 
Toon Moene - mailto:toon@moene.indiv.nluug.nl - phoneto: +31 346 214290
Saturnushof 14, 3738 XG  Maartensdijk, The Netherlands
Maintainer, GNU Fortran 77: http://gcc.gnu.org/onlinedocs/g77_news.html
A maintainer of GNU Fortran 95: http://gcc.gnu.org/fortran/



More information about the Gcc-patches mailing list