~ubuntu-branches/ubuntu/oneiric/lightning-extension/oneiric-security

« back to all changes in this revision

Viewing changes to mozilla/build/unix/build-toolchain/pr49911.diff

  • Committer: Package Import Robot
  • Author(s): Chris Coulson
  • Date: 2012-04-20 13:46:11 UTC
  • mfrom: (1.2.1)
  • mto: (1.3.1)
  • mto: This revision was merged to the branch mainline in revision 19.
  • Revision ID: package-import@ubuntu.com-20120420134611-i0dkosnbmihrd0lr
Tags: upstream-1.4+build1
ImportĀ upstreamĀ versionĀ 1.4+build1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
diff -ru gcc-4.5.2/gcc/double-int.c gcc-4.5.2-new/gcc/double-int.c
 
2
--- gcc-4.5.2/gcc/double-int.c  2009-11-25 05:55:54.000000000 -0500
 
3
+++ gcc-4.5.2-new/gcc/double-int.c      2011-11-29 10:20:27.625583810 -0500
 
4
@@ -296,7 +296,12 @@
 
5
 tree
 
6
 double_int_to_tree (tree type, double_int cst)
 
7
 {
 
8
-  cst = double_int_ext (cst, TYPE_PRECISION (type), TYPE_UNSIGNED (type));
 
9
+  /* Size types *are* sign extended.  */
 
10
+  bool sign_extended_type = (!TYPE_UNSIGNED (type)
 
11
+                            || (TREE_CODE (type) == INTEGER_TYPE
 
12
+                                && TYPE_IS_SIZETYPE (type)));
 
13
+
 
14
+  cst = double_int_ext (cst, TYPE_PRECISION (type), !sign_extended_type);
 
15
 
 
16
   return build_int_cst_wide (type, cst.low, cst.high);
 
17
 }
 
18
diff -ru gcc-4.5.2/gcc/tree.c gcc-4.5.2-new/gcc/tree.c
 
19
--- gcc-4.5.2/gcc/tree.c        2010-07-07 11:24:27.000000000 -0400
 
20
+++ gcc-4.5.2-new/gcc/tree.c    2011-11-29 10:20:27.626583813 -0500
 
21
@@ -9750,7 +9750,7 @@
 
22
 tree
 
23
 upper_bound_in_type (tree outer, tree inner)
 
