From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 130212 invoked by alias); 12 Nov 2015 20:59:16 -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 130193 invoked by uid 89); 12 Nov 2015 20:59:15 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.3 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 X-HELO: relay1.mentorg.com Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 12 Nov 2015 20:59:13 +0000 Received: from nat-ies.mentorg.com ([192.94.31.2] helo=SVR-IES-FEM-01.mgc.mentorg.com) by relay1.mentorg.com with esmtp id 1Zwyxa-0003d8-Pj from joseph_myers@mentor.com ; Thu, 12 Nov 2015 12:59:10 -0800 Received: from digraph.polyomino.org.uk (137.202.0.76) by SVR-IES-FEM-01.mgc.mentorg.com (137.202.0.104) with Microsoft SMTP Server id 14.3.224.2; Thu, 12 Nov 2015 20:59:09 +0000 Received: from jsm28 (helo=localhost) by digraph.polyomino.org.uk with local-esmtp (Exim 4.82) (envelope-from ) id 1ZwyxX-0005Lh-OB; Thu, 12 Nov 2015 20:59:07 +0000 Date: Thu, 12 Nov 2015 20:59:00 -0000 From: Joseph Myers To: Marek Polacek CC: GCC Patches Subject: Re: [C PATCH] Fix parsing when using declarations in for loops and typedefs (PR c/67784) In-Reply-To: <20151112195719.GG3185@redhat.com> Message-ID: References: <20151112195719.GG3185@redhat.com> User-Agent: Alpine 2.10 (DEB 1266 2009-07-14) MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" X-SW-Source: 2015-11/txt/msg01598.txt.bz2 On Thu, 12 Nov 2015, Marek Polacek wrote: > As explained in the PR, the issue here was that we were treating a TYPENAME > wrongly as an ID. That happened because we were using information from the > wrong scope when parsing a token after an else clause. I.e. in fn1 in the > attached testcase we need to examine the token after "if (1);" to see if it's > the "else" keyword, but when it's not, we use the scope of the for loop when > classifying the token, so we wrongly see "T" as a identifier of a variable. > Fixed by examining the token again and reclassifying it. > > Moreover, we were ICEing in a similar scenario, treating ID as a TYPENAME, as > demonstrated in pr67784-2.c. The fix is analogical. > > Bootstrapped/regtested on x86_64-linux, ok for trunk? OK. -- Joseph S. Myers joseph@codesourcery.com