]> git.ipfire.org Git - ipfire-2.x.git/blame - src/patches/gcc/gcc44-pr33763.patch
glibc: Fix headers to build with new GCC
[ipfire-2.x.git] / src / patches / gcc / gcc44-pr33763.patch
CommitLineData
ed635824
MT
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
13--- gcc/tree-inline.c.jj 2007-11-06 09:29:04.000000000 +0100
14+++ gcc/tree-inline.c 2007-11-06 16:19:12.000000000 +0100
15@@ -3157,6 +3157,12 @@ expand_call_inline (basic_block bb, gimp
16 goto egress;
17
18 if (lookup_attribute ("always_inline", DECL_ATTRIBUTES (fn))
19+ /* For extern inline functions that get redefined we always
20+ silently ignored alway_inline flag. Better behaviour would
21+ be to be able to keep both bodies and use extern inline body
22+ for inlining, but we can't do that because frontends overwrite
23+ the body. */
24+ && !cg_edge->callee->local.redefined_extern_inline
25 /* Avoid warnings during early inline pass. */
26 && cgraph_global_info_ready)
27 {
28--- gcc/testsuite/gcc.dg/pr33763.c.jj 2007-11-06 16:19:12.000000000 +0100
29+++ gcc/testsuite/gcc.dg/pr33763.c 2007-11-06 16:19:12.000000000 +0100
30@@ -0,0 +1,60 @@
31+/* PR tree-optimization/33763 */
32+/* { dg-do compile } */
33+/* { dg-options "-O2" } */
34+
35+typedef struct
36+{
37+ void *a;
38+ void *b;
39+} T;
40+extern void *foo (const char *, const char *);
41+extern void *bar (void *, const char *, T);
42+extern int baz (const char *, int);
43+
44+extern inline __attribute__ ((always_inline, gnu_inline)) int
45+baz (const char *x, int y)
46+{
47+ return 2;
48+}
49+
50+int
51+baz (const char *x, int y)
52+{
53+ return 1;
54+}
55+
56+int xa, xb;
57+
58+static void *
59+inl (const char *x, const char *y)
60+{
61+ T t = { &xa, &xb };
62+ int *f = (int *) __builtin_malloc (sizeof (int));
63+ const char *z;
64+ int o = 0;
65+ void *r = 0;
66+
67+ for (z = y; *z; z++)
68+ {
69+ if (*z == 'r')
70+ o |= 1;
71+ if (*z == 'w')
72+ o |= 2;
73+ }
74+ if (o == 1)
75+ *f = baz (x, 0);
76+ if (o == 2)
77+ *f = baz (x, 1);
78+ if (o == 3)
79+ *f = baz (x, 2);
80+
81+ if (o && *f > 0)
82+ r = bar (f, "w", t);
83+ return r;
84+}
85+
86+void *
87+foo (const char *x, const char *y)
88+{
89+ return inl (x, y);
90+}
91--- gcc/testsuite/g++.dg/opt/inline13.C.jj 2007-11-06 16:20:20.000000000 +0100
92+++ gcc/testsuite/g++.dg/opt/inline13.C 2007-11-06 16:21:30.000000000 +0100
93@@ -0,0 +1,60 @@
94+// PR tree-optimization/33763
95+// { dg-do compile }
96+// { dg-options "-O2" }
97+
98+typedef struct
99+{
100+ void *a;
101+ void *b;
102+} T;
103+extern void *foo (const char *, const char *);
104+extern void *bar (void *, const char *, T);
105+extern int baz (const char *, int);
106+
107+extern inline __attribute__ ((always_inline, gnu_inline)) int
108+baz (const char *x, int y)
109+{
110+ return 2;
111+}
112+
113+int
114+baz (const char *x, int y)
115+{
116+ return 1;
117+}
118+
119+int xa, xb;
120+
121+static void *
122+inl (const char *x, const char *y)
123+{
124+ T t = { &xa, &xb };
125+ int *f = (int *) __builtin_malloc (sizeof (int));
126+ const char *z;
127+ int o = 0;
128+ void *r = 0;
129+
130+ for (z = y; *z; z++)
131+ {
132+ if (*z == 'r')
133+ o |= 1;
134+ if (*z == 'w')
135+ o |= 2;
136+ }
137+ if (o == 1)
138+ *f = baz (x, 0);
139+ if (o == 2)
140+ *f = baz (x, 1);
141+ if (o == 3)
142+ *f = baz (x, 2);
143+
144+ if (o && *f > 0)
145+ r = bar (f, "w", t);
146+ return r;
147+}
148+
149+void *
150+foo (const char *x, const char *y)
151+{
152+ return inl (x, y);
153+}