From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 61608 invoked by alias); 7 Nov 2015 05:13:58 -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 61264 invoked by uid 89); 7 Nov 2015 05:13:57 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.7 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Sat, 07 Nov 2015 05:13:56 +0000 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by mx1.redhat.com (Postfix) with ESMTPS id 8E62E8E360; Sat, 7 Nov 2015 05:13:55 +0000 (UTC) Received: from localhost.localdomain (ovpn-113-107.phx2.redhat.com [10.3.113.107]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id tA75Dtqo021493; Sat, 7 Nov 2015 00:13:55 -0500 Subject: Re: [PATCH v3 1/2] [PR debug/67192] Fix C loops' back-jump location To: Andreas Arnez , gcc-patches@gcc.gnu.org References: From: Jeff Law Message-ID: <563D8892.4040705@redhat.com> Date: Sat, 07 Nov 2015 05:13:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2015-11/txt/msg00763.txt.bz2 On 11/04/2015 09:17 AM, Andreas Arnez wrote: > Since r223098 ("Implement -Wmisleading-indentation") the backward-jump > generated for a C while- or for-loop can get the wrong line number. > This is because the check for misleading indentation peeks ahead one > token, advancing input_location to after the loop, and then > c_finish_loop() creates the back-jump and calls add_stmt(), which > assigns input_location to the statement by default. > > This patch swaps the check for misleading indentation with the finishing > of the loop, such that input_location still has the right value at the > time of any invocations of add_stmt(). Note that this does not fully > cover all cases where the back-jump gets the wrong location. > > gcc/c/ChangeLog: > > PR debug/67192 > * c-parser.c (c_parser_while_statement): Finish the loop before > parsing ahead for misleading indentation. > (c_parser_for_statement): Likewise. > > gcc/testsuite/ChangeLog: > > PR debug/67192 > * gcc.dg/guality/pr67192.c: New test. OK. You might consider testing C++ on the same tests. I wouldn't be surprised if it shows the same problem. jeff