diff options
Diffstat (limited to 'meta/recipes-devtools/gcc/gcc-4.6.0/gcc-4_6-branch-backports/0311-PR-middle-end-48973.patch')
-rw-r--r-- | meta/recipes-devtools/gcc/gcc-4.6.0/gcc-4_6-branch-backports/0311-PR-middle-end-48973.patch | 101 |
1 files changed, 101 insertions, 0 deletions
diff --git a/meta/recipes-devtools/gcc/gcc-4.6.0/gcc-4_6-branch-backports/0311-PR-middle-end-48973.patch b/meta/recipes-devtools/gcc/gcc-4.6.0/gcc-4_6-branch-backports/0311-PR-middle-end-48973.patch new file mode 100644 index 0000000000..c6aa270623 --- /dev/null +++ b/meta/recipes-devtools/gcc/gcc-4.6.0/gcc-4_6-branch-backports/0311-PR-middle-end-48973.patch | |||
@@ -0,0 +1,101 @@ | |||
1 | From ec0109fe82032e869880728da5b026a89c64473f Mon Sep 17 00:00:00 2001 | ||
2 | From: jakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4> | ||
3 | Date: Mon, 23 May 2011 10:24:47 +0000 | ||
4 | Subject: [PATCH] PR middle-end/48973 | ||
5 | * expr.c (expand_expr_real_2) <case LT_EXPR>: If do_store_flag | ||
6 | failed and the comparison has a single bit signed type, use | ||
7 | constm1_rtx instead of const1_rtx for true value. | ||
8 | (do_store_flag): If ops->type is single bit signed type, disable | ||
9 | signel bit test optimization and pass -1 instead of 1 as last | ||
10 | parameter to emit_store_flag_force. | ||
11 | |||
12 | * gcc.c-torture/execute/pr48973-1.c: New test. | ||
13 | * gcc.c-torture/execute/pr48973-2.c: New test. | ||
14 | |||
15 | |||
16 | git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-4_6-branch@174063 138bc75d-0d04-0410-961f-82ee72b054a4 | ||
17 | |||
18 | index 1de0ce4..9a81754 100644 | ||
19 | --- a/gcc/expr.c | ||
20 | +++ b/gcc/expr.c | ||
21 | @@ -8134,7 +8134,10 @@ expand_expr_real_2 (sepops ops, rtx target, enum machine_mode tmode, | ||
22 | op1 = gen_label_rtx (); | ||
23 | jumpifnot_1 (code, treeop0, treeop1, op1, -1); | ||
24 | |||
25 | - emit_move_insn (target, const1_rtx); | ||
26 | + if (TYPE_PRECISION (type) == 1 && !TYPE_UNSIGNED (type)) | ||
27 | + emit_move_insn (target, constm1_rtx); | ||
28 | + else | ||
29 | + emit_move_insn (target, const1_rtx); | ||
30 | |||
31 | emit_label (op1); | ||
32 | return target; | ||
33 | @@ -10088,7 +10091,8 @@ do_store_flag (sepops ops, rtx target, enum machine_mode mode) | ||
34 | |||
35 | if ((code == NE || code == EQ) | ||
36 | && TREE_CODE (arg0) == BIT_AND_EXPR && integer_zerop (arg1) | ||
37 | - && integer_pow2p (TREE_OPERAND (arg0, 1))) | ||
38 | + && integer_pow2p (TREE_OPERAND (arg0, 1)) | ||
39 | + && (TYPE_PRECISION (ops->type) != 1 || TYPE_UNSIGNED (ops->type))) | ||
40 | { | ||
41 | tree type = lang_hooks.types.type_for_mode (mode, unsignedp); | ||
42 | return expand_expr (fold_single_bit_test (loc, | ||
43 | @@ -10108,7 +10112,9 @@ do_store_flag (sepops ops, rtx target, enum machine_mode mode) | ||
44 | |||
45 | /* Try a cstore if possible. */ | ||
46 | return emit_store_flag_force (target, code, op0, op1, | ||
47 | - operand_mode, unsignedp, 1); | ||
48 | + operand_mode, unsignedp, | ||
49 | + (TYPE_PRECISION (ops->type) == 1 | ||
50 | + && !TYPE_UNSIGNED (ops->type)) ? -1 : 1); | ||
51 | } | ||
52 | |||
53 | |||
54 | new file mode 100644 | ||
55 | index 0000000..02688a0 | ||
56 | --- /dev/null | ||
57 | +++ b/gcc/testsuite/gcc.c-torture/execute/pr48973-1.c | ||
58 | @@ -0,0 +1,20 @@ | ||
59 | +/* PR middle-end/48973 */ | ||
60 | + | ||
61 | +extern void abort (void); | ||
62 | +struct S { int f : 1; } s; | ||
63 | +int v = -1; | ||
64 | + | ||
65 | +void | ||
66 | +foo (unsigned int x) | ||
67 | +{ | ||
68 | + if (x != -1U) | ||
69 | + abort (); | ||
70 | +} | ||
71 | + | ||
72 | +int | ||
73 | +main () | ||
74 | +{ | ||
75 | + s.f = (v & 1) > 0; | ||
76 | + foo (s.f); | ||
77 | + return 0; | ||
78 | +} | ||
79 | diff --git a/gcc/testsuite/gcc.c-torture/execute/pr48973-2.c b/gcc/testsuite/gcc.c-torture/execute/pr48973-2.c | ||
80 | new file mode 100644 | ||
81 | index 0000000..a64d491 | ||
82 | --- /dev/null | ||
83 | +++ b/gcc/testsuite/gcc.c-torture/execute/pr48973-2.c | ||
84 | @@ -0,0 +1,14 @@ | ||
85 | +/* PR middle-end/48973 */ | ||
86 | + | ||
87 | +extern void abort (void); | ||
88 | +struct S { int f : 1; } s; | ||
89 | +int v = -1; | ||
90 | + | ||
91 | +int | ||
92 | +main () | ||
93 | +{ | ||
94 | + s.f = v < 0; | ||
95 | + if ((unsigned int) s.f != -1U) | ||
96 | + abort (); | ||
97 | + return 0; | ||
98 | +} | ||
99 | -- | ||
100 | 1.7.0.4 | ||
101 | |||