aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Jambor <mjambor@suse.cz>2010-01-05 20:42:32 +0100
committerMartin Jambor <jamborm@gcc.gnu.org>2010-01-05 20:42:32 +0100
commit9bf4cdf5755e89b6e17122b985daa4bc2510f6f9 (patch)
tree678e8de90b7a6d6c158cc1bf905913224dea9ce1
parent5392f6be700ca0d15b7b6a3a9f9ebdb029247534 (diff)
downloadgcc-9bf4cdf5755e89b6e17122b985daa4bc2510f6f9.zip
gcc-9bf4cdf5755e89b6e17122b985daa4bc2510f6f9.tar.gz
gcc-9bf4cdf5755e89b6e17122b985daa4bc2510f6f9.tar.bz2
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
-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 dbeeb8c..7245747 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 b146d0b..7dbafb8 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 e137b5b..3835d5e 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 0000000..947fa388
--- /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;
+}