Wrong result in assigning this_image() to a complex coarray
Steve Kargl
sgk@troutmask.apl.washington.edu
Fri Jun 26 17:01:00 GMT 2015
On Fri, Jun 26, 2015 at 07:18:55AM -0700, Damian Rouson wrote:
(Courtesy wrap to less than 80 characters)
> I just submitted the code below in bug report 66681
> (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66681). The problem
> disappears if the variable declaration is for an integer or real or
> if it contains the allocatable attribute and a subsequent allocation
> happens. This appears to be a front-end problem because it even
> occurs when compiling without OpenCoarrays.
>
> Damian
>
> $ cat assign_this_image_to_complex.f90
> complex a[*]
> a = this_image()
> print *,this_image(),a
> end
>
> $ gfortran assign_this_image_to_complex.f90 -fcoarray=single
>
> $ ./a.out
> 1 ( 0.00000000 , 0.00000000 )
>
The relevant part of -fdump-tree-original for Damain's
testcase is
{
complex(kind=4) a;
SAVE_EXPR <a> = __complex__ (1.0e+0, 0.0);
{
_gfortran_transfer_complex_write (&dt_parm.0, &a, 4);
}
}
Changing COMPLEX to INTEGER in the testcase yields
{
integer(kind=4) a;
(integer(kind=4)) a = 1;
{
_gfortran_transfer_integer_write (&dt_parm.0, &a, 4);
}
}
For the simple program
complex a
a = 1
print *, a
end
I get
{
complex(kind=4) a;
a = __complex__ (1.0e+0, 0.0);
{
_gfortran_transfer_complex_write (&dt_parm.0, &a, 4);
}
}
which suggest that the SAVE_EXPR <a> is missing an (gfc_)evaluate(_now)
step. I'm not sure where to look to fix this. Tobias?
--
Steve
More information about the Fortran
mailing list