sourceryinstitute / OpenCoarrays

A parallel application binary interface for Fortran 2018 compilers.
http://www.opencoarrays.org
BSD 3-Clause "New" or "Revised" License
246 stars 55 forks source link

Defect: wrong value for this_image() in array constructor #681

Open reinh-bader opened 5 years ago

reinh-bader commented 5 years ago

System information including:

To help us debug your issue please explain:

What you were trying to do (and why)

assign to an array constructor:

a = (/ this_image(), 5*this_image() /)

What happened (include command output, screenshots, logs, etc.)

resulting value of a after the statement is [ 0,0 ]

What you expected to happen

resulting value of a after statement is [ 1,5 ] on image 1

Step-by-step reproduction instructions to reproduce the error/bug

Use the following code:

program test_constr
  use, intrinsic :: iso_fortran_env
  implicit none

  real :: a(2), temp

  a = (/ this_image(), 5*this_image() /)
  write(output_unit,*) "first a is: ", a

  sync all
  a =  this_image()
  write(output_unit,*) "second a is: ", a

end program

build it with caf tu.f90 execute with cafrun -n 1 ./a.out

Notes:

zbeekman commented 5 years ago

Thanks for reporting this. This smells like a GFortran front-end/IR problem to me. I'll try to investigate and if I confirm that to be the case we should open an issue upstream.

vehre commented 1 month ago

Retesting with gfortran 15 (current development) and mpich and intel mpi. In both cases I see no issues. Can you retest?