From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 89722 invoked by alias); 27 Apr 2015 11:18:04 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 89703 invoked by uid 89); 27 Apr 2015 11:18:03 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.9 required=5.0 tests=AWL,BAYES_20,RCVD_IN_DNSWL_NONE,SPF_PASS,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-Spam-User: qpsmtpd, 2 recipients X-HELO: smtp24.services.sfr.fr Received: from smtp24.services.sfr.fr (HELO smtp24.services.sfr.fr) (93.17.128.81) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Mon, 27 Apr 2015 11:18:02 +0000 Received: from filter.sfr.fr (localhost [86.72.15.59]) by msfrf2402.sfr.fr (SMTP Server) with ESMTP id 6B12E70001B0; Mon, 27 Apr 2015 13:17:58 +0200 (CEST) Authentication-Results: sfrmc.priv.atos.fr; dkim=none (no signature); dkim-adsp=none (no policy) header.from=mikael.morin@sfr.fr Received: from tolstoi.localhost (59.15.72.86.rev.sfr.net [86.72.15.59]) (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) by msfrf2402.sfr.fr (SMTP Server) with ESMTP id 8A121700018E; Mon, 27 Apr 2015 13:17:57 +0200 (CEST) X-SFR-UUID: 20150427111757565.8A121700018E@msfrf2402.sfr.fr Message-ID: <553E1AD6.2070205@sfr.fr> Date: Mon, 27 Apr 2015 11:18:00 -0000 From: Mikael Morin User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 MIME-Version: 1.0 To: gcc-patches , gfortran Subject: [Patch, fortran] Simplify lbound for array subcomponents Content-Type: multipart/mixed; boundary=------------040003080001070009000300 X-IsSubscribed: yes X-SW-Source: 2015-04/txt/msg01603.txt.bz2 This is a multi-part message in MIME format. --------------040003080001070009000300 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Content-length: 223 Hello, while reviewing Thomas' bound simplification patch, I noticed that the {l,u}bound simplification code wasn't handling array subcomponents. Fixed by the attached patch, regression tested. OK for trunk? Mikael --------------040003080001070009000300 Content-Type: text/plain; charset=UTF-8; name="bound_simplify.CL" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="bound_simplify.CL" Content-length: 497 MjAxNS0wNC0yNyAgTWlrYWVsIE1vcmluICA8bWlrYWVsQGdjYy5nbnUub3Jn PgoKCSogc2ltcGxpZnkuYyAoc2ltcGxpZnlfYm91bmRfZGltKTogVGlnaHRl biB0aGUgY2hlY2sgZm9yIGFycmF5IGZ1bGxuZXNzCglieSBhbHNvIGNoZWNr aW5nIGZvciBhYnNlbmNlIG9mIHN1YnJlZmVyZW5jZS4KCShzaW1wbGlmeV9i b3VuZCk6IERvbid0IHNraXAgc2ltcGxpZmljYXRpb24gaWYgdGhlIGFycmF5 CgloYXMgc3VicmVmZXJlbmNlcy4KCShzaW1wbGlmeV9jb2JvdW5kKTogU2Ft ZS4KCjIwMTUtMDQtMjcgIE1pa2FlbCBNb3JpbiAgPG1pa2FlbEBnY2MuZ251 Lm9yZz4KCgkqIGdmb3J0cmFuLmRnL2JvdW5kX3NpbXBsaWZ5XzQuZjkwOiBO ZXcuCgo= --------------040003080001070009000300 Content-Type: text/x-patch; name="bound_simplify.diff" Content-Transfer-Encoding: 8bit Content-Disposition: attachment; filename="bound_simplify.diff" Content-length: 1176 Index: simplify.c =================================================================== --- simplify.c (révision 221972) +++ simplify.c (copie de travail) @@ -3338,7 +3338,7 @@ simplify_bound_dim (gfc_expr *array, gfc_expr *kin result = gfc_get_constant_expr (BT_INTEGER, k, &array->where); /* Then, we need to know the extent of the given dimension. */ - if (coarray || ref->u.ar.type == AR_FULL) + if (coarray || (ref->u.ar.type == AR_FULL && !ref->next)) { l = as->lower[d-1]; u = as->upper[d-1]; @@ -3417,11 +3417,8 @@ simplify_bound (gfc_expr *array, gfc_expr *dim, gf case AR_FULL: /* We're done because 'as' has already been set in the previous iteration. */ - if (!ref->next) - goto done; + goto done; - /* Fall through. */ - case AR_UNKNOWN: return NULL; @@ -3556,11 +3553,8 @@ simplify_cobound (gfc_expr *array, gfc_expr *dim, case AR_FULL: /* We're done because 'as' has already been set in the previous iteration. */ - if (!ref->next) - goto done; + goto done; - /* Fall through. */ - case AR_UNKNOWN: return NULL; --------------040003080001070009000300 Content-Type: text/x-fortran; name="bound_simplification_4.f90" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="bound_simplification_4.f90" Content-length: 965 ! { dg-do run } ! { dg-additional-options "-fcoarray=single -fdump-tree-original" } ! ! Check that {L,U}{,CO}BOUND intrinsics are properly simplified. ! type :: t integer :: c end type t type(t) :: d(3:8) = t(7) type(t) :: e[5:9,-1:*] if (lbound(d, 1) /= 3) call abort if (lbound(d(3:5), 1) /= 1) call abort if (lbound(d%c, 1) /= 1) call abort if (ubound(d, 1) /= 8) call abort if (ubound(d(3:5), 1) /= 3) call abort if (ubound(d%c, 1) /= 6) call abort if (lcobound(e, 1) /= 5) call abort if (lcobound(e%c, 1) /= 5) call abort if (lcobound(e, 2) /= -1) call abort if (lcobound(e%c, 2) /= -1) call abort if (ucobound(e, 1) /= 9) call abort if (ucobound(e%c, 1) /= 9) call abort ! no simplification for ucobound(e{,%c}, dim=2) end ! { dg-final { scan-tree-dump-not "bound" "original" } } ! { dg-final { scan-tree-dump-not "abort" "original" } } ! { dg-final { cleanup-tree-dump "original" } } --------------040003080001070009000300--