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: r153881
This commit is contained in:
parent
dba7b0d7e6
commit
9259b8526e
|
@ -1,3 +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.
|
||||
|
||||
2009-11-03 Jason Merrill <jason@redhat.com>
|
||||
|
||||
PR c++/41876
|
||||
|
|
|
@ -3278,6 +3278,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. */
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
2009-11-03 Jason Merrill <jason@redhat.com>
|
||||
|
||||
PR c++/36959
|
||||
* g++.dg/opt/inline16.C: New.
|
||||
|
||||
2009-11-03 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
PR rtl-optimization/41917
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue