https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83606

            Bug ID: 83606
           Summary: co-indexed array RHS yields incorrect result in
                    assignment to vector-indexed LHS
           Product: gcc
           Version: 8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: damian at sourceryinstitute dot org
  Target Milestone: ---

The commands below use MPICH 3.2 installed by GCC 8 trunk dated 20171227. 
Alternatively, the code can be compiled without arguments using the "caf"
script that OpenCoarrays installs.

$ cat vector-subscript.f90
  integer, parameter :: ndim=5
  integer :: i,vec(ndim)=0, res(ndim)[*]=[ (i, i=1, ndim) ]
  vec([ndim,1]) = res(1:2)[1]
  if (vec(1) /= res(2) .or. vec(ndim) /= res(1)) &
    print *," wrong result ",vec([ndim,1])," on image ",this_image()
end

$ export
LD_LIBRARY_PATH=/opt/opencoarrays/1.9.3/gnu/8.0.0/lib/:$LD_LIBRARY_PATH

$ export PATH=/opt/mpich/3.2/gnu/8.0.0/bin:$PATH

$ mpifort -fcoarray=lib -L /opt/opencoarrays/1.9.3/gnu/8.0.0/lib/
vector-subscript.f90 -lcaf_mpi

$ mpirun -n 1 ./a.out
  wrong result            0           0  on image            1

$ mpifort --version
GNU Fortran (GCC) 8.0.0 20171227 (experimental)

Reply via email to