24
 {
 
25
-  unsigned HOST_WIDE_INT lo, hi;
 
26
+  double_int high;
 
27
   unsigned int det = 0;
 
28
   unsigned oprec = TYPE_PRECISION (outer);
 
29
   unsigned iprec = TYPE_PRECISION (inner);
 
30
@@ -9797,18 +9797,18 @@
 
31
   /* Compute 2^^prec - 1.  */
 
32
   if (prec <= HOST_BITS_PER_WIDE_INT)
 
33
     {
 
34
-      hi = 0;
 
35
-      lo = ((~(unsigned HOST_WIDE_INT) 0)
 
36
+      high.high = 0;
 
37
+      high.low = ((~(unsigned HOST_WIDE_INT) 0)
 
38
            >> (HOST_BITS_PER_WIDE_INT - prec));
 
39
     }
 
40
   else
 
41
     {
 
42
-      hi = ((~(unsigned HOST_WIDE_INT) 0)
 
43
+      high.high = ((~(unsigned HOST_WIDE_INT) 0)
 
44
            >> (2 * HOST_BITS_PER_WIDE_INT - prec));
 
45
-      lo = ~(unsigned HOST_WIDE_INT) 0;
 
46
+      high.low = ~(unsigned HOST_WIDE_INT) 0;
 
47
     }
 
48
 
 
49
-  return build_int_cst_wide (outer, lo, hi);
 
50
+  return double_int_to_tree (outer, high);
 
51
 }
 
52
 
 
53
 /* Returns the smallest value obtainable by casting something in INNER type to
 
54
diff -ru gcc-4.5.2/gcc/tree-vrp.c gcc-4.5.2-new/gcc/tree-vrp.c
 
55
--- gcc-4.5.2/gcc/tree-vrp.c    2010-06-14 11:23:31.000000000 -0400
 
56
+++ gcc-4.5.2-new/gcc/tree-vrp.c        2011-11-29 10:20:27.628583820 -0500
 
57
@@ -127,10 +127,10 @@
 
58
 static inline tree
 
59
 vrp_val_max (const_tree type)
 
60
 {
 
61
-  if (!INTEGRAL_TYPE_P (type))
 
62
-    return NULL_TREE;
 
63
+  if (INTEGRAL_TYPE_P (type))
 
64
+    return upper_bound_in_type (CONST_CAST_TREE (type), CONST_CAST_TREE (type));
 
65
 
 
66
-  return TYPE_MAX_VALUE (type);
 
67
+  return NULL_TREE;
 
68
 }
 
69
 
 
70
 /* Return the minimum value for TYPE.  */
 
71
@@ -138,10 +138,10 @@
 
72
 static inline tree
 
73
 vrp_val_min (const_tree type)
 
74
 {
 
75
-  if (!INTEGRAL_TYPE_P (type))
 
76
-    return NULL_TREE;
 
77
+  if (INTEGRAL_TYPE_P (type))
 
78
+    return lower_bound_in_type (CONST_CAST_TREE (type), CONST_CAST_TREE (type));
 
79
 
 
80
-  return TYPE_MIN_VALUE (type);
 
81
+  return NULL_TREE;
 
82
 }
 
83
 
 
84
 /* Return whether VAL is equal to the maximum value of its type.  This
 
85
@@ -539,7 +539,7 @@
 
86
   set_value_range (vr, VR_RANGE, zero,
 
87
                   (overflow_infinity
 
88
                    ? positive_overflow_infinity (type)
 
89
-                   : TYPE_MAX_VALUE (type)),
 
90
+                   : vrp_val_max (type)),
 
91
                   vr->equiv);
 
92
 }
 
93
 
 
94
@@ -1595,7 +1595,7 @@
 
95
     }
 
96
   else if (cond_code == LE_EXPR || cond_code == LT_EXPR)
 
97
     {
 
98
-      min = TYPE_MIN_VALUE (type);
 
99
+      min = vrp_val_min (type);
 
100
 
 
101
       if (limit_vr == NULL || limit_vr->type == VR_ANTI_RANGE)
 
102
        max = limit;
 
103
@@ -1630,7 +1630,7 @@
 
104
     }
 
105
   else if (cond_code == GE_EXPR || cond_code == GT_EXPR)
 
106
     {
 
107
-      max = TYPE_MAX_VALUE (type);
 
108
+      max = vrp_val_max (type);
 
109
 
 
110
       if (limit_vr == NULL || limit_vr->type == VR_ANTI_RANGE)
 
111
        min = limit;
 
112
@@ -2047,11 +2047,11 @@
 
113
          || code == ROUND_DIV_EXPR)
 
114
        return (needs_overflow_infinity (TREE_TYPE (res))
 
115
                ? positive_overflow_infinity (TREE_TYPE (res))
 
116
-               : TYPE_MAX_VALUE (TREE_TYPE (res)));
 
117
+               : vrp_val_max (TREE_TYPE (res)));
 
118
       else
 
119
        return (needs_overflow_infinity (TREE_TYPE (res))
 
120
                ? negative_overflow_infinity (TREE_TYPE (res))
 
121
-               : TYPE_MIN_VALUE (TREE_TYPE (res)));
 
122
+               : vrp_val_min (TREE_TYPE (res)));
 
123
     }
 
124
 
 
125
   return res;
 
126
@@ -2750,8 +2750,8 @@
 
127
          && TYPE_PRECISION (inner_type) < TYPE_PRECISION (outer_type))
 
128
        {
 
129
          vr0.type = VR_RANGE;
 
130
-         vr0.min = TYPE_MIN_VALUE (inner_type);
 
131
-         vr0.max = TYPE_MAX_VALUE (inner_type);
 
132
+         vr0.min = vrp_val_min (inner_type);
 
133
+         vr0.max = vrp_val_max (inner_type);
 
134
        }
 
135
 
 
136
       /* If VR0 is a constant range or anti-range and the conversion is
 
137
@@ -2836,7 +2836,7 @@
 
138
            }
 
139
        }
 
140
       else
 
141
-       min = TYPE_MIN_VALUE (type);
 
142
+       min = vrp_val_min (type);
 
143
 
 
144
       if (is_positive_overflow_infinity (vr0.min))
 
145
        max = negative_overflow_infinity (type);
 
146
@@ -2855,7 +2855,7 @@
 
147
            }
 
148
        }
 
149
       else
 
150
-       max = TYPE_MIN_VALUE (type);
 
151
+       max = vrp_val_min (type);
 
152
     }
 
153
   else if (code == NEGATE_EXPR
 
154
           && TYPE_UNSIGNED (type))
 
155
@@ -2897,7 +2897,7 @@
 
156
       else if (!vrp_val_is_min (vr0.min))
 
157
        min = fold_unary_to_constant (code, type, vr0.min);
 
158
       else if (!needs_overflow_infinity (type))
 
159
-       min = TYPE_MAX_VALUE (type);
 
160
+       min = vrp_val_max (type);
 
161
       else if (supports_overflow_infinity (type))
 
162
        min = positive_overflow_infinity (type);
 
163
       else
 
164
@@ -2911,7 +2911,7 @@
 
165
       else if (!vrp_val_is_min (vr0.max))
 
166
        max = fold_unary_to_constant (code, type, vr0.max);
 
167
       else if (!needs_overflow_infinity (type))
 
168
-       max = TYPE_MAX_VALUE (type);
 
169
+       max = vrp_val_max (type);
 
170
       else if (supports_overflow_infinity (type)
 
171
               /* We shouldn't generate [+INF, +INF] as set_value_range
 
172
                  doesn't like this and ICEs.  */
 
173
@@ -2941,7 +2941,7 @@
 
174
                 TYPE_MIN_VALUE, remember -TYPE_MIN_VALUE = TYPE_MIN_VALUE.  */
 
175
              if (TYPE_OVERFLOW_WRAPS (type))
 
176
                {
 
177
-                 tree type_min_value = TYPE_MIN_VALUE (type);
 
178
+                 tree type_min_value = vrp_val_min (type);
 
179
 
 
180
                  min = (vr0.min != type_min_value
 
181
                         ? int_const_binop (PLUS_EXPR, type_min_value,
 
182
@@ -2953,7 +2953,7 @@
 
183
                  if (overflow_infinity_range_p (&vr0))
 
184
                    min = negative_overflow_infinity (type);
 
185
                  else
 
186
-                   min = TYPE_MIN_VALUE (type);
 
187
+                   min = vrp_val_min (type);
 
188
                }
 
189
            }
 
190
          else
 
191
@@ -2974,7 +2974,7 @@
 
192
                    }
 
193
                }
 
194
              else
 
195
-               max = TYPE_MAX_VALUE (type);
 
196
+               max = vrp_val_max (type);
 
197
            }
 
