re PR c++/36959 (C++ front-end causing a static inline function to be emitted)

PR c++/36959
	* decl2.c (cxx_callgraph_analyze_expr): Don't reference a function
	just because a static variable in it is needed unless -frepo.

From-SVN: r153878
This commit is contained in:
Jason Merrill 2009-11-03 18:02:41 -05:00 committed by Jason Merrill
parent d809253a56
commit 9a6f7249ea
4 changed files with 29 additions and 0 deletions

View File

@ -1,5 +1,9 @@
2009-11-03 Jason Merrill <jason@redhat.com>
PR c++/36959
* decl2.c (cxx_callgraph_analyze_expr): Don't reference a function
just because a static variable in it is needed unless -frepo.
PR c++/41876
* parser.c (cp_parser_type_specifier_seq): Rename is_condition to
is_declaration.

View File

@ -3310,6 +3310,7 @@ cxx_callgraph_analyze_expr (tree *tp, int *walk_subtrees ATTRIBUTE_UNUSED)
mark_decl_referenced (vtbl);
}
else if (DECL_CONTEXT (t)
&& flag_use_repository
&& TREE_CODE (DECL_CONTEXT (t)) == FUNCTION_DECL)
/* If we need a static variable in a function, then we
need the containing function. */

View File

@ -1,3 +1,8 @@
2009-11-03 Jason Merrill <jason@redhat.com>
PR c++/36959
* g++.dg/opt/inline16.C: New.
2009-11-03 Eric Botcazou <ebotcazou@adacore.com>
* gnat.dg/stack_check.adb1: New test.

View File

@ -0,0 +1,19 @@
// PR c++/36959
// We shouldn't have to emit fromSlotB just because we need shuf_BZZZ.
// { dg-options -O }
// { dg-final { scan-assembler-not "_ZL9fromSlotBv" } }
static inline int *fromSlotB(void)
{
static int shuf_BZZZ = 1;
return &shuf_BZZZ;
}
int *p;
int main(void)
{
p = fromSlotB();
return (*p != 1);
}