diff options
Diffstat (limited to 'meta/recipes-devtools/gcc/gcc-4.6.0/gcc-4_6-branch-backports/0373-2011-05-31-Richard-Guenther-rguenther-suse.de.patch')
-rw-r--r-- | meta/recipes-devtools/gcc/gcc-4.6.0/gcc-4_6-branch-backports/0373-2011-05-31-Richard-Guenther-rguenther-suse.de.patch | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/meta/recipes-devtools/gcc/gcc-4.6.0/gcc-4_6-branch-backports/0373-2011-05-31-Richard-Guenther-rguenther-suse.de.patch b/meta/recipes-devtools/gcc/gcc-4.6.0/gcc-4_6-branch-backports/0373-2011-05-31-Richard-Guenther-rguenther-suse.de.patch new file mode 100644 index 0000000000..fc512f736f --- /dev/null +++ b/meta/recipes-devtools/gcc/gcc-4.6.0/gcc-4_6-branch-backports/0373-2011-05-31-Richard-Guenther-rguenther-suse.de.patch | |||
@@ -0,0 +1,72 @@ | |||
1 | From d255e20552a56f1aa9b75a0ca45de257e935cd58 Mon Sep 17 00:00:00 2001 | ||
2 | From: rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | ||
3 | Date: Tue, 31 May 2011 12:23:55 +0000 | ||
4 | Subject: [PATCH] 2011-05-31 Richard Guenther <rguenther@suse.de> | ||
5 | |||
6 | Backport from mainline | ||
7 | 2011-05-11 Richard Guenther <rguenther@suse.de> | ||
8 | |||
9 | PR middle-end/48953 | ||
10 | * tree-inline.c (remap_gimple_op_r): Also remap types of MEM_REFs. | ||
11 | |||
12 | * gcc.dg/torture/pr48953.c: New testcase. | ||
13 | |||
14 | |||
15 | git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-4_6-branch@174475 138bc75d-0d04-0410-961f-82ee72b054a4 | ||
16 | |||
17 | index b4b333f..d5ea116 100644 | ||
18 | new file mode 100644 | ||
19 | index 0000000..41a3d7b | ||
20 | --- /dev/null | ||
21 | +++ b/gcc/testsuite/gcc.dg/torture/pr48953.c | ||
22 | @@ -0,0 +1,17 @@ | ||
23 | +/* { dg-do run } */ | ||
24 | +/* { dg-options "-fno-tree-dce" } */ | ||
25 | + | ||
26 | +static inline int foo (int n, int k) | ||
27 | +{ | ||
28 | + struct S | ||
29 | + { | ||
30 | + int i[n]; | ||
31 | + int value; | ||
32 | + } s[2]; | ||
33 | + return s[k].value = 0; | ||
34 | +} | ||
35 | + | ||
36 | +int main () | ||
37 | +{ | ||
38 | + return foo (2, 0); | ||
39 | +} | ||
40 | diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c | ||
41 | index f2255f8..ef3f1a3 100644 | ||
42 | --- a/gcc/tree-inline.c | ||
43 | +++ b/gcc/tree-inline.c | ||
44 | @@ -816,6 +816,7 @@ remap_gimple_op_r (tree *tp, int *walk_subtrees, void *data) | ||
45 | if (TREE_CODE (*tp) == MEM_REF) | ||
46 | { | ||
47 | tree ptr = TREE_OPERAND (*tp, 0); | ||
48 | + tree type = remap_type (TREE_TYPE (*tp), id); | ||
49 | tree old = *tp; | ||
50 | tree tem; | ||
51 | |||
52 | @@ -826,7 +827,7 @@ remap_gimple_op_r (tree *tp, int *walk_subtrees, void *data) | ||
53 | if ((tem = maybe_fold_offset_to_reference (EXPR_LOCATION (*tp), | ||
54 | ptr, | ||
55 | TREE_OPERAND (*tp, 1), | ||
56 | - TREE_TYPE (*tp))) | ||
57 | + type)) | ||
58 | && TREE_THIS_VOLATILE (tem) == TREE_THIS_VOLATILE (old)) | ||
59 | { | ||
60 | tree *tem_basep = &tem; | ||
61 | @@ -848,7 +849,7 @@ remap_gimple_op_r (tree *tp, int *walk_subtrees, void *data) | ||
62 | } | ||
63 | else | ||
64 | { | ||
65 | - *tp = fold_build2 (MEM_REF, TREE_TYPE (*tp), | ||
66 | + *tp = fold_build2 (MEM_REF, type, | ||
67 | ptr, TREE_OPERAND (*tp, 1)); | ||
68 | TREE_THIS_VOLATILE (*tp) = TREE_THIS_VOLATILE (old); | ||
69 | TREE_THIS_NOTRAP (*tp) = TREE_THIS_NOTRAP (old); | ||
70 | -- | ||
71 | 1.7.0.4 | ||
72 | |||