Commit e0bffbbb by Jason Merrill

re PR c++/70353 (ICE on __PRETTY_FUNCTION__ in a constexpr function)

	PR c++/70353

gcc/
	* tree-inline.c (remap_decls): Don't add_local_decl if
	cfun is null.
gcc/cp/
	* decl.c (make_rtl_for_nonlocal_decl): Don't defer local statics
	in constexpr functions.

From-SVN: r234530
parent 3336c6e0
2016-03-29 Jakub Jelinek <jakub@redhat.com> 2016-03-29 Jakub Jelinek <jakub@redhat.com>
PR c++/70353
* tree-inline.c (remap_decls): Don't add_local_decl if
cfun is null.
PR tree-optimization/70405 PR tree-optimization/70405
* ssa-iterators.h (num_imm_uses): Add missing braces. * ssa-iterators.h (num_imm_uses): Add missing braces.
......
2016-03-29 Jason Merrill <jason@redhat.com>
PR c++/70353
* decl.c (make_rtl_for_nonlocal_decl): Don't defer local statics
in constexpr functions.
2016-03-28 Jason Merrill <jason@redhat.com> 2016-03-28 Jason Merrill <jason@redhat.com>
PR c++/70422 PR c++/70422
......
...@@ -6251,8 +6251,11 @@ make_rtl_for_nonlocal_decl (tree decl, tree init, const char* asmspec) ...@@ -6251,8 +6251,11 @@ make_rtl_for_nonlocal_decl (tree decl, tree init, const char* asmspec)
return; return;
/* We defer emission of local statics until the corresponding /* We defer emission of local statics until the corresponding
DECL_EXPR is expanded. */ DECL_EXPR is expanded. But with constexpr its function might never
defer_p = DECL_FUNCTION_SCOPE_P (decl) || DECL_VIRTUAL_P (decl); be expanded, so go ahead and tell cgraph about the variable now. */
defer_p = ((DECL_FUNCTION_SCOPE_P (decl)
&& !DECL_DECLARED_CONSTEXPR_P (DECL_CONTEXT (decl)))
|| DECL_VIRTUAL_P (decl));
/* Defer template instantiations. */ /* Defer template instantiations. */
if (DECL_LANG_SPECIFIC (decl) if (DECL_LANG_SPECIFIC (decl)
......
// PR c++/70353
// { dg-do link { target c++11 } }
constexpr const char* ce ()
{
return __func__;
}
const char *c = ce();
int main()
{
}
...@@ -616,7 +616,8 @@ remap_decls (tree decls, vec<tree, va_gc> **nonlocalized_list, ...@@ -616,7 +616,8 @@ remap_decls (tree decls, vec<tree, va_gc> **nonlocalized_list,
/* We need to add this variable to the local decls as otherwise /* We need to add this variable to the local decls as otherwise
nothing else will do so. */ nothing else will do so. */
if (TREE_CODE (old_var) == VAR_DECL if (TREE_CODE (old_var) == VAR_DECL
&& ! DECL_EXTERNAL (old_var)) && ! DECL_EXTERNAL (old_var)
&& cfun)
add_local_decl (cfun, old_var); add_local_decl (cfun, old_var);
if ((!optimize || debug_info_level > DINFO_LEVEL_TERSE) if ((!optimize || debug_info_level > DINFO_LEVEL_TERSE)
&& !DECL_IGNORED_P (old_var) && !DECL_IGNORED_P (old_var)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment