summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/gcc/gcc-4.5.0/fedora/gcc43-pr33763.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-devtools/gcc/gcc-4.5.0/fedora/gcc43-pr33763.patch')
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.5.0/fedora/gcc43-pr33763.patch159
1 files changed, 159 insertions, 0 deletions
diff --git a/meta/recipes-devtools/gcc/gcc-4.5.0/fedora/gcc43-pr33763.patch b/meta/recipes-devtools/gcc/gcc-4.5.0/fedora/gcc43-pr33763.patch
new file mode 100644
index 0000000000..68c30650ff
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.5.0/fedora/gcc43-pr33763.patch
@@ -0,0 +1,159 @@
12007-11-06 Jakub Jelinek <jakub@redhat.com>
2
3 PR tree-optimization/33763
4 * gcc.dg/pr33763.c: New test.
5 * g++.dg/opt/inline13.C: New test.
6
72007-11-06 Jan Hubicka <jh@suse.cz>
8
9 PR tree-optimization/33763
10 * tree-inline.c (expand_call_inline): Silently ignore always_inline
11 attribute for redefined extern inline functions.
12
13Index: gcc/tree-inline.c
14===================================================================
15--- gcc/tree-inline.c.orig 2010-03-18 13:07:13.000000000 -0700
16+++ gcc/tree-inline.c 2010-06-25 10:18:51.230139825 -0700
17@@ -3545,6 +3545,12 @@
18 goto egress;
19
20 if (lookup_attribute ("always_inline", DECL_ATTRIBUTES (fn))
21+ /* For extern inline functions that get redefined we always
22+ silently ignored alway_inline flag. Better behaviour would
23+ be to be able to keep both bodies and use extern inline body
24+ for inlining, but we can't do that because frontends overwrite
25+ the body. */
26+ && !cg_edge->callee->local.redefined_extern_inline
27 /* Avoid warnings during early inline pass. */
28 && cgraph_global_info_ready)
29 {
30Index: gcc/testsuite/gcc.dg/pr33763.c
31===================================================================
32--- /dev/null 1970-01-01 00:00:00.000000000 +0000
33+++ gcc/testsuite/gcc.dg/pr33763.c 2010-06-25 10:18:51.234141302 -0700
34@@ -0,0 +1,60 @@
35+/* PR tree-optimization/33763 */
36+/* { dg-do compile } */
37+/* { dg-options "-O2" } */
38+
39+typedef struct
40+{
41+ void *a;
42+ void *b;
43+} T;
44+extern void *foo (const char *, const char *);
45+extern void *bar (void *, const char *, T);
46+extern int baz (const char *, int);
47+
48+extern inline __attribute__ ((always_inline, gnu_inline)) int
49+baz (const char *x, int y)
50+{
51+ return 2;
52+}
53+
54+int
55+baz (const char *x, int y)
56+{
57+ return 1;
58+}
59+
60+int xa, xb;
61+
62+static void *
63+inl (const char *x, const char *y)
64+{
65+ T t = { &xa, &xb };
66+ int *f = (int *) __builtin_malloc (sizeof (int));
67+ const char *z;
68+ int o = 0;
69+ void *r = 0;
70+
71+ for (z = y; *z; z++)
72+ {
73+ if (*z == 'r')
74+ o |= 1;
75+ if (*z == 'w')
76+ o |= 2;
77+ }
78+ if (o == 1)
79+ *f = baz (x, 0);
80+ if (o == 2)
81+ *f = baz (x, 1);
82+ if (o == 3)
83+ *f = baz (x, 2);
84+
85+ if (o && *f > 0)
86+ r = bar (f, "w", t);
87+ return r;
88+}
89+
90+void *
91+foo (const char *x, const char *y)
92+{
93+ return inl (x, y);
94+}
95Index: gcc/testsuite/g++.dg/opt/inline13.C
96===================================================================
97--- /dev/null 1970-01-01 00:00:00.000000000 +0000
98+++ gcc/testsuite/g++.dg/opt/inline13.C 2010-06-25 10:18:51.261052137 -0700
99@@ -0,0 +1,60 @@
100+// PR tree-optimization/33763
101+// { dg-do compile }
102+// { dg-options "-O2" }
103+
104+typedef struct
105+{
106+ void *a;
107+ void *b;
108+} T;
109+extern void *foo (const char *, const char *);
110+extern void *bar (void *, const char *, T);
111+extern int baz (const char *, int);
112+
113+extern inline __attribute__ ((always_inline, gnu_inline)) int
114+baz (const char *x, int y)
115+{
116+ return 2;
117+}
118+
119+int
120+baz (const char *x, int y)
121+{
122+ return 1;
123+}
124+
125+int xa, xb;
126+
127+static void *
128+inl (const char *x, const char *y)
129+{
130+ T t = { &xa, &xb };
131+ int *f = (int *) __builtin_malloc (sizeof (int));
132+ const char *z;
133+ int o = 0;
134+ void *r = 0;
135+
136+ for (z = y; *z; z++)
137+ {
138+ if (*z == 'r')
139+ o |= 1;
140+ if (*z == 'w')
141+ o |= 2;
142+ }
143+ if (o == 1)
144+ *f = baz (x, 0);
145+ if (o == 2)
146+ *f = baz (x, 1);
147+ if (o == 3)
148+ *f = baz (x, 2);
149+
150+ if (o && *f > 0)
151+ r = bar (f, "w", t);
152+ return r;
153+}
154+
155+void *
156+foo (const char *x, const char *y)
157+{
158+ return inl (x, y);
159+}