[Fortran, Patch] Passing function pointer to co_reduce
Alessandro Fanfarillo
fanfarillo.gcc@gmail.com
Mon Jul 13 15:31:00 GMT 2015
Dear all,
during the implementation of co_reduce in OpenCoarrays I noticed that
GFortran passes a pointer to function instead of the function name to
co_reduce.
Currently the compiler produces the following call:
_gfortran_caf_co_reduce (&desc.0, &simple_reduction, 0, 0, 0B, 0B, 0, 0);
where simple_reduction is the pure function that has to be used by co_reduce.
The attached patch seems to fix the issue, any comments?
Regards
Alessandro
PS: I also attach the test case
-------------- next part --------------
commit a12b6ce6993df109c81a32d5684b4b9f41f69ea4
Author: Alessandro Fanfarillo <fanfarillo@ing.uniroma2.it>
Date: Mon Jul 13 15:46:19 2015 +0200
Fix function pointer argument for co_reduce
diff --git a/gcc/fortran/trans-intrinsic.c b/gcc/fortran/trans-intrinsic.c
index 66bc72a..967a741 100644
--- a/gcc/fortran/trans-intrinsic.c
+++ b/gcc/fortran/trans-intrinsic.c
@@ -8804,7 +8804,7 @@ conv_co_collective (gfc_code *code)
}
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);
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: simple_reduce.f90
Type: text/x-fortran
Size: 359 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20150713/e9767977/attachment.bin>
More information about the Fortran
mailing list