https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66681
Paul Thomas <pault at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |pault at gcc dot gnu.org --- Comment #1 from Paul Thomas <pault at gcc dot gnu.org> --- (In reply to Damian Rouson from comment #0) > The following problem disappears if the variable declaration is for an > integer or real or if it contains the allocatable attribute and a subsequent > allocation happens: > > localhost:gnu rouson$ cat assign_this_image_to_complex.f90 > complex a[*] > a = this_image() > print *,this_image(),a > end > localhost:gnu rouson$ gfortran assign_this_image_to_complex.f90 > -fcoarray=single > localhost:gnu rouson$ ./a.out > 1 ( 0.00000000 , 0.00000000 ) > localhost:gnu rouson$ mpif90 assign_this_image_to_complex.f90 -fcoarray=lib > -L /opt/opencoarrays/gnu/6.0.0/lib -lcaf_mpi > localhost:gnu rouson$ mpirun -np 1 ./a.out > 1 ( 0.00000000 , -4.65661287E-10) > localhost:gnu rouson$ gfortran --version > GNU Fortran (MacPorts gcc6 6-20150614_0) 6.0.0 20150614 (experimental) > Copyright (C) 2015 Free Software Foundation, Inc. > > GNU Fortran comes with NO WARRANTY, to the extent permitted by law. > You may redistribute copies of GNU Fortran > under the terms of the GNU General Public License. > For more information about these matters, see the file named COPYING > > localhost:gnu rouson$ mpif90 --version > GNU Fortran (MacPorts gcc6 6-20150614_0) 6.0.0 20150614 (experimental) > Copyright (C) 2015 Free Software Foundation, Inc. > > GNU Fortran comes with NO WARRANTY, to the extent permitted by law. > You may redistribute copies of GNU Fortran > under the terms of the GNU General Public License. > For more information about these matters, see the file named COPYING This also fails: complex a[*] integer i i = 1 a = cmplx(real(i),0.0) print *,i,a end whereas making a an array works: complex a(1)[*] integer i i = 1 a = cmplx(real(i),0.0) print *,i,a end The SAVE_EXPR pointed out by Steve is a sure symptom that the type conversion is not working. I am blowed if I see why at the moment. Cheers Paul