diff mbox

[Fortran] Passing function pointer to co_reduce

Message ID 55A90822.50306@sfr.fr
State New
Headers show

Commit Message

Mikael Morin July 17, 2015, 1:50 p.m. UTC
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

Comments

Damian Rouson July 17, 2015, 2:35 p.m. UTC | #1
Thank you!

Damian

> On Jul 17, 2015, at 9:50 AM, Mikael Morin <mikael.morin@sfr.fr> wrote:
> 
> 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
> <r225930.diff>
Alessandro Fanfarillo July 17, 2015, 2:42 p.m. UTC | #2
Thanks a lot!

2015-07-17 15:50 GMT+02:00 Mikael Morin <mikael.morin@sfr.fr>:
> 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
Steve Kargl July 17, 2015, 6:40 p.m. UTC | #3
On Fri, Jul 17, 2015 at 03:50:26PM +0200, Mikael Morin wrote:
> 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)
> 

Hi Mikael,

It seems that this commit has changed the scanning of 
other testcases.

FAIL: gfortran.dg/coarray_collectives_16.f90   -O   scan-tree-dump-times original "_gfortran_caf_co_reduce \\(&desc.., &fr, 4, _gfortran_caf_num_images \\(0, -1\\), &stat1, errmesg1, 0, 6\\);" 1
FAIL: gfortran.dg/coarray_collectives_16.f90   -O   scan-tree-dump-times original "_gfortran_caf_co_reduce \\(&val2, &gz, 0, 4, &stat2, errmesg2, 0, 7\\);" 1
FAIL: gfortran.dg/coarray_collectives_16.f90   -O   scan-tree-dump-times original "_gfortran_caf_co_reduce \\(&desc.., &hc, 1, res, &stat3, errmesg3, 99, 8\\);"
Mikael Morin July 17, 2015, 7:39 p.m. UTC | #4
Le 17/07/2015 20:40, Steve Kargl a écrit :
> On Fri, Jul 17, 2015 at 03:50:26PM +0200, Mikael Morin wrote:
>> 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)
>>
> 
> Hi Mikael,
> 
> It seems that this commit has changed the scanning of 
> other testcases.
> 
> FAIL: gfortran.dg/coarray_collectives_16.f90   -O   scan-tree-dump-times original "_gfortran_caf_co_reduce \\(&desc.., &fr, 4, _gfortran_caf_num_images \\(0, -1\\), &stat1, errmesg1, 0, 6\\);" 1
> FAIL: gfortran.dg/coarray_collectives_16.f90   -O   scan-tree-dump-times original "_gfortran_caf_co_reduce \\(&val2, &gz, 0, 4, &stat2, errmesg2, 0, 7\\);" 1
> FAIL: gfortran.dg/coarray_collectives_16.f90   -O   scan-tree-dump-times original "_gfortran_caf_co_reduce \\(&desc.., &hc, 1, res, &stat3, errmesg3, 99, 8\\);"
> 
Hmm,

now you bring the topic, I realize I haven't tested the patch against
the testsuite (except the new file).
Will fix.

Mikael
diff mbox

Patch

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 <fanfarillo.gcc@gmail.com>
+
+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  <fanfarillo.gcc@gmail.com>
+
+	* gfortran.dg/co_reduce_1.f90: New file.
+
 2015-07-17  H.J. Lu  <hongjiu.lu@intel.com>
 
 	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  <fanfarillo.gcc@gmail.com>
+
+	* trans-intrinsic.c (conv_co_collective): Remove redundant address
+	operator in the generated code.
+
 2015-07-17  Andre Vehreschild  <vehre@gcc.gnu.org>
 
 	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);
     }