Root/toolchain/gcc/patches/4.2.4/951-bug_37014.patch

1http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37014
2
3--- a/gcc/dojump.c
4+++ b/gcc/dojump.c
5@@ -307,8 +307,6 @@
6     break;
7       }
8 
9- case TRUTH_ANDIF_EXPR:
10- case TRUTH_ORIF_EXPR:
11     case COMPOUND_EXPR:
12       /* Lowered by gimplify.c. */
13       gcc_unreachable ();
14@@ -518,6 +516,7 @@
15       if (BRANCH_COST >= 4 || TREE_SIDE_EFFECTS (TREE_OPERAND (exp, 1)))
16     goto normal;
17 
18+ case TRUTH_ANDIF_EXPR:
19       if (if_false_label == NULL_RTX)
20         {
21       drop_through_label = gen_label_rtx ();
22@@ -538,6 +537,7 @@
23       if (BRANCH_COST >= 4 || TREE_SIDE_EFFECTS (TREE_OPERAND (exp, 1)))
24     goto normal;
25 
26+ case TRUTH_ORIF_EXPR:
27       if (if_true_label == NULL_RTX)
28     {
29           drop_through_label = gen_label_rtx ();
30--- a/gcc/expr.c
31+++ b/gcc/expr.c
32@@ -8556,7 +8556,10 @@
33       /* If no set-flag instruction, must generate a conditional store
34      into a temporary variable. Drop through and handle this
35      like && and ||. */
36-
37+ /* Although TRUTH_{AND,OR}IF_EXPR aren't present in GIMPLE, they
38+ are occassionally created by folding during expansion. */
39+ case TRUTH_ANDIF_EXPR:
40+ case TRUTH_ORIF_EXPR:
41       if (! ignore
42       && (target == 0
43           || modifier == EXPAND_STACK_PARM
44@@ -8754,8 +8767,6 @@
45     case POSTDECREMENT_EXPR:
46     case LOOP_EXPR:
47     case EXIT_EXPR:
48- case TRUTH_ANDIF_EXPR:
49- case TRUTH_ORIF_EXPR:
50       /* Lowered by gimplify.c. */
51       gcc_unreachable ();
52 
53--- /dev/null
54+++ b/gcc/testsuite/gcc.c-torture/compile/20080812-1.c
55@@ -0,0 +1,21 @@
56+/* PR middle-end/37014 */
57+
58+void bar (signed char *);
59+
60+void
61+foo (int x, int y)
62+{
63+ int i;
64+ signed char a[123], b[123], c;
65+ for (i = 0; i < 123; i++)
66+ {
67+ int e = y - x;
68+ int d = e < 0 ? -e : e;
69+ c = d < 75;
70+ a[y] = c;
71+ b[y] = c;
72+ y--;
73+ }
74+ bar (b);
75+ bar (a);
76+}
77

Archive Download this file



interactive