How to express the fact that arguments don't escape?
Richard Guenther
richard.guenther@gmail.com
Sat Aug 15 09:46:00 GMT 2009
2009/8/15 Tobias Schlüter <tobias.schlueter@physik.uni-muenchen.de>:
>
> Hi,
>
> I reviewed some old discussions on argument passing, but I found nothing
> which addressed a seemingly simple optimization for Fortran: what I would
> like to see is a way to tell the compiler that a function argument (which
> will be a pointer) will not have escaped after the function has returned.
> I.e.
> call f(i)
> i = 1
> call g(j) ! won't know about i
> if (i != 1) then
> can't happen
> end if
>
> Is there a way to do this? Unless I'm mistaken, this assumption holds for
> all non-POINTER arguments.
The only way to do this currently is to mark the function const. But that's
obviously a bad idea if it has any side-effects ;)
So, short answer - no, there is no way to do this currently. It's on my list of
things to investigate though.
It's of course one area where the Fortran choice of passing everything by
reference pessimizes it quite a bit compared to other frontends ...
Richard.
> Cheers,
> - Tobi
>
More information about the Fortran
mailing list