From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 110878 invoked by alias); 23 Mar 2015 12:29:05 -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 110860 invoked by uid 89); 23 Mar 2015 12:29:04 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE,SPF_PASS,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-Spam-User: qpsmtpd, 2 recipients X-HELO: smtp23.services.sfr.fr Received: from smtp23.services.sfr.fr (HELO smtp23.services.sfr.fr) (93.17.128.22) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Mon, 23 Mar 2015 12:29:02 +0000 Received: from filter.sfr.fr (localhost [86.72.15.254]) by msfrf2301.sfr.fr (SMTP Server) with ESMTP id 9C51B70000F3; Mon, 23 Mar 2015 13:28:59 +0100 (CET) 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 (254.15.72.86.rev.sfr.net [86.72.15.254]) (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) by msfrf2301.sfr.fr (SMTP Server) with ESMTP id 33DAF70000EE; Mon, 23 Mar 2015 13:28:58 +0100 (CET) X-SFR-UUID: 20150323122859212.33DAF70000EE@msfrf2301.sfr.fr Message-ID: <551006FF.1080704@sfr.fr> Date: Mon, 23 Mar 2015 12:29:00 -0000 From: Mikael Morin User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0 MIME-Version: 1.0 To: Andre Vehreschild , GCC-Fortran-ML , GCC-Patches-ML , Antony Lewis Subject: Re: [Patch 1/2, Fortran, pr60322] [OOP] Incorrect bounds on polymorphic dummy array References: <20150226181717.480e282c@vepi2> In-Reply-To: <20150226181717.480e282c@vepi2> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 8bit X-IsSubscribed: yes X-SW-Source: 2015-03/txt/msg01178.txt.bz2 26/02/2015 18:17, Andre Vehreschild a écrit : > This first patch is only preparatory and does not change any of the semantics of > gfortran at all. Sure? > diff --git a/gcc/fortran/expr.c b/gcc/fortran/expr.c > index ab6f7a5..d28cf77 100644 > --- a/gcc/fortran/expr.c > +++ b/gcc/fortran/expr.c > @@ -4059,10 +4060,10 @@ gfc_lval_expr_from_sym (gfc_symbol *sym) > lval->symtree = gfc_find_symtree (sym->ns->sym_root, sym->name); > > /* It will always be a full array. */ > - lval->rank = sym->as ? sym->as->rank : 0; > + as = sym->as; > + lval->rank = as ? as->rank : 0; > if (lval->rank) > - gfc_add_full_array_ref (lval, sym->ts.type == BT_CLASS ? > - CLASS_DATA (sym)->as : sym->as); > + gfc_add_full_array_ref (lval, as); This is a change of semantics. Or do you know that sym->ts.type != BT_CLASS? > diff --git a/gcc/fortran/trans-decl.c b/gcc/fortran/trans-decl.c > index 3664824..e571a17 100644 > --- a/gcc/fortran/trans-decl.c > +++ b/gcc/fortran/trans-decl.c > @@ -1013,16 +1017,24 @@ gfc_build_dummy_array_decl (gfc_symbol * sym, tree dummy) > tree decl; > tree type; > gfc_array_spec *as; > + symbol_attribute *array_attr; > char *name; > gfc_packed packed; > int n; > bool known_size; > > - if (sym->attr.pointer || sym->attr.allocatable > - || (sym->as && sym->as->type == AS_ASSUMED_RANK)) > + /* Use the array as and attr. */ > + as = sym->as; > + array_attr = &sym->attr; > + > + /* The pointer attribute is always set on a _data component, therefore check > + the sym's attribute only. */ > + if (sym->attr.pointer || array_attr->allocatable > + || (as && as->type == AS_ASSUMED_RANK)) > return dummy; > Any reason to sometimes use array_attr, sometimes not, like here? By the way, the comment is misleading: for classes, there is the class_pointer attribute (and it is a pain, I know). Mikael