Fix fortran double address operator with co_reduce
authorAlessandro Fanfarillo <fanfarillo.gcc@gmail.com>
Fri, 17 Jul 2015 12:18:44 +0000 (06:18 -0600)
committerMikael Morin <mikael@gcc.gnu.org>
Fri, 17 Jul 2015 12:18:44 +0000 (12:18 +0000)
gcc/fortran/
2015-07-17  Alessandro Fanfarillo  <fanfarillo.gcc@gmail.com>

* trans-intrinsic.c (conv_co_collective): Remove redundant address
operator in the generated code.

gcc/testsuite/
2015-07-17  Alessandro Fanfarillo  <fanfarillo.gcc@gmail.com>

* gfortran.dg/co_reduce_1.f90: New file.

From-SVN: r225930

gcc/fortran/ChangeLog
gcc/fortran/trans-intrinsic.c
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/co_reduce_1.f90 [new file with mode: 0644]

index 33b8cbbad72df4469050957c513a7fa6ebbdba79..d082f0bd5b6c103962b5df49911a2728c8116ba3 100644 (file)
@@ -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 66bc72afbab1def107761f392fd3b115dd0cdafe..967a74169c8aa94591e7956ab703430a92826a2f 100644 (file)
@@ -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);
     }
index 57b8e54820124540ba35568968d6de3670f74bda..5462c1fd02036491b15784c56b127f075524700e 100644 (file)
@@ -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
diff --git a/gcc/testsuite/gfortran.dg/co_reduce_1.f90 b/gcc/testsuite/gfortran.dg/co_reduce_1.f90
new file mode 100644 (file)
index 0000000..1d3e89f
--- /dev/null
@@ -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" } }