From patchwork Mon Oct 15 19:46:14 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Tobias Burnus X-Patchwork-Id: 984353 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-487596-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=net-b.de Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="tJEbpqKz"; dkim-atps=neutral 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 42Yppz3WzJz9s55 for ; Tue, 16 Oct 2018 06:46:35 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :subject:to:message-id:date:mime-version:content-type; q=dns; s= default; b=aA1uVyr79oSqm4im+/Bp5JzoLaie6j7L26SVfXZbxycmvA6+ge9kw mzYldHm8L01uQefj66lJEEGROBVbLq/YgVb3DRCZyV9N2JqkeM+C9j//7aGhfiIq DhhyvFc6ieO3n126iLLu3z2VX3VCPtwy0wnLeXTMSgJ/uodH90ZHBs= 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:from :subject:to:message-id:date:mime-version:content-type; s= default; bh=SXNUWDU3f9y0XDwVlT9gmi6X8o8=; b=tJEbpqKzwYCK5c6JubY1 8QhtzcNclzxXk3ZX9ghHB3+8If5vrH/OAmvrTwwjPgUBLWb/hi5TqIQohlOuI71G K8inRKf5a+ftzEC7jTm1aEgg+3EGwo8v2UKSe/Pv4uo7xreNW6IiFtcXnoK49uTb b8IOFAl6c4+Po3vqmGzle48= Received: (qmail 28025 invoked by alias); 15 Oct 2018 19:46:21 -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 27883 invoked by uid 89); 15 Oct 2018 19:46:20 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-19.6 required=5.0 tests=AWL, BAYES_00, GARBLED_SUBJECT, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_LAZY_DOMAIN_SECURITY, RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.2 spammy= X-HELO: mx-relay05-hz1.antispameurope.com Received: from mx-relay05-hz1.antispameurope.com (HELO mx-relay05-hz1.antispameurope.com) (94.100.132.205) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 15 Oct 2018 19:46:19 +0000 Received: from s041.bre.qsc.de ([195.90.7.81]) by mx-relay05-hz1.antispameurope.com; Mon, 15 Oct 2018 21:46:16 +0200 Received: from tux.net-b.de (port-92-194-24-29.dynamic.qsc.de [92.194.24.29]) by s041.bre.qsc.de (Postfix) with ESMTPSA id C1C982C00C7; Mon, 15 Oct 2018 21:46:15 +0200 (CEST) From: Tobias Burnus Subject: =?utf-8?q?=5BPatch=2C_Fortran=5D_PR87556_=E2=80=93_for_FORM_TEAM?= =?utf-8?q?_also_use_argse=2Epre/post?= To: gcc-patches , gfortran Message-ID: <41c30dc9-2f8c-19b3-3228-4dc5d22281df@net-b.de> Date: Mon, 15 Oct 2018 21:46:14 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.0 MIME-Version: 1.0 X-cloud-security-sender: burnus@net-b.de X-cloud-security-recipient: gcc-patches@gcc.gnu.org X-cloud-security-Virusscan: CLEAN X-cloud-security-disclaimer: This E-Mail was scanned by E-Mailservice on mx-relay05-hz1.antispameurope.com with 13C5E201AB321 X-cloud-security-connect: s041.bre.qsc.de[195.90.7.81], TLS=1, IP=195.90.7.81 X-cloud-security: scantime:.1819 as the subject states, FORM TEAM was only using the resulting tree expression, ignoring code which was generated before (or afterward). I am not sure how to best convert it to a test-suite test case. For form team (team(this_image()), my_team2) the old dump was:     integer(kind=4) D.3829; …     _gfortran_caf_form_team (team (&D.3829), &my_team2, 0); the new one is:   {     integer(kind=4) D.3822;     D.3822 = _gfortran_caf_this_image (0);     _gfortran_caf_form_team (team (&D.3822), &my_team2, 0);   } [Does it make sense to check for 5 "this_image (0)" calls? or for 4 "D.\[0-9\]+ = _gfortran_caf_this_image (0);" calls?] Build and on-going regtesting on x86-64-gnu-linux. OK for the trunk? Tobias 2018-10-15 Tobias Burnus PR fortran/87556 * trans-stmt.c (form_team, change_team, sync_team): Don't ignore argse.pre/argse.post. diff --git a/gcc/fortran/trans-stmt.c b/gcc/fortran/trans-stmt.c index 6256e3fa805..130e67ba1e4 100644 --- a/gcc/fortran/trans-stmt.c +++ b/gcc/fortran/trans-stmt.c @@ -707,19 +707,30 @@ gfc_trans_form_team (gfc_code *code) { if (flag_coarray == GFC_FCOARRAY_LIB) { - gfc_se argse; - tree team_id,team_type; - gfc_init_se (&argse, NULL); - gfc_conv_expr_val (&argse, code->expr1); - team_id = fold_convert (integer_type_node, argse.expr); - gfc_init_se (&argse, NULL); - gfc_conv_expr_val (&argse, code->expr2); - team_type = gfc_build_addr_expr (ppvoid_type_node, argse.expr); + gfc_se se; + gfc_se argse1, argse2; + tree team_id, team_type, tmp; - return build_call_expr_loc (input_location, - gfor_fndecl_caf_form_team, 3, - team_id, team_type, - build_int_cst (integer_type_node, 0)); + gfc_init_se (&se, NULL); + gfc_init_se (&argse1, NULL); + gfc_init_se (&argse2, NULL); + gfc_start_block (&se.pre); + + gfc_conv_expr_val (&argse1, code->expr1); + gfc_conv_expr_val (&argse2, code->expr2); + team_id = fold_convert (integer_type_node, argse1.expr); + team_type = gfc_build_addr_expr (ppvoid_type_node, argse2.expr); + + gfc_add_block_to_block (&se.pre, &argse1.pre); + gfc_add_block_to_block (&se.pre, &argse2.pre); + tmp = build_call_expr_loc (input_location, + gfor_fndecl_caf_form_team, 3, + team_id, team_type, + build_int_cst (integer_type_node, 0)); + gfc_add_expr_to_block (&se.pre, tmp); + gfc_add_block_to_block (&se.pre, &argse1.post); + gfc_add_block_to_block (&se.pre, &argse2.post); + return gfc_finish_block (&se.pre); } else { @@ -738,15 +749,18 @@ gfc_trans_change_team (gfc_code *code) if (flag_coarray == GFC_FCOARRAY_LIB) { gfc_se argse; - tree team_type; + tree team_type, tmp; gfc_init_se (&argse, NULL); gfc_conv_expr_val (&argse, code->expr1); team_type = gfc_build_addr_expr (ppvoid_type_node, argse.expr); - return build_call_expr_loc (input_location, - gfor_fndecl_caf_change_team, 2, team_type, - build_int_cst (integer_type_node, 0)); + tmp = build_call_expr_loc (input_location, + gfor_fndecl_caf_change_team, 2, team_type, + build_int_cst (integer_type_node, 0)); + gfc_add_expr_to_block (&argse.pre, tmp); + gfc_add_block_to_block (&argse.pre, &argse.post); + return gfc_finish_block (&argse.pre); } else { @@ -785,16 +799,19 @@ gfc_trans_sync_team (gfc_code *code) if (flag_coarray == GFC_FCOARRAY_LIB) { gfc_se argse; - tree team_type; + tree team_type, tmp; gfc_init_se (&argse, NULL); gfc_conv_expr_val (&argse, code->expr1); team_type = gfc_build_addr_expr (ppvoid_type_node, argse.expr); - return build_call_expr_loc (input_location, - gfor_fndecl_caf_sync_team, 2, - team_type, - build_int_cst (integer_type_node, 0)); + tmp = build_call_expr_loc (input_location, + gfor_fndecl_caf_sync_team, 2, + team_type, + build_int_cst (integer_type_node, 0)); + gfc_add_expr_to_block (&argse.pre, tmp); + gfc_add_block_to_block (&argse.pre, &argse.post); + return gfc_finish_block (&argse.pre); } else {