summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/gcc/gcc-4.6.0/gcc-4_6-branch-backports/0014-2011-03-28-Richard-Guenther-rguenther-suse.de.patch
diff options
context:
space:
mode:
authorKhem Raj <raj.khem@gmail.com>2011-04-30 12:37:47 -0700
committerRichard Purdie <richard.purdie@linuxfoundation.org>2011-05-05 12:26:41 +0100
commit478deec11f3349d61b1a922f047dc958dc07262a (patch)
tree1843907b36de2bcb8f821d49d8c9a88014ef0dc7 /meta/recipes-devtools/gcc/gcc-4.6.0/gcc-4_6-branch-backports/0014-2011-03-28-Richard-Guenther-rguenther-suse.de.patch
parentd42dccf886983ba14ccc868041d7bea0cf1a260e (diff)
downloadpoky-478deec11f3349d61b1a922f047dc958dc07262a.tar.gz
gcc-4.6.0: Backport FSF 4.6 branch patches
This is set of bugfixes that has been done on FSF gcc-4_2-branch since 4.6.0 was released They will roll into 4.6.1 release once that happens in coming approx 6 months time then we can simply remove them thats the reason so use a separate .inc file to define the SRC_URI additions (From OE-Core rev: b0d5b9f12adbce2c4a0df6059f5671188cd32293) Signed-off-by: Khem Raj <raj.khem@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-devtools/gcc/gcc-4.6.0/gcc-4_6-branch-backports/0014-2011-03-28-Richard-Guenther-rguenther-suse.de.patch')
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.6.0/gcc-4_6-branch-backports/0014-2011-03-28-Richard-Guenther-rguenther-suse.de.patch246
1 files changed, 246 insertions, 0 deletions
diff --git a/meta/recipes-devtools/gcc/gcc-4.6.0/gcc-4_6-branch-backports/0014-2011-03-28-Richard-Guenther-rguenther-suse.de.patch b/meta/recipes-devtools/gcc/gcc-4.6.0/gcc-4_6-branch-backports/0014-2011-03-28-Richard-Guenther-rguenther-suse.de.patch
new file mode 100644
index 0000000000..f8c0b429b3
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.6.0/gcc-4_6-branch-backports/0014-2011-03-28-Richard-Guenther-rguenther-suse.de.patch
@@ -0,0 +1,246 @@
1From 2631216d2fedc5339a5edcac64db1ab5d9269498 Mon Sep 17 00:00:00 2001
2From: rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>
3Date: Mon, 28 Mar 2011 10:14:34 +0000
4Subject: [PATCH 014/200] 2011-03-28 Richard Guenther <rguenther@suse.de>
5
6 Backport from mainline
7 2011-03-24 Richard Guenther <rguenther@suse.de>
8
9 PR middle-end/48269
10 * tree-object-size.c (addr_object_size): Do not double-account
11 for MEM_REF offsets.
12
13 * gcc.dg/builtin-object-size-10.c: New testcase.
14
15 2011-03-22 Richard Guenther <rguenther@suse.de>
16
17 PR tree-optimization/48228
18 * tree-vrp.c (vrp_visit_phi_node): Do not stop propagating
19 for single-arg PHIs.
20
21 * gcc.dg/Wstrict-overflow-23.c: New testcase.
22
23 2011-03-17 Richard Guenther <rguenther@suse.de>
24
25 PR middle-end/48134
26 * tree-ssa.c (insert_debug_temp_for_var_def): If we propagated
27 a value make sure to fold the statement.
28
29 * gcc.dg/pr48134.c: New testcase.
30
31 2011-03-15 Richard Guenther <rguenther@suse.de>
32
33 PR middle-end/48031
34 * fold-const.c (fold_indirect_ref_1): Do not create new variable-sized
35 or variable-indexed array accesses when in gimple form.
36
37
38git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-4_6-branch@171595 138bc75d-0d04-0410-961f-82ee72b054a4
39
40index 957049c..9a2f31f 100644
41--- a/gcc/fold-const.c
42+++ b/gcc/fold-const.c
43@@ -15554,12 +15554,17 @@ fold_indirect_ref_1 (location_t loc, tree type, tree op0)
44 }
45 /* *(foo *)&fooarray => fooarray[0] */
46 else if (TREE_CODE (optype) == ARRAY_TYPE
47- && type == TREE_TYPE (optype))
48+ && type == TREE_TYPE (optype)
49+ && (!in_gimple_form
50+ || TREE_CODE (TYPE_SIZE (type)) == INTEGER_CST))
51 {
52 tree type_domain = TYPE_DOMAIN (optype);
53 tree min_val = size_zero_node;
54 if (type_domain && TYPE_MIN_VALUE (type_domain))
55 min_val = TYPE_MIN_VALUE (type_domain);
56+ if (in_gimple_form
57+ && TREE_CODE (min_val) != INTEGER_CST)
58+ return NULL_TREE;
59 return build4_loc (loc, ARRAY_REF, type, op, min_val,
60 NULL_TREE, NULL_TREE);
61 }
62@@ -15633,7 +15638,9 @@ fold_indirect_ref_1 (location_t loc, tree type, tree op0)
63
64 /* *(foo *)fooarrptr => (*fooarrptr)[0] */
65 if (TREE_CODE (TREE_TYPE (subtype)) == ARRAY_TYPE
66- && type == TREE_TYPE (TREE_TYPE (subtype)))
67+ && type == TREE_TYPE (TREE_TYPE (subtype))
68+ && (!in_gimple_form
69+ || TREE_CODE (TYPE_SIZE (type)) == INTEGER_CST))
70 {
71 tree type_domain;
72 tree min_val = size_zero_node;
73@@ -15641,6 +15648,9 @@ fold_indirect_ref_1 (location_t loc, tree type, tree op0)
74 type_domain = TYPE_DOMAIN (TREE_TYPE (sub));
75 if (type_domain && TYPE_MIN_VALUE (type_domain))
76 min_val = TYPE_MIN_VALUE (type_domain);
77+ if (in_gimple_form
78+ && TREE_CODE (min_val) != INTEGER_CST)
79+ return NULL_TREE;
80 return build4_loc (loc, ARRAY_REF, type, sub, min_val, NULL_TREE,
81 NULL_TREE);
82 }
83new file mode 100644
84index 0000000..16014bb
85--- /dev/null
86+++ b/gcc/testsuite/gcc.dg/Wstrict-overflow-23.c
87@@ -0,0 +1,31 @@
88+/* { dg-do compile } */
89+/* { dg-options "-O2 -Wstrict-overflow" } */
90+
91+unsigned int
92+do_scrolling (unsigned int window_size, unsigned int writecost)
93+{
94+ unsigned int i = window_size;
95+
96+ int terminal_window_p = 0;
97+ unsigned int queue = 0;
98+
99+ for (i = window_size; i; i--)
100+ {
101+ if (writecost < i)
102+ ++queue;
103+ else if (writecost & 1)
104+ terminal_window_p = 1;
105+ }
106+
107+ if (queue > 0)
108+ {
109+ if (!terminal_window_p)
110+ {
111+ terminal_window_p = 1;
112+ }
113+ }
114+
115+ if (terminal_window_p)
116+ return 100;
117+ return 0;
118+}
119diff --git a/gcc/testsuite/gcc.dg/builtin-object-size-10.c b/gcc/testsuite/gcc.dg/builtin-object-size-10.c
120new file mode 100644
121index 0000000..6c7ed45
122--- /dev/null
123+++ b/gcc/testsuite/gcc.dg/builtin-object-size-10.c
124@@ -0,0 +1,26 @@
125+/* { dg-do compile } */
126+/* { dg-options "-O2 -fdump-tree-objsz-details" } */
127+
128+typedef struct {
129+ char sentinel[4];
130+ char data[0];
131+} drone_packet;
132+typedef struct {
133+ char type_str[16];
134+ char channel_hop;
135+} drone_source_packet;
136+drone_packet *
137+foo(char *x)
138+{
139+ drone_packet *dpkt = __builtin_malloc(sizeof(drone_packet)
140+ + sizeof(drone_source_packet));
141+ drone_source_packet *spkt = (drone_source_packet *) dpkt->data;
142+ __builtin___snprintf_chk (spkt->type_str, 16,
143+ 1, __builtin_object_size (spkt->type_str, 1),
144+ "%s", x);
145+ return dpkt;
146+}
147+
148+/* { dg-final { scan-tree-dump "maximum object size 21" "objsz" } } */
149+/* { dg-final { scan-tree-dump "maximum subobject size 16" "objsz" } } */
150+/* { dg-final { cleanup-tree-dump "objsz" } } */
151diff --git a/gcc/testsuite/gcc.dg/pr48134.c b/gcc/testsuite/gcc.dg/pr48134.c
152new file mode 100644
153index 0000000..8dc5a6d
154--- /dev/null
155+++ b/gcc/testsuite/gcc.dg/pr48134.c
156@@ -0,0 +1,31 @@
157+/* { dg-do compile } */
158+/* { dg-options "-O2 -fstack-check=specific -fno-tree-dse -fno-tree-fre -fno-tree-loop-optimize -g" } */
159+
160+struct S
161+{
162+ int w, z;
163+};
164+struct T
165+{
166+ struct S s;
167+};
168+
169+int i;
170+
171+static inline struct S
172+bar (struct S x)
173+{
174+ i++;
175+ return x;
176+}
177+
178+int
179+foo (struct T t, struct S s)
180+{
181+ struct S *c = &s;
182+ if (i)
183+ c = &t.s;
184+ t.s.w = 3;
185+ s = bar (*c);
186+ return t.s.w;
187+}
188diff --git a/gcc/tree-object-size.c b/gcc/tree-object-size.c
189index 6a74d19..043b445 100644
190--- a/gcc/tree-object-size.c
191+++ b/gcc/tree-object-size.c
192@@ -348,8 +348,6 @@ addr_object_size (struct object_size_info *osi, const_tree ptr,
193 tree bytes2 = compute_object_offset (TREE_OPERAND (ptr, 0), pt_var);
194 if (bytes2 != error_mark_node)
195 {
196- bytes2 = size_binop (PLUS_EXPR, bytes2,
197- TREE_OPERAND (pt_var, 1));
198 if (TREE_CODE (bytes2) == INTEGER_CST
199 && tree_int_cst_lt (pt_var_size, bytes2))
200 bytes2 = size_zero_node;
201diff --git a/gcc/tree-ssa.c b/gcc/tree-ssa.c
202index 5c9e0d8..eaf3ef9 100644
203--- a/gcc/tree-ssa.c
204+++ b/gcc/tree-ssa.c
205@@ -455,13 +455,19 @@ insert_debug_temp_for_var_def (gimple_stmt_iterator *gsi, tree var)
206 continue;
207
208 if (value)
209- FOR_EACH_IMM_USE_ON_STMT (use_p, imm_iter)
210- /* unshare_expr is not needed here. vexpr is either a
211- SINGLE_RHS, that can be safely shared, some other RHS
212- that was unshared when we found it had a single debug
213- use, or a DEBUG_EXPR_DECL, that can be safely
214- shared. */
215- SET_USE (use_p, value);
216+ {
217+ FOR_EACH_IMM_USE_ON_STMT (use_p, imm_iter)
218+ /* unshare_expr is not needed here. vexpr is either a
219+ SINGLE_RHS, that can be safely shared, some other RHS
220+ that was unshared when we found it had a single debug
221+ use, or a DEBUG_EXPR_DECL, that can be safely
222+ shared. */
223+ SET_USE (use_p, value);
224+ /* If we didn't replace uses with a debug decl fold the
225+ resulting expression. Otherwise we end up with invalid IL. */
226+ if (TREE_CODE (value) != DEBUG_EXPR_DECL)
227+ fold_stmt_inplace (stmt);
228+ }
229 else
230 gimple_debug_bind_reset_value (stmt);
231
232diff --git a/gcc/tree-vrp.c b/gcc/tree-vrp.c
233index 65d249f..280e6da 100644
234--- a/gcc/tree-vrp.c
235+++ b/gcc/tree-vrp.c
236@@ -6619,6 +6619,7 @@ vrp_visit_phi_node (gimple phi)
237 edge; this helps us avoid an overflow infinity for conditionals
238 which are not in a loop. */
239 if (edges > 0
240+ && gimple_phi_num_args (phi) > 1
241 && edges == old_edges)
242 {
243 int cmp_min = compare_values (lhs_vr->min, vr_result.min);
244--
2451.7.0.4
246