198
        }
 
199
 
 
200
@@ -3258,11 +3258,11 @@
 
201
   if (POINTER_TYPE_P (type) || !TYPE_MIN_VALUE (type))
 
202
     tmin = lower_bound_in_type (type, type);
 
203
   else
 
204
-    tmin = TYPE_MIN_VALUE (type);
 
205
+    tmin = vrp_val_min (type);
 
206
   if (POINTER_TYPE_P (type) || !TYPE_MAX_VALUE (type))
 
207
     tmax = upper_bound_in_type (type, type);
 
208
   else
 
209
-    tmax = TYPE_MAX_VALUE (type);
 
210
+    tmax = vrp_val_max (type);
 
211
 
 
212
   if (vr->type == VR_VARYING || vr->type == VR_UNDEFINED)
 
213
     {
 
214
@@ -4146,8 +4146,8 @@
 
215
   if ((comp_code == GT_EXPR || comp_code == LT_EXPR)
 
216
       && INTEGRAL_TYPE_P (TREE_TYPE (val)))
 
217
     {
 
218
-      tree min = TYPE_MIN_VALUE (TREE_TYPE (val));
 
219
-      tree max = TYPE_MAX_VALUE (TREE_TYPE (val));
 
220
+      tree min = vrp_val_min (TREE_TYPE (val));
 
221
+      tree max = vrp_val_max (TREE_TYPE (val));
 
222
 
 
223
       if (comp_code == GT_EXPR
 
224
          && (!max
 
225
@@ -6426,13 +6426,13 @@
 
226
                 VARYING.  Same if the previous max value was invalid for
 
227
                 the type and we'd end up with vr_result.min > vr_result.max.  */
 
228
              if (vrp_val_is_max (vr_result.max)
 
229
-                 || compare_values (TYPE_MIN_VALUE (TREE_TYPE (vr_result.min)),
 
230
+                 || compare_values (vrp_val_min (TREE_TYPE (vr_result.min)),
 
231
                                     vr_result.max) > 0)
 
232
                goto varying;
 
233
 
 
234
              if (!needs_overflow_infinity (TREE_TYPE (vr_result.min))
 
235
                  || !vrp_var_may_overflow (lhs, phi))
 
236
-               vr_result.min = TYPE_MIN_VALUE (TREE_TYPE (vr_result.min));
 
237
+               vr_result.min = vrp_val_min (TREE_TYPE (vr_result.min));
 
238
              else if (supports_overflow_infinity (TREE_TYPE (vr_result.min)))
 
239
                vr_result.min =
 
240
                  negative_overflow_infinity (TREE_TYPE (vr_result.min));
 
241
@@ -6448,13 +6448,13 @@
 
242
                 VARYING.  Same if the previous min value was invalid for
 
243
                 the type and we'd end up with vr_result.max < vr_result.min.  */
 
244
              if (vrp_val_is_min (vr_result.min)
 
245
-                 || compare_values (TYPE_MAX_VALUE (TREE_TYPE (vr_result.max)),
 
246
+                 || compare_values (vrp_val_max (TREE_TYPE (vr_result.max)),
 
247
                                     vr_result.min) < 0)
 
248
                goto varying;
 
249
 
 
250
              if (!needs_overflow_infinity (TREE_TYPE (vr_result.max))
 
251
                  || !vrp_var_may_overflow (lhs, phi))
 
252
-               vr_result.max = TYPE_MAX_VALUE (TREE_TYPE (vr_result.max));
 
253
+               vr_result.max = vrp_val_max (TREE_TYPE (vr_result.max));
 
254
              else if (supports_overflow_infinity (TREE_TYPE (vr_result.max)))
 
255
                vr_result.max =
 
256
                  positive_overflow_infinity (TREE_TYPE (vr_result.max));
 
257
@@ -6782,7 +6782,7 @@
 
258
     {
 
259
       /* This should not be negative infinity; there is no overflow
 
260
         here.  */
 
261
-      min = TYPE_MIN_VALUE (TREE_TYPE (op0));
 
262
+      min = vrp_val_min (TREE_TYPE (op0));
 
263
 
 
264
       max = op1;
 
265
       if (cond_code == LT_EXPR && !is_overflow_infinity (max))
 
266
@@ -6797,7 +6797,7 @@
 
267
     {
 
268
       /* This should not be positive infinity; there is no overflow
 
269
         here.  */
 
270
-      max = TYPE_MAX_VALUE (TREE_TYPE (op0));
 
271
+      max = vrp_val_max (TREE_TYPE (op0));
 
272
 
 
273
       min = op1;
 
274
       if (cond_code == GT_EXPR && !is_overflow_infinity (min))