From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9001 invoked by alias); 6 Jun 2011 04:11:07 -0000 Received: (qmail 8992 invoked by uid 22791); 6 Jun 2011 04:11:06 -0000 X-SWARE-Spam-Status: No, hits=-6.4 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,SPF_HELO_PASS,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 06 Jun 2011 04:10:49 +0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p564Amdo001023 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 6 Jun 2011 00:10:49 -0400 Received: from [127.0.0.1] (ovpn-113-53.phx2.redhat.com [10.3.113.53]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id p564AmQL021773 for ; Mon, 6 Jun 2011 00:10:48 -0400 Message-ID: <4DEC5347.1060807@redhat.com> Date: Mon, 06 Jun 2011 04:11:00 -0000 From: Jason Merrill User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.17) Gecko/20110428 Fedora/3.1.10-1.fc14 Lightning/1.0b2 Thunderbird/3.1.10 MIME-Version: 1.0 To: gcc-patches List Subject: C++ PATCH for objc++/49221 (many EH fails in objc++ testsuite) Content-Type: multipart/mixed; boundary="------------000201020205070404060305" 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-06/txt/msg00352.txt.bz2 This is a multi-part message in MIME format. --------------000201020205070404060305 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-length: 363 This was happening because objc_eh_runtime_type wanted to create global decls while we were in the middle of processing a function, and cp_finish_decl assumed that if we're in a function the decl must belong to the function. We can avoid that assumption by checking the DECL_CONTEXT rather than current scope. Tested x86_64-pc-linux-gnu, applying to trunk. --------------000201020205070404060305 Content-Type: text/x-patch; name="49221.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="49221.patch" Content-length: 836 commit ea2b4023d77cbb75ffdb0f71fec35d366b759a70 Author: Jason Merrill Date: Sun Jun 5 23:42:13 2011 -0400 PR objc++/49221 * decl.c (cp_finish_decl): Check DECL_FUNCTION_SCOPE_P rather than at_function_scope_p. diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 232b5cf..30f70d9 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -6190,7 +6190,7 @@ cp_finish_decl (tree decl, tree init, bool init_const_expr_p, /* Add this declaration to the statement-tree. This needs to happen after the call to check_initializer so that the DECL_EXPR for a reference temp is added before the DECL_EXPR for the reference itself. */ - if (at_function_scope_p ()) + if (DECL_FUNCTION_SCOPE_P (decl)) add_decl_expr (decl); /* Let the middle end know about variables and functions -- but not --------------000201020205070404060305--