* [Bug fortran/66681] Wrong result in assigning this_image() to a complex coarray
2015-06-26 14:14 [Bug fortran/66681] New: Wrong result in assigning this_image() to a complex coarray damian at sourceryinstitute dot org
@ 2015-09-07 5:24 ` pault at gcc dot gnu.org
2015-09-07 9:31 ` dominiq at lps dot ens.fr
` (6 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: pault at gcc dot gnu.org @ 2015-09-07 5:24 UTC (permalink / raw)
To: gcc-bugs
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
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug fortran/66681] Wrong result in assigning this_image() to a complex coarray
2015-06-26 14:14 [Bug fortran/66681] New: Wrong result in assigning this_image() to a complex coarray damian at sourceryinstitute dot org
2015-09-07 5:24 ` [Bug fortran/66681] " pault at gcc dot gnu.org
@ 2015-09-07 9:31 ` dominiq at lps dot ens.fr
2015-09-07 9:44 ` pault at gcc dot gnu.org
` (5 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: dominiq at lps dot ens.fr @ 2015-09-07 9:31 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66681
Dominique d'Humieres <dominiq at lps dot ens.fr> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2015-09-07
Ever confirmed|0 |1
--- Comment #2 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
Confirmed for trunk (6.0). I get an ICE for the test in comment 0 and the first
one in comment 1 with 4.9:
pr66681_1.f90:4:0: internal compiler error: in gimplify_expr, at
gimplify.c:8538
Compiling these tests with 5.2 and -fcoarray=single I get
1 ( 0.00000000 , 0.00000000 )
Could you confirm that it is a [6 Regression]?
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug fortran/66681] Wrong result in assigning this_image() to a complex coarray
2015-06-26 14:14 [Bug fortran/66681] New: Wrong result in assigning this_image() to a complex coarray damian at sourceryinstitute dot org
2015-09-07 5:24 ` [Bug fortran/66681] " pault at gcc dot gnu.org
2015-09-07 9:31 ` dominiq at lps dot ens.fr
@ 2015-09-07 9:44 ` pault at gcc dot gnu.org
2015-09-07 9:50 ` dominiq at lps dot ens.fr
` (4 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: pault at gcc dot gnu.org @ 2015-09-07 9:44 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66681
--- Comment #3 from Paul Thomas <pault at gcc dot gnu.org> ---
(In reply to Dominique d'Humieres from comment #2)
> Confirmed for trunk (6.0). I get an ICE for the test in comment 0 and the
> first one in comment 1 with 4.9:
>
> pr66681_1.f90:4:0: internal compiler error: in gimplify_expr, at
> gimplify.c:8538
>
> Compiling these tests with 5.2 and -fcoarray=single I get
>
> 1 ( 0.00000000 , 0.00000000 )
>
> Could you confirm that it is a [6 Regression]?
Looks to me, from your result, that it is present in 5.2 :-)
Paul
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug fortran/66681] Wrong result in assigning this_image() to a complex coarray
2015-06-26 14:14 [Bug fortran/66681] New: Wrong result in assigning this_image() to a complex coarray damian at sourceryinstitute dot org
` (2 preceding siblings ...)
2015-09-07 9:44 ` pault at gcc dot gnu.org
@ 2015-09-07 9:50 ` dominiq at lps dot ens.fr
2015-09-07 12:58 ` pault at gcc dot gnu.org
` (3 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: dominiq at lps dot ens.fr @ 2015-09-07 9:50 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66681
--- Comment #4 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
> Looks to me, from your result, that it is present in 5.2 :-)
( 0.00000000 , 0.00000000 ) instead of ( 1.00000000 , 0.00000000
)?-(
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug fortran/66681] Wrong result in assigning this_image() to a complex coarray
2015-06-26 14:14 [Bug fortran/66681] New: Wrong result in assigning this_image() to a complex coarray damian at sourceryinstitute dot org
` (3 preceding siblings ...)
2015-09-07 9:50 ` dominiq at lps dot ens.fr
@ 2015-09-07 12:58 ` pault at gcc dot gnu.org
2015-10-24 9:14 ` dominiq at lps dot ens.fr
` (2 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: pault at gcc dot gnu.org @ 2015-09-07 12:58 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66681
--- Comment #5 from Paul Thomas <pault at gcc dot gnu.org> ---
This cures the problem in all its guises:
Index: /home/pault/svn/trunk/gcc/fortran/trans-expr.c
===================================================================
*** /home/pault/svn/trunk/gcc/fortran/trans-expr.c (revision 227118)
--- /home/pault/svn/trunk/gcc/fortran/trans-expr.c (working copy)
*************** gfc_trans_scalar_assign (gfc_se * lse, g
*** 8236,8241 ****
--- 8236,8244 ----
gfc_add_block_to_block (&block, &lse->pre);
gfc_add_block_to_block (&block, &rse->pre);
+ if (TREE_CODE (lse->expr) == SAVE_EXPR)
+ lse->expr = TREE_OPERAND (lse->expr, 0);
+
gfc_add_modify (&block, lse->expr,
fold_convert (TREE_TYPE (lse->expr), rse->expr));
}
(It is regtesting right now but looks OK)
I will do that business as long a somebody explains to me why one might ever
want to store the value returned by this_image() as a complex :-)
Paul
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug fortran/66681] Wrong result in assigning this_image() to a complex coarray
2015-06-26 14:14 [Bug fortran/66681] New: Wrong result in assigning this_image() to a complex coarray damian at sourceryinstitute dot org
` (4 preceding siblings ...)
2015-09-07 12:58 ` pault at gcc dot gnu.org
@ 2015-10-24 9:14 ` dominiq at lps dot ens.fr
2015-10-24 12:36 ` pault at gcc dot gnu.org
2015-10-24 13:06 ` dominiq at lps dot ens.fr
7 siblings, 0 replies; 9+ messages in thread
From: dominiq at lps dot ens.fr @ 2015-10-24 9:14 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66681
--- Comment #6 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
A patch has been submitted at
https://gcc.gnu.org/ml/fortran/2015-09/msg00024.html.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug fortran/66681] Wrong result in assigning this_image() to a complex coarray
2015-06-26 14:14 [Bug fortran/66681] New: Wrong result in assigning this_image() to a complex coarray damian at sourceryinstitute dot org
` (5 preceding siblings ...)
2015-10-24 9:14 ` dominiq at lps dot ens.fr
@ 2015-10-24 12:36 ` pault at gcc dot gnu.org
2015-10-24 13:06 ` dominiq at lps dot ens.fr
7 siblings, 0 replies; 9+ messages in thread
From: pault at gcc dot gnu.org @ 2015-10-24 12:36 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66681
--- Comment #7 from Paul Thomas <pault at gcc dot gnu.org> ---
(In reply to Dominique d'Humieres from comment #6)
> A patch has been submitted at
> https://gcc.gnu.org/ml/fortran/2015-09/msg00024.html.
Hi Dominique,
If you follow the correspondence, it ended with questions from me that were
never answered.
Paul
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug fortran/66681] Wrong result in assigning this_image() to a complex coarray
2015-06-26 14:14 [Bug fortran/66681] New: Wrong result in assigning this_image() to a complex coarray damian at sourceryinstitute dot org
` (6 preceding siblings ...)
2015-10-24 12:36 ` pault at gcc dot gnu.org
@ 2015-10-24 13:06 ` dominiq at lps dot ens.fr
7 siblings, 0 replies; 9+ messages in thread
From: dominiq at lps dot ens.fr @ 2015-10-24 13:06 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66681
--- Comment #8 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
> Hi Dominique,
>
> If you follow the correspondence, it ended with questions from me that
> were never answered.
>
> Paul
Indeed I have read https://gcc.gnu.org/ml/fortran/2015-09/msg00071.html! I have
the patch in my tree since some time and I prefer to have a pointer to it in
bugzilla rather than digging the fortran archives.
The problem is that Tobias reacts only if you close the PR as fixed.
^ permalink raw reply [flat|nested] 9+ messages in thread