summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjamborm <jamborm@138bc75d-0d04-0410-961f-82ee72b054a4>2010-01-05 19:42:32 +0000
committerjamborm <jamborm@138bc75d-0d04-0410-961f-82ee72b054a4>2010-01-05 19:42:32 +0000
commit526a5cd92e7b088b069edc96f60eb9a8ba27b53c (patch)
tree678e8de90b7a6d6c158cc1bf905913224dea9ce1
parent1280b0ae22329aea6b14c2b2661384e1ba4de63d (diff)
downloadppe42-gcc-526a5cd92e7b088b069edc96f60eb9a8ba27b53c.tar.gz
ppe42-gcc-526a5cd92e7b088b069edc96f60eb9a8ba27b53c.zip
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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@155658 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/ipa-inline.c4
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/g++.dg/torture/pr42462.C47
4 files changed, 60 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index dbeeb8c792e..72457475167 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -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
diff --git a/gcc/ipa-inline.c b/gcc/ipa-inline.c
index b146d0b13e2..7dbafb8f7c2 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 e137b5be398..3835d5e05d9 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -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.
diff --git a/gcc/testsuite/g++.dg/torture/pr42462.C b/gcc/testsuite/g++.dg/torture/pr42462.C
new file mode 100644
index 00000000000..947fa388fec
--- /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<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;
+}
OpenPOWER on IntegriCloud