OpenCoarrays icon indicating copy to clipboard operation
OpenCoarrays copied to clipboard

Defect: wrong value for this_image() in array constructor

Open reinh-bader opened this issue 6 years ago • 2 comments

  • [x] I am reporting a bug others will be able to reproduce and not asking a question or requesting a new feature.

System information including:

  • OpenCoarrays Version: 2.7.1
  • Fortran Compiler: gfortran 9.2.0
  • C compiler used for building lib: gcc 9.2.0
  • Installation method: cmake
  • All flags & options passed to the installer CC=gcc FC="gfortran -I$MPI_BASE/include/gfortran/9.1.0" cmake /dss/dsshome1/lrz/noarch/src/compilers/gcc/opencoarrays/OpenCoarrays-2.7.1 -DCMAKE_INSTALL_PREFIX=${PWD}
  • Output of uname -a: Linux mpp2-login5 4.4.180-94.100-default #1 SMP Tue Jul 9 19:57:20 UTC 2019 (1569ffb) x86_64 x86_64 x86_64 GNU/Linux
  • MPI library being used: Intel MPI 2019 update 5
  • Machine architecture and number of physical cores: Haswell 28 core
  • Version of CMake: 3.10 (self-installed)

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:

  • more than 1 image also gives wrong results on the other images.
  • building with -fcoarray=single produces the expected result.
  • assigning a scalar that is broadcast to the array works as expected.

reinh-bader avatar Sep 14 '19 08:09 reinh-bader

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.

zbeekman avatar Oct 08 '19 18:10 zbeekman