From patchwork Mon Sep 20 22:21:31 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mikael Morin X-Patchwork-Id: 65260 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]) by ozlabs.org (Postfix) with SMTP id BFA21B70AB for ; Tue, 21 Sep 2010 08:22:11 +1000 (EST) Received: (qmail 1318 invoked by alias); 20 Sep 2010 22:21:40 -0000 Received: (qmail 1236 invoked by uid 22791); 20 Sep 2010 22:21:38 -0000 X-SWARE-Spam-Status: No, hits=0.3 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_NONE, SPF_NEUTRAL, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from smtp21.services.sfr.fr (HELO smtp21.services.sfr.fr) (93.17.128.1) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 20 Sep 2010 22:21:33 +0000 Received: from filter.sfr.fr (localhost [127.0.0.1]) by msfrf2118.sfr.fr (SMTP Server) with ESMTP id 7CA687000082; Tue, 21 Sep 2010 00:21:31 +0200 (CEST) Received: from gimli.local (40.183.72-86.rev.gaoland.net [86.72.183.40]) by msfrf2118.sfr.fr (SMTP Server) with ESMTP id 43C817000089; Tue, 21 Sep 2010 00:21:31 +0200 (CEST) X-SFR-UUID: 20100920222131277.43C817000089@msfrf2118.sfr.fr MIME-Version: 1.0 From: Mikael Morin To: gfortran , patches Message-ID: <20100920222130.27269.19670@gimli.local> In-Reply-To: <20100920222130.27269.49914@gimli.local> References: <20100920222130.27269.49914@gimli.local> Subject: [Patch, fortran] [1/5] PR 45648: Inline transpose part 2: Support transposed descriptor whilst getting array bounds Date: Tue, 21 Sep 2010 00:21:31 +0200 (CEST) X-IsSubscribed: yes 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 We can't have dim (new descriptor's dimension) increasing together with n (original array's dimension) if we want to support transposed reference. We have to get dim such that info->dim[dim] == n. Then we can set the descriptor bounds along dim. OK for trunk? 2010-09-20 Mikael Morin PR fortran/45648 * trans-array.c (gfc_conv_expr_descriptor): Calculate dim out of n and info->dim. diff --git a/trans-array.c b/trans-array.c index 7bce2ef..f15b53e 100644 --- a/trans-array.c +++ b/trans-array.c @@ -5439,7 +5439,6 @@ gfc_conv_expr_descriptor (gfc_se * se, gfc_expr * expr, gfc_ss * ss) } offset = gfc_index_zero_node; - dim = 0; /* The following can be somewhat confusing. We have two descriptors, a new one and the original array. @@ -5479,9 +5478,6 @@ gfc_conv_expr_descriptor (gfc_se * se, gfc_expr * expr, gfc_ss * ss) } else { - /* Check we haven't somehow got out of sync. */ - gcc_assert (info->dim[dim] == n); - /* Evaluate and remember the start of the section. */ start = info->start[n]; stride = gfc_evaluate_now (stride, &loop.pre); @@ -5505,6 +5501,12 @@ gfc_conv_expr_descriptor (gfc_se * se, gfc_expr * expr, gfc_ss * ss) /* Vector subscripts need copying and are handled elsewhere. */ if (info->ref) gcc_assert (info->ref->u.ar.dimen_type[n] == DIMEN_RANGE); + + /* look for the corresponding scalarizer dimension: dim. */ + for (dim = 0; dim < ndim; dim++) + if (info->dim[dim] == n) + break; + gcc_assert (dim < ndim); /* Set the new lower bound. */ from = loop.from[dim]; @@ -5559,8 +5561,6 @@ gfc_conv_expr_descriptor (gfc_se * se, gfc_expr * expr, gfc_ss * ss) /* Store the new stride. */ gfc_conv_descriptor_stride_set (&loop.pre, parm, gfc_rank_cst[dim], stride); - - dim++; } if (se->data_not_needed)