[Fortran-caf, patch, committed] Fix issue with added caf_get, prep for TS18508 collectives

2014-04-20 Thread Tobias Burnus
This patch fixes an issues with allocate(..., source=) which is turned 
into an assignment - which got wrongly resolved to "CAF_GET(...) = 
source-expr". Now, the function which adds the intrinsic checks more 
carefully whether an assignment should be done.


In addition, the patch prepares for the support of CO_MIN/CO_MAX/CO_SUM 
by adding a stub implementation to the library. Expect some changes in 
the support as TS18508 is not yet finalized. I will add a version which 
does not support an extra "result" argument but the result will be 
stored in the source (either on all images or with result_image only on 
that image). The additional but optional "result" argument is in the 
current draft, but it looks like it will be dropped.


I have committed the attached patch as Rev. 209535.

In addition, I have merged the trunk into the branch as Rev. 209536.

Tobias
 gcc/fortran/ChangeLog.fortran-caf |6 ++
 gcc/fortran/resolve.c |   23 ---
 libgfortran/ChangeLog.fortran-caf |7 +++
 libgfortran/caf/libcaf.h  |4 
 libgfortran/caf/single.c  |   33 +
 5 files changed, 66 insertions(+), 7 deletions(-)
Index: gcc/fortran/ChangeLog.fortran-caf
===
--- gcc/fortran/ChangeLog.fortran-caf	(Revision 209348)
+++ gcc/fortran/ChangeLog.fortran-caf	(Arbeitskopie)
@@ -1,3 +1,9 @@
+2014-04-20  Tobias Burnus  
+
+	* resolve.c (add_caf_get_intrinsic): Add check whether is is really
+	coindexed.
+	(resolve_allocate_expr): Remove remove_caf_get_intrinsic call.
+
 2014-04-13  Tobias Burnus  
 
 	* trans-decl.c (gfc_trans_deferred_vars): Fix bug in
