diff --git a/gcc/ChangeLog b/gcc/ChangeLog index dbeeb8c792e9..72457475167d 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2010-01-05 Martin Jambor + + PR tree-optimization/42462 + * ipa-inline.c (compute_inline_parameters): Pass node->decl instead of + current_function_decl to helper functions and macros. + 2010-01-05 Rainer Orth PR bootstrap/41771 diff --git a/gcc/ipa-inline.c b/gcc/ipa-inline.c index b146d0b13e29..7dbafb8f7c22 100644 --- a/gcc/ipa-inline.c +++ b/gcc/ipa-inline.c @@ -1859,10 +1859,10 @@ compute_inline_parameters (struct cgraph_node *node) node->global.stack_frame_offset = 0; /* Can this function be inlined at all? */ - node->local.inlinable = tree_inlinable_function_p (current_function_decl); + node->local.inlinable = tree_inlinable_function_p (node->decl); if (node->local.inlinable && !node->local.disregard_inline_limits) node->local.disregard_inline_limits - = DECL_DISREGARD_INLINE_LIMITS (current_function_decl); + = DECL_DISREGARD_INLINE_LIMITS (node->decl); estimate_function_body_sizes (node); /* Inlining characteristics are maintained by the cgraph_mark_inline. */ node->global.time = inline_summary (node)->self_time; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index e137b5be3988..3835d5e05d9b 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2010-01-05 Martin Jambor + + PR tree-optimization/42462 + * gcc/testsuite/g++.dg/torture/pr42462.C: New test. + 2010-01-05 Jason Merrill * g++.dg/cpp0x/initlist30.C: New test. diff --git a/gcc/testsuite/g++.dg/torture/pr42462.C b/gcc/testsuite/g++.dg/torture/pr42462.C new file mode 100644 index 000000000000..947fa388fecc --- /dev/null +++ b/gcc/testsuite/g++.dg/torture/pr42462.C @@ -0,0 +1,47 @@ +/* { dg-do run } */ + +#define INLINE inline __attribute__((always_inline)) +extern "C" void abort (void); + +template struct Foo { + inline bool isFalse() { return false; } + template void f1() {} + template INLINE void f2() { f1(); } + template void f3() { f2(); } + template INLINE void f4() { f3(); } + int exec2(); + void execute(); + inline void unused(); +}; + +template inline void Foo::unused() { + f4(); +} + +static int counter = 0; + +template int Foo::exec2() { + static void* table[2] = { &&begin, &&end }; + if (counter++ > 10) + return 0; + goto *(table[0]); +begin: + if (isFalse()) f1(); +end: + return 1; +} + +template void Foo::execute() { + int r = 1; + while (r) { r = exec2(); } +} + +template class Foo; + +int main() { + Foo c; + c.execute(); + if (counter < 10) + abort (); + return 0; +}