diff options
Diffstat (limited to 'meta/recipes-devtools/gcc/gcc-4.6.0/gcc-4_6-branch-backports/0245-Backported-from-mainline.patch')
-rw-r--r-- | meta/recipes-devtools/gcc/gcc-4.6.0/gcc-4_6-branch-backports/0245-Backported-from-mainline.patch | 73 |
1 files changed, 73 insertions, 0 deletions
diff --git a/meta/recipes-devtools/gcc/gcc-4.6.0/gcc-4_6-branch-backports/0245-Backported-from-mainline.patch b/meta/recipes-devtools/gcc/gcc-4.6.0/gcc-4_6-branch-backports/0245-Backported-from-mainline.patch new file mode 100644 index 0000000000..8dad95bd99 --- /dev/null +++ b/meta/recipes-devtools/gcc/gcc-4.6.0/gcc-4_6-branch-backports/0245-Backported-from-mainline.patch | |||
@@ -0,0 +1,73 @@ | |||
1 | From 694cb3e1aa0163eba6e8130a5351ba66a0858207 Mon Sep 17 00:00:00 2001 | ||
2 | From: jakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4> | ||
3 | Date: Tue, 10 May 2011 08:45:00 +0000 | ||
4 | Subject: [PATCH] Backported from mainline | ||
5 | 2011-05-07 Zdenek Dvorak <ook@ucw.cz> | ||
6 | |||
7 | PR tree-optimization/48837 | ||
8 | * tree-tailcall.c (tree_optimize_tail_calls_1): Do not mark tailcalls | ||
9 | when accumulator transformation is performed. | ||
10 | |||
11 | * gcc.dg/pr48837.c: New testcase. | ||
12 | |||
13 | |||
14 | git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-4_6-branch@173609 138bc75d-0d04-0410-961f-82ee72b054a4 | ||
15 | |||
16 | index 99b02c2..83f2ff1 100644 | ||
17 | new file mode 100644 | ||
18 | index 0000000..ffc65b9 | ||
19 | --- /dev/null | ||
20 | +++ b/gcc/testsuite/gcc.dg/pr48837.c | ||
21 | @@ -0,0 +1,30 @@ | ||
22 | +/* PR tree-optimization/48837 */ | ||
23 | +/* { dg-do run } */ | ||
24 | +/* { dg-options "-O2" } */ | ||
25 | + | ||
26 | +void abort (void); | ||
27 | + | ||
28 | +__attribute__((noinline)) | ||
29 | +int baz(void) | ||
30 | +{ | ||
31 | + return 1; | ||
32 | +} | ||
33 | + | ||
34 | +inline const int *bar(const int *a, const int *b) | ||
35 | +{ | ||
36 | + return *a ? a : b; | ||
37 | +} | ||
38 | + | ||
39 | +int foo(int a, int b) | ||
40 | +{ | ||
41 | + return a || b ? baz() : foo(*bar(&a, &b), 1) + foo(1, 0); | ||
42 | +} | ||
43 | + | ||
44 | +int main(void) | ||
45 | +{ | ||
46 | + if (foo(0, 0) != 2) | ||
47 | + abort(); | ||
48 | + | ||
49 | + return 0; | ||
50 | +} | ||
51 | + | ||
52 | diff --git a/gcc/tree-tailcall.c b/gcc/tree-tailcall.c | ||
53 | index 85aa82b..e50ecc2 100644 | ||
54 | --- a/gcc/tree-tailcall.c | ||
55 | +++ b/gcc/tree-tailcall.c | ||
56 | @@ -1019,6 +1019,14 @@ tree_optimize_tail_calls_1 (bool opt_tailcalls) | ||
57 | integer_one_node); | ||
58 | } | ||
59 | |||
60 | + if (a_acc || m_acc) | ||
61 | + { | ||
62 | + /* When the tail call elimination using accumulators is performed, | ||
63 | + statements adding the accumulated value are inserted at all exits. | ||
64 | + This turns all other tail calls to non-tail ones. */ | ||
65 | + opt_tailcalls = false; | ||
66 | + } | ||
67 | + | ||
68 | for (; tailcalls; tailcalls = next) | ||
69 | { | ||
70 | next = tailcalls->next; | ||
71 | -- | ||
72 | 1.7.0.4 | ||
73 | |||