Index: gcc/fortran/resolve.c
===
--- gcc/fortran/resolve.c	(Revision 209348)
+++ gcc/fortran/resolve.c	(Arbeitskopie)
@@ -4732,8 +4732,21 @@ static void
 add_caf_get_intrinsic (gfc_expr *e)
 {
   gfc_expr *wrapper, *tmp_expr;
-  gfc_expr *async = gfc_get_logical_expr (gfc_default_logical_kind, NULL,
-	  false);
+  gfc_expr *async;
+  gfc_ref *ref;
+  int n;
+
+  for (ref = e->ref; ref; ref = ref->next)
+if (ref->type == REF_ARRAY && ref->u.ar.codimen > 0)
+  break;
+  if (ref == NULL)
+return;
+
+  for (n = ref->u.ar.dimen; n < ref->u.ar.dimen + ref->u.ar.codimen; n++)
+if (ref->u.ar.dimen_type[n] != DIMEN_ELEMENT)
+  return;
+
+  async = gfc_get_logical_expr (gfc_default_logical_kind, NULL, false);
   tmp_expr = XCNEW (gfc_expr);
   *tmp_expr = *e;
   wrapper = gfc_build_intrinsic_call (gfc_current_ns, GFC_ISYM_CAF_GET,
@@ -5045,7 +5058,7 @@ resolve_procedure:
 expression_rank (e);
 
   if (0 && t && gfc_option.coarray == GFC_FCOARRAY_LIB && gfc_is_coindexed (e))
-add_caf_get_intrinsic(e);
+add_caf_get_intrinsic (e);
 
   return t;
 }
@@ -6709,10 +6722,6 @@ resolve_allocate_expr (gfc_expr *e, gfc_code *code
   if (!gfc_resolve_expr (e))
 goto failure;
 
-  if (e->expr_type == EXPR_FUNCTION && e->value.function.isym
-  && e->value.function.isym->id == GFC_ISYM_CAF_GET)
-remove_caf_get_intrinsic (e);
-
   /* Make sure the expression is allocatable or a pointer.  If it is
  pointer, the next-to-last reference must be a pointer.  */
 
Index: libgfortran/ChangeLog.fortran-caf
===
--- libgfortran/ChangeLog.fortran-caf	(Revision 209347)
+++ libgfortran/ChangeLog.fortran-caf	(Arbeitskopie)
@@ -1,3 +1,10 @@
+2014-04-20  Tobias Burnus  
+
+	* caf/libcaf.h (_gfortran_caf_co_sum, _gfortran_caf_co_min,
+	_gfortran_caf_co_max): New.
+	* caf/single.c (_gfortran_caf_co_sum, _gfortran_caf_co_min,
+	_gfortran_caf_co_max): New.
+
 2014-04-10  Tobias Burnus  
 
 	* caf/libcaf.h (_gfortran_caf_get_desc): New.
Index: libgfortran/caf/libcaf.h
===
--- libgfortran/caf/libcaf.h	(Revision 209347)
+++ libgfortran/caf/libcaf.h	(Arbeitskopie)
@@ -134,4 +134,8 @@ void _gfortran_caf_error_stop_str (const char *, i
  __attribute__ ((noreturn));
 void _gfortran_caf_error_stop (int32_t) __attribute__ ((noreturn));
 
+void _gfortran_caf_co_sum (gfc_descriptor_t *, int, int *, char *, int);
+void _gfortran_caf_co_min (gfc_descriptor_t *, int, int *, char *, int, int);
+void _gfortran_caf_co_max (gfc_descriptor_t *, int, int *, char *, int, int);
+
 #endif  /* LIBCAF_H  */
Index: libgfortran/caf/single.c
===
--- libgfortran/caf/single.c	(Revision 209347)
+++ libgfortran/caf/single.c	(Arbeitskopie)
@@ -345,6 +345,39 @@ _gfortran_caf_send_desc_scalar (caf_token_t token,
 
 
 void
+_gfortran_caf_co_sum (gfc_descriptor_t *source __attribute__ ((unused)),
+		  int result_image __attribute__ ((unused)),
+		  int *stat, char *errmsg __attribute__ ((unused)),
+		  int errmsg_len __attribute__ ((unused)))
+{
+  if (stat)
+stat = 0;
+}
+
+void
+_gfor

Re: Contributing new gcc targets: i386-*-dragonfly and x86-64-*-dragonfly

2014-04-20 Thread Jonathan Wakely
On 19 April 2014 20:39, John Marino wrote:
> Hello GCC developers,
>
> For the last few years, I have been maintaining a large set of patches
> that add support for the DragonFly BSD target and also complete Ada
> frontend support on all four major BSDs among other things.  Before I
> can submit patches for Ada or testsuite cases, DragonFly must be a
> recognized, working target.  The patches attached here will provide
> out-of-the-box support for the C, C++, Objective-C and Fortran frontends.

Thanks for the patch - I only have a few general, minor comments. As
noted at http://gcc.gnu.org/lists.html C++ library patches should go
to the libstdc++ list as well as gcc-patches, so I've CC'd that list
(original mail and patch are at
http://gcc.gnu.org/ml/gcc-patches/2014-04/msg01128.html)

Patches should not include generated files such as configure, as the
diffs don't always apply cleanly and the changes are implied by the
patches to files such as acinclude.m4 and configure.ac. The
regenerated versions should of course be committed, and the ChangeLog
should mention they are regenerated, as you've done.

The changelog text should be correctly capitalised and sentences ended
with a period (e.g. "New target." and "New." not "New target" and
"new"). The individual ChangeLog entries at
http://leaf.dragonflybsd.org/~marino/gcc-df-target/changelog_entries/
would generally be used as the commit message, grouped and prefixed by
the name of the sub-directory:

gcc/
* config.gcc (*-*-dragonfly*): New target
etc. etc.

libcilkrts/
* runtime/os-unix.c (__DragonFly__): New target
etc. etc.

libgcc/
* libgcc/config.host (*-*-dragonfly*): New target
etc. etc.


The libstdc++ changes are OK for trunk if the rest gets approved.


Re: [C++ Patch] PR 59120

2014-04-20 Thread Jason Merrill

OK.

Jason