-
-
Notifications
You must be signed in to change notification settings - Fork 56
Closed
Description
Avg response time |
---|
A future pull request will add a unit test that exposes this bug in a more complete way than the small reproducer below.
Defect/Bug Report
When compiled with GCC 6.4, 7.3, and 8.0.1, OpenCoarrays returns the incorrect shape of a coindexed variable even in single-image execution.
- OpenCoarrays Version:
2.0.0-rc1-14-g3af39fa
- Fortran Compiler: GCC 6.4.0, 7.3.0, 8.0.1
- C compiler used for building lib: GCC 6.4.0, 7.3.0, 8.0.1
- Installation method:
install.sh
- Output of
uname -a
:Linux sourcery-VirtualBox 4.13.0-16-generic #19-Ubuntu SMP Wed Oct 11 18:35:14 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
- MPI library being used: MPICH 3.2
- Machine architecture and number of physical cores: 2.7 GHz Intel Core i7, 4 cores
- Version of CMake: 3.10.0
Observed Behavior
$ cat wrong-coarray-shape.f90
program main
implicit none
type foo
logical, allocatable :: x(:,:)[:]
end type
type(foo) :: bar
allocate(bar%x(2,1)[*])
print *,shape(bar%x) , shape(bar%x(:,:)[1])
end program
$ caf wrong-coarray-shape.f90
$ cafrun -n 1 ./a.out
2 1 2 0
Expected Behavior
$ cafrun -n 1 ./a.out
2 1 2 1
Steps to Reproduce
To reproduce this problem, the shape
argument must
- Be a coarray component of a derived type variable,
- Have a rank greater than 1, and
- Have a first dimension with an extent greater than 1.
This appears to be an OpenCoarrays bug and is unrelated to the compiler's shape
intrinsic function. Any reference to a coindexed variable yields an array with incorrect extents. For example, if an array that meets the above criteria is assigned to a non-coarray allocatable array, the latter array acquires the wrong shape through automatic (re)allocation.