From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19106 invoked by alias); 23 Aug 2011 12:27:18 -0000 Received: (qmail 19089 invoked by uid 22791); 23 Aug 2011 12:27:16 -0000 X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL,BAYES_00,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; Tue, 23 Aug 2011 12:27:01 +0000 Received: from [192.168.178.22] (port-92-204-66-235.dynamic.qsc.de [92.204.66.235]) by mx01.qsc.de (Postfix) with ESMTP id 074C33E3F8; Tue, 23 Aug 2011 14:26:59 +0200 (CEST) Message-ID: <4E539C93.7070704@net-b.de> Date: Tue, 23 Aug 2011 14:19:00 -0000 From: Tobias Burnus User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:6.0) Gecko/20110812 Thunderbird/6.0 MIME-Version: 1.0 To: gcc patches , gfortran Subject: [Patch, Fortran] PR 50163 - ICE with nonconst expr in init expr Content-Type: multipart/mixed; boundary="------------070304040807010105000707" 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 X-SW-Source: 2011-08/txt/msg01886.txt.bz2 This is a multi-part message in MIME format. --------------070304040807010105000707 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-length: 437 The bug is a regression: An error was printed with 4.1.x but since 4.3.x one gets an ICE. [No idea what GCC 4.2 does.] The solution is simply: Returning if there is a MATCH_ERROR. See PR (esp. comment 2) for a more detailed description: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50163#c0 Build and regtested on x86-64-linux. OK for the trunk? And to which version should it be backported? Only 4.6? Also 4.5? Or even 4.4? Tobias --------------070304040807010105000707 Content-Type: text/x-patch; name="init-err-fix.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="init-err-fix.diff" Content-length: 1010 2011-08-23 Tobias Burnus PR fortran/50163 * check_init_expr (check_init_expr): Return when an error occured. 2011-08-23 Tobias Burnus PR fortran/50163 * gfortran.dg/initialization_28.f90: New. diff --git a/gcc/fortran/expr.c b/gcc/fortran/expr.c index 9922094..b050b11 100644 --- a/gcc/fortran/expr.c +++ b/gcc/fortran/expr.c @@ -2481,6 +2481,9 @@ check_init_expr (gfc_expr *e) m = MATCH_ERROR; } + if (m == MATCH_ERROR) + return FAILURE; + /* Try to scalarize an elemental intrinsic function that has an array argument. */ isym = gfc_find_function (e->symtree->n.sym->name); --- /dev/null 2011-08-23 07:28:57.751883742 +0200 +++ gcc/gcc/testsuite/gfortran.dg/initialization_28.f90 2011-08-23 14:02:02.000000000 +0200 @@ -0,0 +1,9 @@ +! { dg-do compile } +! +! PR fortran/50163 +! +! Contributed by Philip Mason +! +character(len=2) :: xx ='aa' +integer :: iloc=index(xx,'bb') ! { dg-error "has not been declared or is a variable" } +end --------------070304040807010105000707--