https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113928
Bug ID: 113928
Summary: Aliasing of pointer in expression
Product: gcc
Version: 11.4.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
Assignee: unassigned at gcc dot gnu.org
Reporter: eddyg_61-bugzilla at yahoo dot it
Target Milestone: ---
I think that this program gives an erroneous result:
program wzerror
implicit none
integer, parameter :: N = 20
complex, target :: wz(N)
real, pointer :: wr(:)
integer :: i
wr => wz%re
wz = 0
wr = [(i,i=1,N)]
wr = wr + wz(N:1:-1)%re
print *, wr
end program
It doesn't recognize the aliasing in the expression that should be allowed when
pointers are involved.
I'm expecting a list of '21'. But this is not the case.
I couldn't test on a more recent compiler.