public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jason Merrill <jason@redhat.com>
To: gcc-patches List <gcc-patches@gcc.gnu.org>
Subject: C++ PATCH for objc++/49221 (many EH fails in objc++ testsuite)
Date: Mon, 06 Jun 2011 04:11:00 -0000	[thread overview]
Message-ID: <4DEC5347.1060807@redhat.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 363 bytes --]

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.

[-- Attachment #2: 49221.patch --]
[-- Type: text/x-patch, Size: 836 bytes --]

commit ea2b4023d77cbb75ffdb0f71fec35d366b759a70
Author: Jason Merrill <jason@redhat.com>
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

                 reply	other threads:[~2011-06-06  4:11 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4DEC5347.1060807@redhat.com \
    --to=jason@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).