On 11/20/19 10:35 PM, Thomas König wrote:
I haven't run any actual benchmarks.
I think it would be interesting – I think there can be quite some
advantages in some cases, while in most cases, it is not really noticable.
Of course, Fortran language rules specify that the call to bar cannot
do anything to n, but apparently we do not tell the gcc middle end
that this is the case, or maybe that there is no way to really specify
this.
To my knowledge, the ME does not support the Fortran semantics but
assumes that once a pointer escapes in one procedure call, any other
procedure might have access to it and modify it as well. This matches
(effectively) the Fortran semantics of asynchronous. See also PR 49733.
The only thing we can do currently is to specify the intent via 'fn
spec' which helps a bit – but not if the pointer has already escaped.
Maybe we should think again about handling this properly in the ME.
Cheers,
Tobias