From patchwork Wed Mar 21 17:30:57 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Diego Novillo X-Patchwork-Id: 148043 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 AB6F5B6FE9 for ; Thu, 22 Mar 2012 04:31:46 +1100 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1332955907; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Received:Received:Received:Received:Received:Received:To:Subject: Message-Id:Date:From:Mailing-List:Precedence:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:Sender: Delivered-To; bh=S+KRWmwZNpaLx2U3anFfvFhEmU8=; b=OFsbcLG7M/+OF9K Jrsui3Z/ncT5TupgUIEhz3DhS1WdW+RpCXOhb/2CL6uXs4mWMA81r3QxVPRMfpzl 7I3XjB6WNcSjXksxHvWOQCsqpX2c0p+I0KLBgh5BJcmQP48dozA4DIl5N57rqTMb cy4TPNt0BInnvnKKp4e0/6VLT8NQ= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:Received:Received:X-Google-DKIM-Signature:Received:Received:Received:Received:Received:To:Subject:Message-Id:Date:From:X-Gm-Message-State:X-detected-operating-system:X-Received-From:X-IsSubscribed:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=pEuTuC8qmANk4W1dGaB7vCGlUOzAfgEB/QksUA/7p/aoPhcVwIYa21tBKgYK6h HyHyI36sm4VBKztVP1XbJ24Ob1kBG/OATQWoHre/c7ysQaML1XuPqpNlUkv+KykN XLF/LvlYD+x1b5e/6Gr5Df0oHAxjR4bZ57I46VtpfBM+I=; Received: (qmail 13937 invoked by alias); 21 Mar 2012 17:31:38 -0000 Received: (qmail 13767 invoked by uid 22791); 21 Mar 2012 17:31:34 -0000 X-SWARE-Spam-Status: No, hits=-4.3 required=5.0 tests=AWL, BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_HI, SPF_SOFTFAIL X-Spam-Check-By: sourceware.org Received: from eggs.gnu.org (HELO eggs.gnu.org) (208.118.235.92) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 21 Mar 2012 17:31:12 +0000 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SAPNI-0008LI-P0 for gcc-patches@gcc.gnu.org; Wed, 21 Mar 2012 13:31:11 -0400 Received: from mail-qa0-f73.google.com ([209.85.216.73]:47497) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SAPNI-0008L0-Hw for gcc-patches@gcc.gnu.org; Wed, 21 Mar 2012 13:31:04 -0400 Received: by qafk30 with SMTP id k30so83412qaf.2 for ; Wed, 21 Mar 2012 10:30:59 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=to:subject:message-id:date:from:x-gm-message-state; bh=vvsUFjhMACIkhXZ1E31abwrOkd+IwU14xgEx7Mmnw08=; b=oUwRQEQ2vtycw9/TMWEnx8ntcvipmxvw+JV+DBRj1FWse/ssxlKEkcYi6ZomSgdHtW xSycKpp8VFUQ0JpLbYBm9u/lfMmt4inU9FZFLxc0JHxliZHEhNpOFsYl8ITJdfaDDDrn Vx7BUN1PTHCRQSBn9rV6o2N23QwpTVsWMrwdfWIPxsANi/7hLtEdZyo+lgytbIJEp40f C5Y27xQfW7A5KE91R908xAkmdAvtqTaGocukVpzBOhBH0O/JML6par6qlCvJPMhN3Q/o F1uBXhdpKImglXYJcRtM1UygJH2KfMQG+P/GDyRri6nJFqiWQ70/m6Hf8JlVbZfcgaAI zP2Q== Received: by 10.100.77.1 with SMTP id z1mr1836821ana.5.1332351058938; Wed, 21 Mar 2012 10:30:58 -0700 (PDT) Received: by 10.100.77.1 with SMTP id z1mr1836810ana.5.1332351058831; Wed, 21 Mar 2012 10:30:58 -0700 (PDT) Received: from wpzn3.hot.corp.google.com (216-239-44-65.google.com [216.239.44.65]) by gmr-mx.google.com with ESMTPS id g10si1429099yhn.7.2012.03.21.10.30.58 (version=TLSv1/SSLv3 cipher=AES128-SHA); Wed, 21 Mar 2012 10:30:58 -0700 (PDT) Received: from torture.tor.corp.google.com (torture.tor.corp.google.com [172.29.41.4]) by wpzn3.hot.corp.google.com (Postfix) with ESMTP id B843A10004D; Wed, 21 Mar 2012 10:30:58 -0700 (PDT) Received: by torture.tor.corp.google.com (Postfix, from userid 54752) id 0D3EA102888; Wed, 21 Mar 2012 13:30:57 -0400 (EDT) To: reply@codereview.appspotmail.com, crowl@google.com, gcc-patches@gcc.gnu.org Subject: [pph] Fix x1mbstate_t.h (issue5872043) Message-Id: <20120321173058.0D3EA102888@torture.tor.corp.google.com> Date: Wed, 21 Mar 2012 13:30:57 -0400 (EDT) From: dnovillo@google.com (Diego Novillo) X-Gm-Message-State: ALoCoQmxz00t6/sqJTLDVxXB8X9+UfsXiKj7sLxx4xy0od8jrkztel/bK/H8/BD35KwruDNv1LFl0VmzRmTNBIVcdfmZZDVV4H94L9InSDiF+VizV+d1J2zBCnM1GwVVD4pIKLSWs8peU6H1UotOjxUDRoGfLqsGgDvOGUkKGzvW1IeQ+hjXRnY= X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.85.216.73 X-IsSubscribed: yes 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 Fix x1mbstate_t.h. This patch fixes the parser segmentation fault caused by a name lookup failure (details in http://gcc.gnu.org/ml/gcc-patches/2012-03/msg01369.html). I am not 100% sure that this is the right fix, but Jason seems to think that the theory behind this is fine (parser does no allow a USING_DECL to be set in the bindings of an identifier). I left a FIXME note to help future debugging. 2012-03-21 Diego Novillo cp/ChangeLog.pph * name-lookup.c (pph_set_namespace_decl_binding): Ignore USING_DECLs. testsuite/ChangeLog.pph * g++.dg/pph/x1mbstate_t.h: Mark fixed. --- This patch is available for review at http://codereview.appspot.com/5872043 diff --git a/gcc/cp/name-lookup.c b/gcc/cp/name-lookup.c index 947708d..1b33ce3 100644 --- a/gcc/cp/name-lookup.c +++ b/gcc/cp/name-lookup.c @@ -6271,7 +6271,11 @@ pph_set_namespace_decl_binding (tree decl, cp_binding_level *bl, int flags) { /* Set the namespace identifier binding for a single decl. */ tree id = DECL_NAME (decl); - if (id) + /* FIXME pph. USING_DECLs do not seem to be used in bindings by + the parser. This was causing the SEGV in + testsuite/g++.dg/pph/x1mbstate_t.h. It's unclear whether this is + the right fix. */ + if (id && TREE_CODE (decl) != USING_DECL) pph_set_identifier_binding (id, decl, bl, flags); } diff --git a/gcc/testsuite/g++.dg/pph/x1mbstate_t.h b/gcc/testsuite/g++.dg/pph/x1mbstate_t.h index c07a0cc..4d473e4 100644 --- a/gcc/testsuite/g++.dg/pph/x1mbstate_t.h +++ b/gcc/testsuite/g++.dg/pph/x1mbstate_t.h @@ -1,9 +1,8 @@ -// { dg-xfail-if "identifier bindings not set properly" { "*-*-*" } { "-fpph-map=pph.map"} } -// { dg-bogus ".*Segmentation fault" "ICE trying to parse std::mbstate_t" { xfail *-*-* } 0 } #ifndef _X1_MBSTATE_H #define _X1_MBSTATE_H #include "x0mbstate_t.h" -// Name lookup for std::mbstate_t fails here. Instead of returning the global -// type_decl for mbstate_t, it returns the "usings ::mbstate_t" declaration. +// Name lookup for std::mbstate_t was failingfails here. Instead of returning +// the global type_decl for mbstate_t, it was returning the +// "usings ::mbstate_t" declaration. typedef std::mbstate_t state_type; #endif