From patchwork Thu Jul 29 07:49:09 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Kraft X-Patchwork-Id: 60195 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 165A91007D4 for ; Thu, 29 Jul 2010 17:44:21 +1000 (EST) Received: (qmail 15759 invoked by alias); 29 Jul 2010 07:44:17 -0000 Received: (qmail 15730 invoked by uid 22791); 29 Jul 2010 07:44:15 -0000 X-SWARE-Spam-Status: No, hits=-2.5 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_LOW, SPF_HELO_PASS X-Spam-Check-By: sourceware.org Received: from taro.utanet.at (HELO taro.utanet.at) (213.90.36.45) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 29 Jul 2010 07:44:10 +0000 Received: from paris.xoc.tele2net.at ([213.90.36.7]) by taro.utanet.at with esmtp (Exim 4.71) (envelope-from ) id 1OeNmf-0004Aw-6C; Thu, 29 Jul 2010 09:44:05 +0200 Received: from d86-33-197-98.cust.tele2.at ([86.33.197.98] helo=[192.168.1.18]) by paris.xoc.tele2net.at with esmtpa (Exim 4.71) (envelope-from ) id 1OeNmf-0004JL-0l; Thu, 29 Jul 2010 09:44:05 +0200 Message-ID: <4C513275.7010802@domob.eu> Date: Thu, 29 Jul 2010 09:49:09 +0200 From: Daniel Kraft User-Agent: Thunderbird 2.0.0.0 (X11/20070425) MIME-Version: 1.0 To: Fortran List , gcc-patches Subject: [Patch, Fortran] PR fortran/45117: Fix error message 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 Hi all, this small patch fixes PR 45117. The problem (obviously) was that the error reporting assumed the expression to be of type variable (which is also clear from the message text), and for non-variable expressions I introduced a new alternative. Ok for trunk if no regressions on GNU/Linux-x86-32? Daniel Index: gcc/fortran/array.c =================================================================== --- gcc/fortran/array.c (revision 162647) +++ gcc/fortran/array.c (working copy) @@ -300,10 +300,14 @@ resolve_array_bound (gfc_expr *e, int ch || gfc_specification_expr (e) == FAILURE) return FAILURE; - if (check_constant && gfc_is_constant_expr (e) == 0) + if (check_constant && !gfc_is_constant_expr (e)) { - gfc_error ("Variable '%s' at %L in this context must be constant", - e->symtree->n.sym->name, &e->where); + if (e->expr_type == EXPR_VARIABLE) + gfc_error ("Variable '%s' at %L in this context must be constant", + e->symtree->n.sym->name, &e->where); + else + gfc_error ("Expression at %L in this context must be constant", + &e->where); return FAILURE; }