From patchwork Fri Sep 7 14:29:06 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Mikael Morin X-Patchwork-Id: 182385 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 01E072C008A for ; Sat, 8 Sep 2012 00:32:14 +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=1347633135; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Message-ID:Date:From:User-Agent:MIME-Version:To:Subject: Content-Type:Mailing-List:Precedence:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:Sender:Delivered-To; bh=rJ5XFYt G2H30/9Tfa/yXg3BIxYc=; b=rnR0v20PVWg+dIPpv+DPexKWppepBQTe4ePOqll MwI+ZlIrrYFPQ0frKb2Lb3Gp1R8rcuibPrO+GnfzLichIDS+FtiNAA9o6NM0L+Ka jkOlwuahkPyR7s2MYOH+pa9eCMwPLxU5Ur0j262TV4tSeAoYKZT5PeonY+zhiWv6 P76M= 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:Received:X-SFR-UUID:Message-ID:Date:From:User-Agent:MIME-Version:To:Subject:Content-Type:X-IsSubscribed:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=Hnwhm62WWET9l+vFyjW9vei/XvWf+GhAT5zrBoNvmf0DDAbLMMeldF8L4h9rrz dfyBphY7/IAblXXXaUm45oAf86gZRPK4eTYCeEn5Yp5NwDiV/Z7fhi5mRtWjm580 phoKcSlVHpa0JKJ/GWImWfBipQnJfiM3TOPjc3Kcb8cxI=; Received: (qmail 8070 invoked by alias); 7 Sep 2012 14:32:06 -0000 Received: (qmail 8057 invoked by uid 22791); 7 Sep 2012 14:32:05 -0000 X-SWARE-Spam-Status: No, hits=-1.6 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_NONE, RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from smtp21.services.sfr.fr (HELO smtp21.services.sfr.fr) (93.17.128.4) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 07 Sep 2012 14:31:50 +0000 Received: from filter.sfr.fr (localhost [127.0.0.1]) by msfrf2117.sfr.fr (SMTP Server) with ESMTP id D4D077000118; Fri, 7 Sep 2012 16:31:48 +0200 (CEST) Received: from [192.168.1.58] (37.15.72.86.rev.sfr.net [86.72.15.37]) by msfrf2117.sfr.fr (SMTP Server) with ESMTP id 9201F70000F3; Fri, 7 Sep 2012 16:31:48 +0200 (CEST) X-SFR-UUID: 20120907143148598.9201F70000F3@msfrf2117.sfr.fr Message-ID: <504A04B2.1000407@sfr.fr> Date: Fri, 07 Sep 2012 16:29:06 +0200 From: Mikael Morin User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:10.0.6esrpre) Gecko/20120811 Thunderbird/10.0.6 MIME-Version: 1.0 To: gfortran , gcc-patches Subject: [Patch, fortran] PR 54208 compilation error for ubound construct in PARAMETER statements 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 Hello, here comes a low hanging regression(4.6/4.7/4.8) fix. In the test provided: integer, parameter :: n=2 integer, dimension(1-min(n,2)/2:n) :: arr integer, parameter :: i=ubound(arr,1) gfc_match_init_expr checks right away (at parse time) that the definition for `i' is a constant (so called init-) expression. However, `arr' is resolved too late for the ubound call to be simplified, so that the expression is seen as non-constant. The solution is to add the missing call to gfc_resolve_array_spec. Janus had a patch that added it in resolve_variable, but it regressed. This patch adds the call in simplify_bound_dim instead. Regression tested on x86_64-unknown-linux-gnu. OK for 4.8/4.7/4.6? Mikael 2012-09-07 Mikael Morin PR fortran/54208 * simplify.c (simplify_bound_dim): Resolve array spec before proceeding with simplification. 2012-09-07 Mikael Morin PR fortran/54208 * gfortran.dg/bound_simplification_3.f90: New test. Index: simplify.c =================================================================== --- simplify.c (révision 190976) +++ simplify.c (copie de travail) @@ -3255,6 +3255,9 @@ simplify_bound_dim (gfc_expr *array, gfc_expr *kin gcc_assert (array->expr_type == EXPR_VARIABLE); gcc_assert (as); + if (gfc_resolve_array_spec (as, 0) == FAILURE) + return NULL; + /* The last dimension of an assumed-size array is special. */ if ((!coarray && d == as->rank && as->type == AS_ASSUMED_SIZE && !upper) || (coarray && d == as->rank + as->corank