mirror of
https://gcc.gnu.org/git/gcc.git
synced 2024-12-13 13:54:05 +08:00
re PR tree-optimization/42462 (wrong-code with computed-goto)
2010-01-05 Martin Jambor <mjambor@suse.cz> PR tree-optimization/42462 * ipa-inline.c (compute_inline_parameters): Pass node->decl instead of current_function_decl to helper functions and macros. * gcc/testsuite/g++.dg/torture/pr42462.C: New test. From-SVN: r155658
This commit is contained in:
parent
5392f6be70
commit
9bf4cdf575
@ -1,3 +1,9 @@
|
||||
2010-01-05 Martin Jambor <mjambor@suse.cz>
|
||||
|
||||
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 <ro@CeBiTec.Uni-Bielefeld.DE>
|
||||
|
||||
PR bootstrap/41771
|
||||
|
@ -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;
|
||||
|
@ -1,3 +1,8 @@
|
||||
2010-01-05 Martin Jambor <mjambor@suse.cz>
|
||||
|
||||
PR tree-optimization/42462
|
||||
* gcc/testsuite/g++.dg/torture/pr42462.C: New test.
|
||||
|
||||
2010-01-05 Jason Merrill <jason@redhat.com>
|
||||
|
||||
* g++.dg/cpp0x/initlist30.C: New test.
|
||||
|
47
gcc/testsuite/g++.dg/torture/pr42462.C
Normal file
47
gcc/testsuite/g++.dg/torture/pr42462.C
Normal file
@ -0,0 +1,47 @@
|
||||
/* { dg-do run } */
|
||||
|
||||
#define INLINE inline __attribute__((always_inline))
|
||||
extern "C" void abort (void);
|
||||
|
||||
template<class> struct Foo {
|
||||
inline bool isFalse() { return false; }
|
||||
template <bool> void f1() {}
|
||||
template <bool> INLINE void f2() { f1<false>(); }
|
||||
template <bool> void f3() { f2<false>(); }
|
||||
template <bool> INLINE void f4() { f3<false>(); }
|
||||
int exec2();
|
||||
void execute();
|
||||
inline void unused();
|
||||
};
|
||||
|
||||
template<class T> inline void Foo<T>::unused() {
|
||||
f4<true>();
|
||||
}
|
||||
|
||||
static int counter = 0;
|
||||
|
||||
template<class T> int Foo<T>::exec2() {
|
||||
static void* table[2] = { &&begin, &&end };
|
||||
if (counter++ > 10)
|
||||
return 0;
|
||||
goto *(table[0]);
|
||||
begin:
|
||||
if (isFalse()) f1<false>();
|
||||
end:
|
||||
return 1;
|
||||
}
|
||||
|
||||
template<class T> void Foo<T>::execute() {
|
||||
int r = 1;
|
||||
while (r) { r = exec2(); }
|
||||
}
|
||||
|
||||
template class Foo<int>;
|
||||
|
||||
int main() {
|
||||
Foo<int> c;
|
||||
c.execute();
|
||||
if (counter < 10)
|
||||
abort ();
|
||||
return 0;
|
||||
}
|
Loading…
Reference in New Issue
Block a user