From: Gabriel Dos Reis Date: Sat, 1 May 2004 20:27:40 +0000 (+0000) Subject: backport: re PR c++/14763 (internal compiler error: in find_function_data, at... X-Git-Tag: releases/gcc-3.3.4~59 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e238863440ab550da03497a56bc47ea5718ef0f2;p=thirdparty%2Fgcc.git backport: re PR c++/14763 (internal compiler error: in find_function_data, at function.c:320) Backport from gcc-3_4-branch 2004-03-30 Mark Mitchell Jakub Jelinek PR c++/14763 * pt.c (tsubst_default_argument): Clear current_function_decl. * decl2.c (mark_used): Don't segfault if cfun != NULL but current_function_decl == NULL. From-SVN: r81395 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index abc8892cf406..e5f90d9e8a1b 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,13 @@ +2004-05-01 Gabriel Dos Reis + + Backport from gcc-3_4-branch + 2004-03-30 Mark Mitchell + Jakub Jelinek + PR c++/14763 + * pt.c (tsubst_default_argument): Clear current_function_decl. + * decl2.c (mark_used): Don't segfault if cfun != NULL but + current_function_decl == NULL. + 2004-05-01 Gabriel Dos Reis Backport from gcc-3_4-branch: diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c index 50bb3e2fa79f..f172e84c9740 100644 --- a/gcc/cp/decl2.c +++ b/gcc/cp/decl2.c @@ -4879,6 +4879,7 @@ mark_used (decl) generate its body to find that out. */ || TREE_NOTHROW (decl) || !cfun + || !current_function_decl /* If we already know the current function can't throw, then we don't need to work hard to prove it. */ || TREE_NOTHROW (current_function_decl) diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 0f35b1e356ae..ee7f7dbfffcb 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -5905,6 +5905,10 @@ tsubst_default_argument (fn, type, arg) /* FN is already the desired FUNCTION_DECL. */ push_access_scope (fn); + /* The default argument expression should not be considered to be + within the scope of FN. Since push_access_scope sets + current_function_decl, we must explicitly clear it here. */ + current_function_decl = NULL_TREE; arg = tsubst_expr (arg, DECL_TI_ARGS (fn), tf_error | tf_warning, NULL_TREE);