https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121805
--- Comment #9 from federico ---
Thank you Mikael and Steve. Because it works, I tried an array->array pointer
with the same byte pattern:
```
program pointer_array_to_array
integer, target :: idx(16), i, array_sum
integer, pointer :: dd(
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121805
--- Comment #8 from kargls at comcast dot net ---
(In reply to Mikael Morin from comment #6)
> (In reply to kargls from comment #3)
> >idx = [(i,i=1,8)]
> >e%data = idx
> >dd=>e%data
> >array_sum = sum(idx(dd))
> ...
> >
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121805
--- Comment #7 from Mikael Morin ---
(In reply to federico from comment #5)
>
> from my limited understanding the array version does not have a `dd.offset +
> ` term that was set as `dd.offset = -1;`,
This is expected.
offset is used for user i
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121805
Mikael Morin changed:
What|Removed |Added
CC||mikael at gcc dot gnu.org
--- Comment #6
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121805
--- Comment #5 from federico ---
Thanks a lot for checking this Steve. I re-enabled the loop version to see what
it does in the tree dump and I see
```
loop_sum = idx[(integer(kind=8)) *(integer(kind=4) *) (dd.data + (sizetype)
((dd.offset + (
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121805
--- Comment #4 from kargls at comcast dot net ---
(In reply to kargls from comment #3)
>
> program pointer_array_to_struct
>
>implicit none
>
>type str
> integer data
> integer(1) a
>end type
>
>type(str), target
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121805
kargls at comcast dot net changed:
What|Removed |Added
CC||kargls at comcast dot net
--
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121805
--- Comment #2 from federico ---
A far simpler test program:
```
program pointer_array_to_struct
implicit none
type :: str
integer :: data
integer(1) :: a
end type
type(str), target :: e(8)
integer :: i,j,arra
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121805
--- Comment #1 from federico ---
the error is triggered only when the target's data is strided from a structure
array:
```
ptr(1:n) => structure%arr(1:n)%i ! issue
```
and not when the target's data is an array already:
```
ptr(1:n) => struct