From patchwork Thu Jul 26 08:41:56 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tobias Burnus X-Patchwork-Id: 173370 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 40E472C008C for ; Thu, 26 Jul 2012 18:42:31 +1000 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1343896951; h=Comment: DomainKey-Signature:Received:Received:Received:Received: Message-ID:Date:From:User-Agent:MIME-Version:To:CC:Subject: References:In-Reply-To:Content-Type:Mailing-List:Precedence: List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender: Delivered-To; bh=JQ+mVEq7g8BSObOOOg6Ukk5yRo0=; b=fTbtzd2u+xvYXNo 6zn9mX1kHExBr5Vr+RSOfIIhzQOB3bSLz0aWKZ9ZJ40XIaJDDqVN9pg5gE3uOUJZ oIQWiXg/ZwaHjJpB7wgjwPKG2xLZIOo7NkCL/YXL1les9bRvpHK5WPRCXu1q5815 2zVnkXl9W20iyQ2NmgYLCXTRDlwE= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:Message-ID:Date:From:User-Agent:MIME-Version:To:CC:Subject:References:In-Reply-To:Content-Type:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=wXT/MOajEhbdPtIsfviochtDgs2ORO+MOzlJNgUgSGQg+AY066rYhB7bZC0pHZ SAQydxgQgxtrvsGC33sh/dizeFOkFixWbqy8lBnhK1c7GKSsQPKRPBxFceGKm9Xt PzPHpRHdUAoAEV8rzaDV0z4/y8GjDRgjdPqbWKOZj7REo=; Received: (qmail 32249 invoked by alias); 26 Jul 2012 08:42:25 -0000 Received: (qmail 32223 invoked by uid 22791); 26 Jul 2012 08:42:22 -0000 X-SWARE-Spam-Status: No, hits=-2.6 required=5.0 tests=AWL, BAYES_00, KHOP_THREADED, RCVD_IN_DNSWL_NONE X-Spam-Check-By: sourceware.org Received: from mx01.qsc.de (HELO mx01.qsc.de) (213.148.129.14) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 26 Jul 2012 08:42:07 +0000 Received: from [192.168.178.22] (port-92-204-86-97.dynamic.qsc.de [92.204.86.97]) by mx01.qsc.de (Postfix) with ESMTP id 663593D29B; Thu, 26 Jul 2012 10:41:59 +0200 (CEST) Message-ID: <501102D4.6050300@net-b.de> Date: Thu, 26 Jul 2012 10:41:56 +0200 From: Tobias Burnus User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:14.0) Gecko/20120713 Thunderbird/14.0 MIME-Version: 1.0 To: Mikael Morin CC: gfortran , gcc patches Subject: Re: [Patch, Fortran] Fix module I/O with assumed-rank arrays References: <50105221.5060702@net-b.de> <501063E8.3040601@net-b.de> <5010F916.7050305@sfr.fr> In-Reply-To: <5010F916.7050305@sfr.fr> 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 On 07/26/2012 10:00 AM, Mikael Morin wrote: > I assume this sits on top of the previous patch? Then OK for both. Yes. It was supposed to be a complete patch, but as I screwed up (git diff vs. git diff --cached, combined with git add), it was only an interdiff. Thanks for the review. I committed it as Rev. 189881. Tobias, who should really avoid late-evening patches and feels the need for vacation. Index: gcc/fortran/ChangeLog =================================================================== --- gcc/fortran/ChangeLog (revision 189880) +++ gcc/fortran/ChangeLog (working copy) @@ -1,3 +1,9 @@ +2012-07-26 Alessandro Fanfarillo + Tobias Burnus + + * module.c (mio_array_spec): Don't read as->lower for + assumed-rank arrays. + 2012-07-25 Tobias Burnus * trans-types.c (gfc_real16_is_float128): Fix spelling Index: gcc/fortran/module.c =================================================================== --- gcc/fortran/module.c (revision 189880) +++ gcc/fortran/module.c (working copy) @@ -2359,9 +2359,15 @@ if (iomode == IO_OUTPUT) { + int rank; + if (*asp == NULL) goto done; as = *asp; + + /* mio_integer expects nonnegative values. */ + rank = as->rank > 0 ? as->rank : 0; + mio_integer (&rank); } else { @@ -2372,20 +2378,23 @@ } *asp = as = gfc_get_array_spec (); + mio_integer (&as->rank); } - mio_integer (&as->rank); mio_integer (&as->corank); as->type = MIO_NAME (array_type) (as->type, array_spec_types); + if (iomode == IO_INPUT && as->type == AS_ASSUMED_RANK) + as->rank = -1; if (iomode == IO_INPUT && as->corank) as->cotype = (as->type == AS_DEFERRED) ? AS_DEFERRED : AS_EXPLICIT; - for (i = 0; i < as->rank + as->corank; i++) - { - mio_expr (&as->lower[i]); - mio_expr (&as->upper[i]); - } + if (as->rank > 0) + for (i = 0; i < as->rank + as->corank; i++) + { + mio_expr (&as->lower[i]); + mio_expr (&as->upper[i]); + } done: mio_rparen ();