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 :: e(8)
> 
>    integer i, array_sum
>    integer, pointer :: dd(:)
>    integer idx(8)
> 
>    idx = [(i,i=1,8)]
>    e%data = idx
>    dd=>e%data
>    array_sum = sum(idx(dd))

If one changes the above to sum(idx([dd])) then the code compiles and runs.
This forces a temporary variable to be created.

> 
>    if (array_sum /= 36) stop 1
> 
> end program

Reply via email to