From patchwork Sun Feb 10 11:13:26 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Koenig X-Patchwork-Id: 1039397 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-495715-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=quarantine dis=none) header.from=netcologne.de Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="oXCGE8Eq"; dkim=pass (2048-bit key; unprotected) header.d=netcologne.de header.i=@netcologne.de header.b="pJwFMoC0"; 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 43y5rk3HpTz9s4Z for ; Sun, 10 Feb 2019 22:13:42 +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:to :from:subject:message-id:date:mime-version:content-type; q=dns; s=default; b=q+rF14NzD9m4L72J54Jh9qoTiC9C04EFs37Tmdqa3YrEmytTMI ADn8dA4hd30/VGKw+paW85glVVPfJB0YckCoJahTVAx1sA5i1FvJOw7ugDddEfEz HCbaCGiqOknBVDmwWFL4kaQ7eDOVxeSKjva15R8fFQSwE+4T1HJw/g+8M= 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:to :from:subject:message-id:date:mime-version:content-type; s= default; bh=Hc5/Pbtsr747gNpJEPw9MfCYf/E=; b=oXCGE8Eq1aOPWPbUAINq 92LLN9bw7bfcIklKOZwjEOoMKORRSVQJ0wvk/2cXHy3dkcnJ6JawzpG4K0+bAmBI C+rpbB13u56qr51mSZ2IpTLvwyXYuYEyyo1TbQ7yM67BXE7GQdBtpC5uL6Kdf7vn nUYarJlr0e3/fnQDxQwR6sQ= Received: (qmail 51085 invoked by alias); 10 Feb 2019 11:13:35 -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 51065 invoked by uid 89); 10 Feb 2019 11:13:35 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-12.1 required=5.0 tests=BAYES_00, GIT_PATCH_2, GIT_PATCH_3, KAM_NUMSUBJECT, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 spammy=gfc_symbol, sk:regress, *sym X-HELO: cc-smtpout1.netcologne.de Received: from cc-smtpout1.netcologne.de (HELO cc-smtpout1.netcologne.de) (89.1.8.211) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sun, 10 Feb 2019 11:13:33 +0000 Received: from cc-smtpin3.netcologne.de (cc-smtpin3.netcologne.de [89.1.8.203]) by cc-smtpout1.netcologne.de (Postfix) with ESMTP id 2DD0013491; Sun, 10 Feb 2019 12:13:29 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=netcologne.de; s=nc1116a; t=1549797209; bh=uqZ8gNpjIURwwaEWDewJ2JCWu8E3mk/4hn+tUKIriDg=; h=To:From:Subject:Message-ID:Date:From; b=pJwFMoC0OqQ71UTJxVkbDNpu9CntLdqz3dF9/uXd/l7+qrA5BQjckUOLrQTvIdSXq yam2/vFLq3QnhJijB2o1od9RBjWdKvZqtLPs5jSPXl56iaL7c4++EHoFC7vA5nE9dI wKk0USHvwe1C6PWwTdEUHRpHYvOcid95q8jGxoZbsHAli1QMC4gcN/aG1kIOL5tmUy 6OVz9Kyrf3ANcw5tSCqkfCzVOJGdkwV6aLJ2o0V8+Ogl8l4vg8LQfMKd5q0DNn3UYo qf98jYoiFCtAbKiFtdQ8LBxEu45NySMcKn5Ij3JAvTtnj/XhMROiIU5P5gGfZGk9+K dFvIPvrRZGNMw== Received: from localhost (localhost [127.0.0.1]) by cc-smtpin3.netcologne.de (Postfix) with ESMTP id 2044611EEC; Sun, 10 Feb 2019 12:13:29 +0100 (CET) Received: from [87.78.216.65] (helo=cc-smtpin3.netcologne.de) by localhost with ESMTP (eXpurgate 4.6.0) (envelope-from ) id 5c600759-0bea-7f0000012729-7f000001a8bc-1 for ; Sun, 10 Feb 2019 12:13:29 +0100 Received: from [192.168.178.68] (xdsl-87-78-216-65.nc.de [87.78.216.65]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by cc-smtpin3.netcologne.de (Postfix) with ESMTPSA; Sun, 10 Feb 2019 12:13:27 +0100 (CET) To: "fortran@gcc.gnu.org" , gcc-patches From: Thomas Koenig Subject: [patch, fortran] Fix part of PR 71066 Message-ID: <307a588c-eb47-b2aa-8605-1b8d8ef0a8c6@netcologne.de> Date: Sun, 10 Feb 2019 12:13:26 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.3.0 MIME-Version: 1.0 Hello world, this patch fixes the coarray part of PR 71066 - handling of data statements for coarrays. The PR itself is marked as a 7/8/9 regression. Regression-tested. OK for trunk and for backporting? Regards Thomas 2019-02-10 Thomas Koenig PR fortran/71066 * trans-decl.c (generate_coarray_sym_init): For an array constructor in a DATA statement of a coarray variable, set the rank to 1 to avoid confusion later on. If the constructor contains only one value, use that for initiailizig. 2019-02-10 Thomas Koenig PR fortran/71066 * gfortran.dg/coarray_data_1.f90: New test. Index: trans-decl.c =================================================================== --- trans-decl.c (Revision 268432) +++ trans-decl.c (Arbeitskopie) @@ -5399,6 +5399,33 @@ generate_coarray_sym_init (gfc_symbol *sym) /* Handle "static" initializer. */ if (sym->value) { + if (sym->value->expr_type == EXPR_ARRAY) + { + gfc_constructor *c, *cnext; + + /* Test if the array has more than one element. */ + c = gfc_constructor_first (sym->value->value.constructor); + gcc_assert (c); /* Empty constructor should not happen here. */ + cnext = gfc_constructor_next (c); + + if (cnext) + { + /* An EXPR_ARRAY with a rank > 1 here has to come from a + DATA statement. Set its rank here as not to confuse + the following steps. */ + sym->value->rank = 1; + } + else + { + /* There is only a single value in the constructor, use + it directly for the assignment. */ + gfc_expr *new_expr; + new_expr = gfc_copy_expr (c->expr); + gfc_free_expr (sym->value); + sym->value = new_expr; + } + } + sym->attr.pointer = 1; tmp = gfc_trans_assignment (gfc_lval_expr_from_sym (sym), sym->value, true, false);