From patchwork Wed Jul 17 12:04:20 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Mikael Morin X-Patchwork-Id: 259690 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]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "localhost", Issuer "www.qmailtoaster.com" (not verified)) by ozlabs.org (Postfix) with ESMTPS id EC84D2C0097 for ; Wed, 17 Jul 2013 22:06:06 +1000 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :message-id:date:from:mime-version:to:cc:subject:references :in-reply-to:content-type:content-transfer-encoding; q=dns; s= default; b=TuV/NHpwHZK+rMs4BJE/xKgbkABF7mvJdK/Z0rnXJp8v0a6bBWzyo Hkwyy6NMx3+IiyUnMP7YPYS652jvHTZrt7vTngofTFpKCkzTS27VIaYlcYyvFVhs H4huKQXYJR8gGt9rcXYQLonwM61k/b/8Ua3pjYRunqowud3YNpgLrc= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :message-id:date:from:mime-version:to:cc:subject:references :in-reply-to:content-type:content-transfer-encoding; s=default; bh=9AMmpKEYdkBo8FuuNw3fleU/XLM=; b=kF9ON70LvJ0MXxL6Lxk3u/5D2ABK hyaX8nFZkrf49Wc0qaKPqcioh80hv7qpcmL64bcqPqbOylkaLlHlXc0SR1ziwpjC NqFTQ/zEojN8aNiVwO1fk2TaSCQsqTvr5SA4qW0uMLAPDeVt4cO+DC6tC2kPZ0u9 Y6zODLCkquEunRI= Received: (qmail 4354 invoked by alias); 17 Jul 2013 12:05:59 -0000 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 Received: (qmail 4329 invoked by uid 89); 17 Jul 2013 12:05:59 -0000 X-Spam-SWARE-Status: No, score=-1.0 required=5.0 tests=AWL, BAYES_50, KHOP_THREADED, RCVD_IN_DNSWL_NONE, RCVD_IN_HOSTKARMA_NO, RDNS_NONE, SPF_PASS autolearn=no version=3.3.1 X-Spam-User: qpsmtpd, 2 recipients Received: from Unknown (HELO smtp22.services.sfr.fr) (93.17.128.10) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Wed, 17 Jul 2013 12:05:57 +0000 Received: from filter.sfr.fr (localhost [127.0.0.1]) by msfrf2219.sfr.fr (SMTP Server) with ESMTP id CC0A87000091; Wed, 17 Jul 2013 14:05:49 +0200 (CEST) Received: from [192.168.1.58] (31.183.72.86.rev.sfr.net [86.72.183.31]) by msfrf2219.sfr.fr (SMTP Server) with ESMTP id 7CCAA7000085; Wed, 17 Jul 2013 14:05:49 +0200 (CEST) X-SFR-UUID: 20130717120549511.7CCAA7000085@msfrf2219.sfr.fr Message-ID: <51E68844.9090202@sfr.fr> Date: Wed, 17 Jul 2013 14:04:20 +0200 From: Mikael Morin User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130701 Thunderbird/17.0.7 MIME-Version: 1.0 To: Tobias Burnus CC: gcc patches , gfortran Subject: Re: [Patch, Fortran] PR57895 - avoid segfault and improve diagnostic References: <51E67390.6030904@net-b.de> In-Reply-To: <51E67390.6030904@net-b.de> Le 17/07/2013 12:36, Tobias Burnus a écrit : > Without this patch, GCC 4.3 and later segfault. As Mikael wrote: > "gfc_restore_last_undo_checkpoint seems to take care of the cleanup, so > we don't need to do it in gfc_match_common." > > Additionally, this patch ensures that the error message about the "$" > gets printed - without the change, it doesn't. Well, once the segfault is fixed, it does get printed here. On the other hand... > Initially I had > gfc_error_now instead of gfc_fatal_error. However, that gave tons of > nonhelpful errors for the original test case - and for the test case in > this patch, it prints the same message around twenty times. Hence, > gfc_fatal_error is much more reasonable - even if the test case then no > longer checks for the double free. ... avoiding the many duplicate errors is indeed more reasonable. May I suggest adjusting the error locus one character back by the way: } The patch is OK in any case. Thanks. Mikael --- a/gcc/fortran/match.c +++ b/gcc/fortran/match.c @@ -556,8 +556,8 @@ gfc_match_name (char *buffer) if (c == '$' && !gfc_option.flag_dollar_ok) { - gfc_fatal_error ("Invalid character '$' at %C. Use -fdollar-ok to allow " - "it as an extension"); + gfc_fatal_error ("Invalid character '$' at %L. Use -fdollar-ok to allow " + "it as an extension", &old_loc); return MATCH_ERROR;