From patchwork Sun Apr 20 07:09:21 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tobias Burnus X-Patchwork-Id: 340513 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 518E41400C6 for ; Sun, 20 Apr 2014 17:09:42 +1000 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :message-id:date:from:mime-version:to:subject:content-type; q= dns; s=default; b=H4hwhCbxJGe+VOvWOS6f4mt/woLQ5JD9Z+biX693KO3YYn 38A4rKoNhYQAKJ6ZO+V2njaBgmDpbEsEzAWt5zXDAJdFKnF5sUzMEBFkXpIZbpNO YWdt6+PZJ0HpeIoIhnDhi6ZlhwWImX9tFpzUTYMTxiOIUzozPjGkMZ7v8ZPaI= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :message-id:date:from:mime-version:to:subject:content-type; s= default; bh=oe+NGBs8SIvBWVgOaflhpBYqIwc=; b=KPRsxafFmiJcFm3ZhbGO r2g7oz/n3ZoxlQ4pXgwxbP6wzKnikxU2kDDEOIglgcJnFIw9S90HbJASni8vUc/6 NjyDTGRxMiDcm4pNpXVlevUquEOJfBa56WnTeEsdKpsOzrpKqQVja3j81fbqGzaR ARqs+bkkFgwzlzBvcMpe4yo= Received: (qmail 25209 invoked by alias); 20 Apr 2014 07:09:29 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 25185 invoked by uid 89); 20 Apr 2014 07:09:27 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.2 required=5.0 tests=AWL, BAYES_00, KAM_STOCKGEN autolearn=no version=3.3.2 X-Spam-User: qpsmtpd, 2 recipients X-HELO: mx01.qsc.de Received: from mx01.qsc.de (HELO mx01.qsc.de) (213.148.129.14) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Sun, 20 Apr 2014 07:09:25 +0000 Received: from tux.net-b.de (port-92-194-43-249.dynamic.qsc.de [92.194.43.249]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx01.qsc.de (Postfix) with ESMTPSA id 329643CBDE; Sun, 20 Apr 2014 09:09:21 +0200 (CEST) Message-ID: <535372A1.3010109@net-b.de> Date: Sun, 20 Apr 2014 09:09:21 +0200 From: Tobias Burnus User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.3.0 MIME-Version: 1.0 To: gcc-patches , gfortran Subject: [Fortran-caf, patch, committed] Fix issue with added caf_get, prep for TS18508 collectives 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 +_gfortran_caf_co_min (gfc_descriptor_t *source __attribute__ ((unused)), + int result_image __attribute__ ((unused)), + int *stat, char *errmsg __attribute__ ((unused)), + int src_len __attribute__ ((unused)), + int errmsg_len __attribute__ ((unused))) +{ + if (stat) + stat = 0; +} + +void +_gfortran_caf_co_max (gfc_descriptor_t *source __attribute__ ((unused)), + int result_image __attribute__ ((unused)), + int *stat, char *errmsg __attribute__ ((unused)), + int src_len __attribute__ ((unused)), + int errmsg_len __attribute__ ((unused))) +{ + if (stat) + stat = 0; +} + + +void _gfortran_caf_sync_all (int *stat, char *errmsg __attribute__ ((unused)), int errmsg_len __attribute__ ((unused)))