Le 17/07/2015 11:02, Mikael Morin a écrit :
> Le 16/07/2015 16:34, Damian Rouson a écrit :
>> Alternatively, if it’s easy, please feel free to add the directives and
>> commit.
>>
> Never mind, I'll take care of it all.
>
This is what I have committed:
https://gcc.gnu.org/r225930 (trunk)
https://gcc.gnu.org/r225932 (5 branch)
Mikael
Index: gcc/testsuite/gfortran.dg/co_reduce_1.f90
===================================================================
--- gcc/testsuite/gfortran.dg/co_reduce_1.f90 (révision 0)
+++ gcc/testsuite/gfortran.dg/co_reduce_1.f90 (révision 225930)
@@ -0,0 +1,33 @@
+! { dg-do compile }
+! { dg-additional-options "-fdump-tree-original -fcoarray=lib" }
+!
+! Check that we don't take twice the address of procedure simple_reduction
+! in the generated code.
+!
+! Contributed by Alessandro Fanfarillo <[email protected]>
+
+program simple_reduce
+ implicit none
+
+ integer :: me
+
+ me = this_image()
+
+ sync all
+
+ call co_reduce(me,simple_reduction)
+
+ write(*,*) this_image(),me
+
+contains
+
+ pure function simple_reduction(a,b)
+ integer,intent(in) :: a,b
+ integer :: simple_reduction
+
+ simple_reduction = a * b
+ end function simple_reduction
+
+end program simple_reduce
+
+! { dg-final { scan-tree-dump "_gfortran_caf_co_reduce \\(&desc\\.\\d+,\\s*simple_reduction," "original" } }
Index: gcc/testsuite/ChangeLog
===================================================================
--- gcc/testsuite/ChangeLog (révision 225929)
+++ gcc/testsuite/ChangeLog (révision 225930)
@@ -1,3 +1,7 @@
+2015-07-17 Alessandro Fanfarillo <[email protected]>
+
+ * gfortran.dg/co_reduce_1.f90: New file.
+
2015-07-17 H.J. Lu <[email protected]>
PR target/66824
Index: gcc/fortran/ChangeLog
===================================================================
--- gcc/fortran/ChangeLog (révision 225929)
+++ gcc/fortran/ChangeLog (révision 225930)
@@ -1,3 +1,8 @@
+2015-07-17 Alessandro Fanfarillo <[email protected]>
+
+ * trans-intrinsic.c (conv_co_collective): Remove redundant address
+ operator in the generated code.
+
2015-07-17 Andre Vehreschild <[email protected]>
PR fortran/66035
Index: gcc/fortran/trans-intrinsic.c
===================================================================
--- gcc/fortran/trans-intrinsic.c (révision 225929)
+++ gcc/fortran/trans-intrinsic.c (révision 225930)
@@ -8804,7 +8804,7 @@
}
opr_flags = build_int_cst (integer_type_node, opr_flag_int);
gfc_conv_expr (&argse, opr_expr);
- opr = gfc_build_addr_expr (NULL_TREE, argse.expr);
+ opr = argse.expr;
fndecl = build_call_expr_loc (input_location, fndecl, 8, array, opr, opr_flags,
image_index, stat, errmsg, strlen, errmsg_len);
}