[Bug fortran/80645] FAIL: gfortran.dg/elemental_subroutine_3.f90 -O1 (test for excess errors)
dominiq at lps dot ens.fr
gcc-bugzilla@gcc.gnu.org
Sun Dec 10 14:27:00 GMT 2017
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80645
--- Comment #10 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
> Anyway, WAITING for Fortran folks to settle the wrong-code dispute.
AFAIU the code is valid Fortran
x(4:1:-1) = x((/1,3,2,4/))
x((/1,3,2,4/)) use a temporary array of size 4 and
tmp(1)=x(1)
tmp(2)=x(3)
tmp(3)=x(2)
tmp(4)=x(4)
then this temporaries assigned to the fist four elements of x as
x(4)=tmp(1)
x(3)=tmp(2)
x(2)=tmp(3)
x(1)=tmp(4)
and it is what I see in the dump of the reduced test
program test
implicit none
type mytype
integer x
end type mytype
type(mytype) :: x(6) = (/mytype(1),mytype(2),mytype(3), &
mytype(4),mytype(5), mytype(6)/)
print *, x
x(4:1:-1) = x((/1,3,2,4/))
print *, x
end program test
More information about the Gcc-bugs
mailing list