This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
Re: [patch][gomp4] openacc loops
- From: Tobias Burnus <burnus at net-b dot de>
- To: Janne Blomqvist <blomqvist dot janne at gmail dot com>, Cesar Philippidis <cesar at codesourcery dot com>
- Cc: "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>, Fortran List <fortran at gcc dot gnu dot org>, Jakub Jelinek <jakub at redhat dot com>, i dot usmanov at samsung dot com, thomas at codesourcery dot com
- Date: Thu, 05 Jun 2014 20:33:59 +0200
- Subject: Re: [patch][gomp4] openacc loops
- Authentication-results: sourceware.org; auth=none
- References: <538E538E dot 9010304 at codesourcery dot com> <CAO9iq9H7oyjjAmYUC=HTY00ZC=H-dzjfrzMXjs2iqRZr1MxPYQ at mail dot gmail dot com>
Janne Blomqvist wrote:
Fortran does not allow aliasing of dummy arguments,
That's not quite true: It permits aliasing variables (also without
TARGET or POINTER attribute) â but if you modify one, you may no longer
access the other, unless they do have the POINTER or TARGET attribute.
(See below for the formal description.)
so a compiler is allowed to optimize assuming aliasing does not occur.
The exception is dummy arguments with the POINTER attribute, those can
alias with other variables having the POINTER or TARGET attributes. So
an ALLOCATABLE variable can not alias with any other variable, unless
it has the TARGET attribute.
Well, two variables with TARGET attribute are also permitted to alias.
Tobias
PR: Now the same as above, but using a quote from Fortran 2008:
"12.5.2.13 Restrictions on entities associated with dummy arguments
While an entity is associated with a dummy argument, the following
restrictions hold.
(1) Action that affects the allocation status of the entity or a
subobject thereof shall be taken through the dummy argument.
(2) If the allocation status of the entity or a subobject thereof is
affected through the dummy argument,
then at any time during the invocation and execution of the procedure,
either before or after the allocation or deallocation, it shall be
referenced only through the dummy argument.
(3) Action that affects the value of the entity or any subobject of it
shall be taken only through the
dummy argument unless
(a) the dummy argument has the POINTER attribute or
(b) the dummy argument has the TARGET attribute, the dummy argument
does not have INTENT(IN), the dummy argument is a scalar object or an
assumed-shape array without the CONTIGUOUS attribute, and the actual
argument is a target other than an array section with a vector subscript.
(4) If the value of the entity or any subobject of it is affected
through the dummy argument, then at any time during the invocation and
execution of the procedure, either before or after the definition, it
may be referenced only through that dummy argument unless
(a) the dummy argument has the POINTER attribute or
(b) the dummy argument has the TARGET attribute, the dummy argument does
not have INTENT(IN), the dummy argument is a scalar object or an
assumed-shape array without the CONTIGUOUS attribute, and the actual
argument is a target other than an array section with a vector subscript."