This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
4.4 C++ PATCH for c++/43024 (ice with -O2)
- From: Jason Merrill <jason at redhat dot com>
- To: gcc-patches List <gcc-patches at gcc dot gnu dot org>
- Cc: Volker Reichelt <reichelt at igpm dot rwth-aachen dot de>
- Date: Fri, 12 Feb 2010 17:26:24 -0500
- Subject: 4.4 C++ PATCH for c++/43024 (ice with -O2)
This is basically the same bug as 41183: cloning doesn't preserve
cfun->language, so when mangling wants to do some template substitution,
anything that relies on cfun->language being set will SEGV. So we apply
the same robustification fix.
Tested x86_64-pc-linux-gnu, applied to 4.4 and trunk. I don't have a
suitable reduced testcase to add to the testsuite; the one in the PR is
large even after delta and doesn't crash on i686, just x86_64. Volker,
could I ask you to to take a shot at reducing it further?
commit cf09b0043373c7d36deebe0be4dc887c5505cbbb
Author: Jason Merrill <jason@redhat.com>
Date: Thu Feb 11 22:21:49 2010 +0100
PR c++/43024
* name-lookup.h (current_binding_level): Check for null
cp_function_chain.
diff --git a/gcc/cp/name-lookup.h b/gcc/cp/name-lookup.h
index eab27ee..f78fdc6 100644
--- a/gcc/cp/name-lookup.h
+++ b/gcc/cp/name-lookup.h
@@ -263,7 +263,7 @@ struct cp_binding_level GTY(())
/* The binding level currently in effect. */
#define current_binding_level \
- (*(cfun && cp_function_chain->bindings \
+ (*(cfun && cp_function_chain && cp_function_chain->bindings \
? &cp_function_chain->bindings \
: &scope_chain->bindings))