https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68768
vries at gcc dot gnu.org changed:
What|Removed |Added
Status|WAITING |RESOLVED
Resolution|--- |WONTFIX
--- Comment #3 from vries at gcc dot gnu.org ---
(In reply to Dominique d'Humieres from comment #2)
> Here again I don't understand your reference to -fno-cray-pointers (see
> pr68769 comment 1).
Right, as in pr68769, the reference comes from my lack of knowledge of fortran.
So please disregard this.
As I understand now, we can introduce aliases using equivalence and
pointer/target.
I didn't manage to make an example using equivalence (running into: Error:
EQUIVALENCE attribute conflicts with DUMMY attribute).
But here's an example using pointer/target:
...
subroutine subr6 (a)
implicit none
integer, parameter :: N = 1024
integer :: i
integer, target :: a(N)
integer, pointer :: b(:)
b => a
i = 0
!$omp parallel do
do i = 1, N
a(i) = b(i) + b(i)
end do
end subroutine
program main
implicit none
interface
subroutine subr6 (a)
implicit none
integer, target :: a(1024)
end subroutine subr6
end interface
integer, parameter :: n = 1024
integer, dimension (0:n-1) :: a
integer:: i
do i = 0, n - 1
a(i) = i * 2
end do
call subr6(a)
do i = 0, n - 1
if (a(i) .ne. i * 4) call abort
end do
end program main
...
Interestingly, that means that a is no longer a restrict pointer:
...
subr6 (integer(kind=4)[1024] * a)
...
So AFAIU, it is indeed safe (in the description field example) to redeclare a
and b with restrict in the thread function. It is somewhat fragile though,
since it assumes a certain type of code generation in the fortran front-end.
Marking it as resolved-wontfix.