From patchwork Fri Oct 7 14:38:47 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mikael Morin X-Patchwork-Id: 118326 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 B9BAEB70F5 for ; Sat, 8 Oct 2011 01:39:50 +1100 (EST) Received: (qmail 10000 invoked by alias); 7 Oct 2011 14:39:34 -0000 Received: (qmail 9846 invoked by uid 22791); 7 Oct 2011 14:39:33 -0000 X-SWARE-Spam-Status: No, hits=-0.4 required=5.0 tests=AWL, BAYES_00, SPF_NEUTRAL X-Spam-Check-By: sourceware.org Received: from eggs.gnu.org (HELO eggs.gnu.org) (140.186.70.92) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 07 Oct 2011 14:39:17 +0000 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RCBZx-0000jK-3b for gcc-patches@gcc.gnu.org; Fri, 07 Oct 2011 10:39:16 -0400 Received: from smtp21.services.sfr.fr ([93.17.128.4]:13488) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RCBZb-0000eG-GC; Fri, 07 Oct 2011 10:38:51 -0400 Received: from filter.sfr.fr (localhost [127.0.0.1]) by msfrf2116.sfr.fr (SMTP Server) with ESMTP id C6D047000194; Fri, 7 Oct 2011 16:38:47 +0200 (CEST) Received: from gimli.local (55.123.193.77.rev.sfr.net [77.193.123.55]) by msfrf2116.sfr.fr (SMTP Server) with ESMTP id 92EE07000103; Fri, 7 Oct 2011 16:38:47 +0200 (CEST) X-SFR-UUID: 20111007143847601.92EE07000103@msfrf2116.sfr.fr MIME-Version: 1.0 From: Mikael Morin To: gfortran , GCC patches Message-ID: <20111007143807.3558.31760@gimli.local> In-Reply-To: <20111007143743.3558.82419@gimli.local> References: <20111007143743.3558.82419@gimli.local> Subject: [Patch, fortran] [12/14] Support coarray subreferences: Fix simplify_cobound Date: Fri, 7 Oct 2011 16:38:47 +0200 (CEST) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 93.17.128.4 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 simplify_cobound, when it looks for the coarray reference, in the AR_ELEMENT case, first checks that it is the last reference in the chain. As it is what we are trying to avoid, this patch removes that and uses the corank field directly. OK? 2011-10-06 Mikael Morin PR fortran/50420 * simplify.c (simplify_cobound): Accept non-last-in-ref-chain coarrays. Don't set already set array ref. diff --git a/simplify.c b/simplify.c index 13a9c51..63689bb 100644 --- a/simplify.c +++ b/simplify.c @@ -3512,11 +3512,9 @@ simplify_cobound (gfc_expr *array, gfc_expr *dim, gfc_expr *kind, int upper) switch (ref->u.ar.type) { case AR_ELEMENT: - if (ref->next == NULL) + if (ref->u.ar.as->corank > 0) { - gcc_assert (ref->u.ar.as->corank > 0 - && ref->u.ar.as->rank == 0); - as = ref->u.ar.as; + gcc_assert (as == ref->u.ar.as); goto done; } as = NULL;