]> git.pld-linux.org Git - packages/crossppc-gcc.git/blob - gcc-branch.diff
37a8af1a17e9b3f59b1c2497abd56392fa65e614
[packages/crossppc-gcc.git] / gcc-branch.diff
1 Index: configure
2 ===================================================================
3 --- configure   (.../tags/gcc_4_2_0_release)    (wersja 125589)
4 +++ configure   (.../branches/gcc-4_2-branch)   (wersja 125589)
5 @@ -7337,6 +7337,12 @@
6  #line 7338 "configure"
7  #include "confdefs.h"
8  
9 +#if (__GNUC__ < 3) \
10 +    || (__GNUC__ == 3 && (__GNUC_MINOR__ < 3 \
11 +                         || (__GNUC_MINOR__ == 3 && __GNUC_PATCHLEVEL__ < 1)))
12 +#error http://gcc.gnu.org/PR29382
13 +#endif
14 +    
15  int main() {
16  
17  ; return 0; }
18 Index: gcc/tree-vrp.c
19 ===================================================================
20 --- gcc/tree-vrp.c      (.../tags/gcc_4_2_0_release)    (wersja 125589)
21 +++ gcc/tree-vrp.c      (.../branches/gcc-4_2-branch)   (wersja 125589)
22 @@ -195,7 +195,28 @@
23               || operand_equal_p (val, TYPE_MIN_VALUE (TREE_TYPE (val)), 0)));
24  }
25  
26 +/* If VAL is now an overflow infinity, return VAL.  Otherwise, return
27 +   the same value with TREE_OVERFLOW clear.  This can be used to avoid
28 +   confusing a regular value with an overflow value.  */
29  
30 +static inline tree
31 +avoid_overflow_infinity (tree val)
32 +{
33 +  if (!is_overflow_infinity (val))
34 +    return val;
35 +
36 +  if (operand_equal_p (val, TYPE_MAX_VALUE (TREE_TYPE (val)), 0))
37 +    return TYPE_MAX_VALUE (TREE_TYPE (val));
38 +  else
39 +    {
40 +#ifdef ENABLE_CHECKING
41 +      gcc_assert (operand_equal_p (val, TYPE_MIN_VALUE (TREE_TYPE (val)), 0));
42 +#endif
43 +      return TYPE_MIN_VALUE (TREE_TYPE (val));
44 +    }
45 +}
46 +
47 +
48  /* Return whether VAL is equal to the maximum value of its type.  This
49     will be true for a positive overflow infinity.  We can't do a
50     simple equality comparison with TYPE_MAX_VALUE because C typedefs
51 @@ -351,23 +372,11 @@
52     infinity when we shouldn't.  */
53  
54  static inline void
55 -set_value_range_to_value (value_range_t *vr, tree val)
56 +set_value_range_to_value (value_range_t *vr, tree val, bitmap equiv)
57  {
58    gcc_assert (is_gimple_min_invariant (val));
59 -  if (is_overflow_infinity (val))
60 -    {
61 -      if (operand_equal_p (val, TYPE_MAX_VALUE (TREE_TYPE (val)), 0))
62 -       val = TYPE_MAX_VALUE (TREE_TYPE (val));
63 -      else
64 -       {
65 -#ifdef ENABLE_CHECKING
66 -         gcc_assert (operand_equal_p (val,
67 -                                      TYPE_MIN_VALUE (TREE_TYPE (val)), 0));
68 -#endif
69 -         val = TYPE_MIN_VALUE (TREE_TYPE (val));
70 -       }
71 -    }
72 -  set_value_range (vr, VR_RANGE, val, val, NULL);
73 +  val = avoid_overflow_infinity (val);
74 +  set_value_range (vr, VR_RANGE, val, val, equiv);
75  }
76  
77  /* Set value range VR to a non-negative range of type TYPE.
78 @@ -411,8 +420,7 @@
79  static inline void
80  set_value_range_to_null (value_range_t *vr, tree type)
81  {
82 -  tree zero = build_int_cst (type, 0);
83 -  set_value_range (vr, VR_RANGE, zero, zero, vr->equiv);
84 +  set_value_range_to_value (vr, build_int_cst (type, 0), vr->equiv);
85  }
86  
87  
88 @@ -763,7 +771,9 @@
89        if (!TYPE_OVERFLOW_UNDEFINED (TREE_TYPE (val1)))
90         return -2;
91  
92 -      if (strict_overflow_p != NULL)
93 +      if (strict_overflow_p != NULL
94 +         && (code1 == SSA_NAME || !TREE_NO_WARNING (val1))
95 +         && (code2 == SSA_NAME || !TREE_NO_WARNING (val2)))
96         *strict_overflow_p = true;
97  
98        if (code1 == SSA_NAME)
99 @@ -1028,6 +1038,8 @@
100        cond_code = swap_tree_comparison (TREE_CODE (cond));
101      }
102  
103 +  limit = avoid_overflow_infinity (limit);
104 +
105    type = TREE_TYPE (limit);
106    gcc_assert (limit != var);
107  
108 @@ -1167,6 +1179,8 @@
109             {
110               tree one = build_int_cst (type, 1);
111               max = fold_build2 (MINUS_EXPR, type, max, one);
112 +             if (EXPR_P (max))
113 +               TREE_NO_WARNING (max) = 1;
114             }
115  
116           set_value_range (vr_p, VR_RANGE, min, max, vr_p->equiv);
117 @@ -1200,6 +1214,8 @@
118             {
119               tree one = build_int_cst (type, 1);
120               min = fold_build2 (PLUS_EXPR, type, min, one);
121 +             if (EXPR_P (min))
122 +               TREE_NO_WARNING (min) = 1;
123             }
124  
125           set_value_range (vr_p, VR_RANGE, min, max, vr_p->equiv);
126 @@ -1619,7 +1635,7 @@
127    if (TREE_CODE (op0) == SSA_NAME)
128      vr0 = *(get_value_range (op0));
129    else if (is_gimple_min_invariant (op0))
130 -    set_value_range_to_value (&vr0, op0);
131 +    set_value_range_to_value (&vr0, op0, NULL);
132    else
133      set_value_range_to_varying (&vr0);
134  
135 @@ -1627,7 +1643,7 @@
136    if (TREE_CODE (op1) == SSA_NAME)
137      vr1 = *(get_value_range (op1));
138    else if (is_gimple_min_invariant (op1))
139 -    set_value_range_to_value (&vr1, op1);
140 +    set_value_range_to_value (&vr1, op1, NULL);
141    else
142      set_value_range_to_varying (&vr1);
143  
144 @@ -2006,7 +2022,7 @@
145    if (TREE_CODE (op0) == SSA_NAME)
146      vr0 = *(get_value_range (op0));
147    else if (is_gimple_min_invariant (op0))
148 -    set_value_range_to_value (&vr0, op0);
149 +    set_value_range_to_value (&vr0, op0, NULL);
150    else
151      set_value_range_to_varying (&vr0);
152  
153 @@ -2393,7 +2409,10 @@
154          its type may be different from _Bool.  Convert VAL to EXPR's
155          type.  */
156        val = fold_convert (TREE_TYPE (expr), val);
157 -      set_value_range (vr, VR_RANGE, val, val, vr->equiv);
158 +      if (is_gimple_min_invariant (val))
159 +       set_value_range_to_value (vr, val, vr->equiv);
160 +      else
161 +       set_value_range (vr, VR_RANGE, val, val, vr->equiv);
162      }
163    else
164      set_value_range_to_varying (vr);
165 @@ -2424,7 +2443,7 @@
166    else if (TREE_CODE_CLASS (code) == tcc_comparison)
167      extract_range_from_comparison (vr, expr);
168    else if (is_gimple_min_invariant (expr))
169 -    set_value_range_to_value (vr, expr);
170 +    set_value_range_to_value (vr, expr, NULL);
171    else
172      set_value_range_to_varying (vr);
173  
174 @@ -2545,6 +2564,13 @@
175               if (compare_values (min, max) == 1)
176                 return;
177             }
178 +
179 +         /* According to the loop information, the variable does not
180 +            overflow.  If we think it does, probably because of an
181 +            overflow due to arithmetic on a different INF value,
182 +            reset now.  */
183 +         if (is_negative_overflow_infinity (min))
184 +           min = tmin;
185         }
186        else
187         {
188 @@ -2557,13 +2583,62 @@
189               if (compare_values (min, max) == 1)
190                 return;
191             }
192 +
193 +         if (is_positive_overflow_infinity (max))
194 +           max = tmax;
195         }
196  
197        set_value_range (vr, VR_RANGE, min, max, vr->equiv);
198      }
199  }
200  
201 +/* Return true if VAR may overflow at STMT.  This checks any available
202 +   loop information to see if we can determine that VAR does not
203 +   overflow.  */
204  
205 +static bool
206 +vrp_var_may_overflow (tree var, tree stmt)
207 +{
208 +  struct loop *l;
209 +  tree chrec, init, step;
210 +
211 +  if (current_loops == NULL)
212 +    return true;
213 +
214 +  l = loop_containing_stmt (stmt);
215 +  if (l == NULL)
216 +    return true;
217 +
218 +  chrec = instantiate_parameters (l, analyze_scalar_evolution (l, var));
219 +  if (TREE_CODE (chrec) != POLYNOMIAL_CHREC)
220 +    return true;
221 +
222 +  init = initial_condition_in_loop_num (chrec, l->num);
223 +  step = evolution_part_in_loop_num (chrec, l->num);
224 +
225 +  if (step == NULL_TREE
226 +      || !is_gimple_min_invariant (step)
227 +      || !valid_value_p (init))
228 +    return true;
229 +
230 +  /* If we get here, we know something useful about VAR based on the
231 +     loop information.  If it wraps, it may overflow.  */
232 +
233 +  if (scev_probably_wraps_p (init, step, stmt,
234 +                            current_loops->parray[CHREC_VARIABLE (chrec)],
235 +                            true))
236 +    return true;
237 +
238 +  if (dump_file && (dump_flags & TDF_DETAILS) != 0)
239 +    {
240 +      print_generic_expr (dump_file, var, 0);
241 +      fprintf (dump_file, ": loop information indicates does not overflow\n");
242 +    }
243 +
244 +  return false;
245 +}
246 +
247 +
248  /* Given two numeric value ranges VR0, VR1 and a comparison code COMP:
249     
250     - Return BOOLEAN_TRUE_NODE if VR0 COMP VR1 always returns true for
251 @@ -4156,7 +4231,7 @@
252        t = retval = NULL_TREE;
253        EXECUTE_IF_SET_IN_BITMAP (e2, 0, i2, bi2)
254         {
255 -         bool sop;
256 +         bool sop = false;
257  
258           value_range_t vr2 = *(vr_value[i2]);
259  
260 @@ -4773,7 +4848,8 @@
261               if (vrp_val_is_max (vr_result.max))
262                 goto varying;
263  
264 -             if (!needs_overflow_infinity (TREE_TYPE (vr_result.min)))
265 +             if (!needs_overflow_infinity (TREE_TYPE (vr_result.min))
266 +                 || !vrp_var_may_overflow (lhs, phi))
267                 vr_result.min = TYPE_MIN_VALUE (TREE_TYPE (vr_result.min));
268               else if (supports_overflow_infinity (TREE_TYPE (vr_result.min)))
269                 vr_result.min =
270 @@ -4791,7 +4867,8 @@
271               if (vrp_val_is_min (vr_result.min))
272                 goto varying;
273  
274 -             if (!needs_overflow_infinity (TREE_TYPE (vr_result.max)))
275 +             if (!needs_overflow_infinity (TREE_TYPE (vr_result.max))
276 +                 || !vrp_var_may_overflow (lhs, phi))
277                 vr_result.max = TYPE_MAX_VALUE (TREE_TYPE (vr_result.max));
278               else if (supports_overflow_infinity (TREE_TYPE (vr_result.max)))
279                 vr_result.max =
280 @@ -4971,6 +5048,8 @@
281         {
282           tree one = build_int_cst (TREE_TYPE (op0), 1);
283           max = fold_build2 (MINUS_EXPR, TREE_TYPE (op0), max, one);
284 +         if (EXPR_P (max))
285 +           TREE_NO_WARNING (max) = 1;
286         }
287      }
288    else if (cond_code == GE_EXPR || cond_code == GT_EXPR)
289 @@ -4984,6 +5063,8 @@
290         {
291           tree one = build_int_cst (TREE_TYPE (op0), 1);
292           min = fold_build2 (PLUS_EXPR, TREE_TYPE (op0), min, one);
293 +         if (EXPR_P (min))
294 +           TREE_NO_WARNING (min) = 1;
295         }
296      }
297  
298 Index: gcc/DATESTAMP
299 ===================================================================
300 --- gcc/DATESTAMP       (.../tags/gcc_4_2_0_release)    (wersja 125589)
301 +++ gcc/DATESTAMP       (.../branches/gcc-4_2-branch)   (wersja 125589)
302 @@ -1 +1 @@
303 -20070514
304 +20070609
305 Index: gcc/pointer-set.c
306 ===================================================================
307 --- gcc/pointer-set.c   (.../tags/gcc_4_2_0_release)    (wersja 125589)
308 +++ gcc/pointer-set.c   (.../branches/gcc-4_2-branch)   (wersja 125589)
309 @@ -22,13 +22,12 @@
310  #include "system.h"
311  #include "pointer-set.h"
312  
313 -/* A pointer sets is represented as a simple open-addressing hash
314 +/* A pointer set is represented as a simple open-addressing hash
315     table.  Simplifications: The hash code is based on the value of the
316     pointer, not what it points to.  The number of buckets is always a
317     power of 2.  Null pointers are a reserved value.  Deletion is not
318 -   supported.  There is no mechanism for user control of hash
319 -   function, equality comparison, initial size, or resizing policy.
320 -*/
321 +   supported (yet).  There is no mechanism for user control of hash
322 +   function, equality comparison, initial size, or resizing policy.  */
323  
324  struct pointer_set_t
325  {
326 @@ -114,22 +113,16 @@
327      }
328  }
329  
330 -/* Subroutine of pointer_set_insert.  Inserts P into an empty
331 -   element of SLOTS, an array of length N_SLOTS.  Returns nonzero
332 -   if P was already present in N_SLOTS.  */
333 -static int
334 +/* Subroutine of pointer_set_insert.  Return the insertion slot for P into
335 +   an empty element of SLOTS, an array of length N_SLOTS.  */
336 +static inline size_t
337  insert_aux (void *p, void **slots, size_t n_slots, size_t log_slots)
338  {
339    size_t n = hash1 (p, n_slots, log_slots);
340    while (true)
341      {
342 -      if (slots[n] == p)
343 -       return 1;
344 -      else if (slots[n] == 0)
345 -       {
346 -         slots[n] = p;
347 -         return 0;
348 -       }
349 +      if (slots[n] == p || slots[n] == 0)
350 +       return n;
351        else
352         {
353           ++n;
354 @@ -144,12 +137,10 @@
355  int
356  pointer_set_insert (struct pointer_set_t *pset, void *p)
357  {
358 -  if (insert_aux (p, pset->slots, pset->n_slots, pset->log_slots))
359 -    return 1;
360 -      
361 -  /* We've inserted a new element.  Expand the table if necessary to keep
362 -     the load factor small.  */
363 -  ++pset->n_elements;
364 +  size_t n;
365 +
366 +  /* For simplicity, expand the set even if P is already there.  This can be
367 +     superfluous but can happen at most once.  */
368    if (pset->n_elements > pset->n_slots / 4)
369      {
370        size_t new_log_slots = pset->log_slots + 1;
371 @@ -158,9 +149,10 @@
372        size_t i;
373  
374        for (i = 0; i < pset->n_slots; ++i)
375 -       {
376 -         if (pset->slots[i])
377 -           insert_aux (pset->slots[i], new_slots, new_n_slots, new_log_slots);
378 +        {
379 +         void *value = pset->slots[i];
380 +         n = insert_aux (value, new_slots, new_n_slots, new_log_slots);
381 +         new_slots[n] = value;
382         }
383  
384        XDELETEVEC (pset->slots);
385 @@ -169,5 +161,144 @@
386        pset->slots = new_slots;
387      }
388  
389 +  n = insert_aux (p, pset->slots, pset->n_slots, pset->log_slots);
390 +  if (pset->slots[n])
391 +    return 1;
392 +
393 +  pset->slots[n] = p;
394 +  ++pset->n_elements;
395    return 0;
396  }
397 +
398 +/* Pass each pointer in PSET to the function in FN, together with the fixed
399 +   parameter DATA.  If FN returns false, the iteration stops.  */
400 +
401 +void pointer_set_traverse (struct pointer_set_t *pset,
402 +                          bool (*fn) (void *, void *), void *data)
403 +{
404 +  size_t i;
405 +  for (i = 0; i < pset->n_slots; ++i)
406 +    if (pset->slots[i] && !fn (pset->slots[i], data))
407 +      break;
408 +}
409 +
410 +\f
411 +/* A pointer map is represented the same way as a pointer_set, so
412 +   the hash code is based on the address of the key, rather than
413 +   its contents.  Null keys are a reserved value.  Deletion is not
414 +   supported (yet).  There is no mechanism for user control of hash
415 +   function, equality comparison, initial size, or resizing policy.  */
416 +
417 +struct pointer_map_t
418 +{
419 +  size_t log_slots;
420 +  size_t n_slots;              /* n_slots = 2^log_slots */
421 +  size_t n_elements;
422 +
423 +  void **keys;
424 +  void **values;
425 +};
426 +
427 +/* Allocate an empty pointer map.  */
428 +struct pointer_map_t *
429 +pointer_map_create (void)
430 +{
431 +  struct pointer_map_t *result = XNEW (struct pointer_map_t);
432 +
433 +  result->n_elements = 0;
434 +  result->log_slots = 8;
435 +  result->n_slots = (size_t) 1 << result->log_slots;
436 +
437 +  result->keys = XCNEWVEC (void *, result->n_slots);
438 +  result->values = XCNEWVEC (void *, result->n_slots);
439 +  return result;
440 +}
441 +
442 +/* Reclaims all memory associated with PMAP.  */
443 +void pointer_map_destroy (struct pointer_map_t *pmap)
444 +{
445 +  XDELETEVEC (pmap->keys);
446 +  XDELETEVEC (pmap->values);
447 +  XDELETE (pmap);
448 +}
449 +
450 +/* Returns a pointer to the value to which P maps, if PMAP contains P.  P
451 +   must be nonnull.  Return NULL if PMAP does not contain P.
452 +
453 +   Collisions are resolved by linear probing.  */
454 +void **
455 +pointer_map_contains (struct pointer_map_t *pmap, void *p)
456 +{
457 +  size_t n = hash1 (p, pmap->n_slots, pmap->log_slots);
458 +
459 +  while (true)
460 +    {
461 +      if (pmap->keys[n] == p)
462 +       return &pmap->values[n];
463 +      else if (pmap->keys[n] == 0)
464 +       return NULL;
465 +      else
466 +       {
467 +         ++n;
468 +         if (n == pmap->n_slots)
469 +           n = 0;
470 +       }
471 +    }
472 +}
473 +
474 +/* Inserts P into PMAP if it wasn't already there.  Returns a pointer
475 +   to the value.  P must be nonnull.  */
476 +void **
477 +pointer_map_insert (struct pointer_map_t *pmap, void *p)
478 +{
479 +  size_t n;
480 +
481 +  /* For simplicity, expand the map even if P is already there.  This can be
482 +     superfluous but can happen at most once.  */
483 +  if (pmap->n_elements > pmap->n_slots / 4)
484 +    {
485 +      size_t new_log_slots = pmap->log_slots + 1;
486 +      size_t new_n_slots = pmap->n_slots * 2;
487 +      void **new_keys = XCNEWVEC (void *, new_n_slots);
488 +      void **new_values = XCNEWVEC (void *, new_n_slots);
489 +      size_t i;
490 +
491 +      for (i = 0; i < pmap->n_slots; ++i)
492 +       if (pmap->keys[i])
493 +         {
494 +           void *key = pmap->keys[i];
495 +           n = insert_aux (key, new_keys, new_n_slots, new_log_slots);
496 +           new_keys[n] = key;
497 +           new_values[n] = pmap->values[i];
498 +         }
499 +
500 +      XDELETEVEC (pmap->keys);
501 +      XDELETEVEC (pmap->values);
502 +      pmap->n_slots = new_n_slots;
503 +      pmap->log_slots = new_log_slots;
504 +      pmap->keys = new_keys;
505 +      pmap->values = new_values;
506 +    }
507 +
508 +  n = insert_aux (p, pmap->keys, pmap->n_slots, pmap->log_slots);
509 +  if (!pmap->keys[n])
510 +    {
511 +      ++pmap->n_elements;
512 +      pmap->keys[n] = p;
513 +    }
514 +
515 +  return &pmap->values[n];
516 +}
517 +
518 +/* Pass each pointer in PMAP to the function in FN, together with the pointer
519 +   to the value and the fixed parameter DATA.  If FN returns false, the
520 +   iteration stops.  */
521 +
522 +void pointer_map_traverse (struct pointer_map_t *pmap,
523 +                          bool (*fn) (void *, void **, void *), void *data)
524 +{
525 +  size_t i;
526 +  for (i = 0; i < pmap->n_slots; ++i)
527 +    if (pmap->keys[i] && !fn (pmap->keys[i], &pmap->values[i], data))
528 +      break;
529 +}
530 Index: gcc/pointer-set.h
531 ===================================================================
532 --- gcc/pointer-set.h   (.../tags/gcc_4_2_0_release)    (wersja 125589)
533 +++ gcc/pointer-set.h   (.../branches/gcc-4_2-branch)   (wersja 125589)
534 @@ -22,11 +22,21 @@
535  #define POINTER_SET_H
536  
537  struct pointer_set_t;
538 -
539  struct pointer_set_t *pointer_set_create (void);
540  void pointer_set_destroy (struct pointer_set_t *pset);
541  
542  int pointer_set_contains (struct pointer_set_t *pset, void *p);
543  int pointer_set_insert (struct pointer_set_t *pset, void *p);
544 +void pointer_set_traverse (struct pointer_set_t *, bool (*) (void *, void *),
545 +                          void *);
546  
547 +struct pointer_map_t;
548 +struct pointer_map_t *pointer_map_create (void);
549 +void pointer_map_destroy (struct pointer_map_t *pmap);
550 +
551 +void **pointer_map_contains (struct pointer_map_t *pmap, void *p);
552 +void **pointer_map_insert (struct pointer_map_t *pmap, void *p);
553 +void pointer_map_traverse (struct pointer_map_t *,
554 +                          bool (*) (void *, void **, void *), void *);
555 +
556  #endif  /* POINTER_SET_H  */
557 Index: gcc/fold-const.c
558 ===================================================================
559 --- gcc/fold-const.c    (.../tags/gcc_4_2_0_release)    (wersja 125589)
560 +++ gcc/fold-const.c    (.../branches/gcc-4_2-branch)   (wersja 125589)
561 @@ -4450,13 +4450,24 @@
562         {
563           low = range_successor (high1);
564           high = high0;
565 -         in_p = (low != 0);
566 +         in_p = 1;
567 +         if (low == 0)
568 +           {
569 +             /* We are in the weird situation where high0 > high1 but
570 +                high1 has no successor.  Punt.  */
571 +             return 0;
572 +           }
573         }
574        else if (! subset || highequal)
575         {
576           low = low0;
577           high = range_predecessor (low1);
578 -         in_p = (high != 0);
579 +         in_p = 1;
580 +         if (high == 0)
581 +           {
582 +             /* low0 < low1 but low1 has no predecessor.  Punt.  */
583 +             return 0;
584 +           }
585         }
586        else
587         return 0;
588 @@ -4476,7 +4487,12 @@
589         {
590           low = range_successor (high0);
591           high = high1;
592 -         in_p = (low != 0);
593 +         in_p = 1;
594 +         if (low == 0)
595 +           {
596 +             /* high1 > high0 but high0 has no successor.  Punt.  */
597 +             return 0;
598 +           }
599         }
600      }
601  
602 @@ -12634,9 +12650,14 @@
603        /* ... fall through ...  */
604  
605      default:
606 -      if (truth_value_p (TREE_CODE (t)))
607 -       /* Truth values evaluate to 0 or 1, which is nonnegative.  */
608 -       return 1;
609 +      {
610 +       tree type = TREE_TYPE (t);
611 +       if ((TYPE_PRECISION (type) != 1 || TYPE_UNSIGNED (type))
612 +           && truth_value_p (TREE_CODE (t)))
613 +         /* Truth values evaluate to 0 or 1, which is nonnegative unless we
614 +             have a signed:1 type (where the value is -1 and 0).  */
615 +         return true;
616 +      }
617      }
618  
619    /* We don't know sign of `t', so be conservative and return false.  */
620 Index: gcc/DEV-PHASE
621 ===================================================================
622 --- gcc/DEV-PHASE       (.../tags/gcc_4_2_0_release)    (wersja 125589)
623 +++ gcc/DEV-PHASE       (.../branches/gcc-4_2-branch)   (wersja 125589)
624 @@ -0,0 +1 @@
625 +prerelease
626 Index: gcc/ChangeLog
627 ===================================================================
628 --- gcc/ChangeLog       (.../tags/gcc_4_2_0_release)    (wersja 125589)
629 +++ gcc/ChangeLog       (.../branches/gcc-4_2-branch)   (wersja 125589)
630 @@ -1,3 +1,201 @@
631 +2007-06-08  Kaz Kojima  <kkojima@gcc.gnu.org>
632 +
633 +       PR target/32163
634 +       Backport from mainline.
635 +       * config/sh/sh.md (symGOT_load): Don't schedule insns when
636 +       the symbol is generated with the stack protector.
637 +
638 +2007-06-06  Ian Lance Taylor  <iant@google.com>
639 +
640 +       * fold-const.c (merge_ranges): If range_successor or
641 +       range_predecessor fail, just return 0.
642 +
643 +2007-06-05  Ian Lance Taylor  <iant@google.com>
644 +
645 +       * tree-vrp.c (compare_values_warnv): Check TREE_NO_WARNING on a
646 +       PLUS_EXPR or MINUS_EXPR node before setting *strict_overflow_p.
647 +       (extract_range_from_assert): Set TREE_NO_WARNING when creating an
648 +       expression.
649 +       (test_for_singularity): Likewise.
650 +
651 +2007-06-04  Ian Lance Taylor  <iant@google.com>
652 +
653 +       * tree-vrp.c (adjust_range_with_scev): When loop is not expected
654 +       to overflow, reduce overflow infinity to regular infinity.
655 +       (vrp_var_may_overflow): New static function.
656 +       (vrp_visit_phi_node): Check vrp_var_may_overflow.
657 +
658 +2007-05-31  H.J. Lu  <hongjiu.lu@intel.com>
659 +
660 +       Backport from mainline:
661 +       2007-05-25  H.J. Lu  <hongjiu.lu@intel.com>
662 +
663 +       * config/i386/i386.c (__builtin_ia32_vec_ext_v2df): Mark it
664 +       with MASK_SSE2.
665 +       (__builtin_ia32_vec_ext_v2di): Likewise.
666 +       (__builtin_ia32_vec_ext_v4si): Likewise.
667 +       (__builtin_ia32_vec_ext_v8hi): Likewise.
668 +       (__builtin_ia32_vec_set_v8hi): Likewise.
669 +
670 +2007-05-31  John David Anglin  <dave.anglin@nrc-cnrc.gc.ca>
671 +
672 +       Backport from mainline:
673 +       2007-05-05  Aurelien Jarno  <aurelien@aurel32.net>
674 +
675 +       * config/pa/pa.md: Split tgd_load, tld_load and tie_load
676 +       into pic and non-pic versions. Mark r19 as used for 
677 +       tgd_load_pic, tld_load_pic and tie_load_pic. Mark r27 as used 
678 +       for tgd_load, tld_load and tie_load .
679 +       * config/pa/pa.c (legitimize_tls_address): Emit pic or non-pic
680 +       version of tgd_load, tld_load and tie_load depending on the 
681 +       value of flag_pic.
682 +
683 +2007-05-27  Daniel Berlin <dberlin@dberlin.org>
684 +
685 +       Fix PR/30052
686 +       Backport PTA solver from mainline
687 +
688 +       * pointer-set.c: Copy from mainline
689 +       * pointer-set.h: Ditto.
690 +       * tree-ssa-structalias.c: Copy solver portions from mainline.
691 +       * Makefile.in (tree-ssa-structalias.o): Update dependencies
692 +
693 +2007-05-30  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
694 +
695 +       * tree-vrp.c (compare_names): Initialize sop.
696 +
697 +2007-05-30  Jakub Jelinek  <jakub@redhat.com>
698 +
699 +       PR tree-optimization/31769
700 +       * except.c (duplicate_eh_regions): Clear prev_try if
701 +       ERT_MUST_NOT_THROW region is inside of ERT_TRY region.
702 +
703 +2007-05-28  Andrew Pinski  <andrew_pinski@playstation.sony.com>
704 +
705 +       PR tree-opt/32100
706 +       * fold-const.c (tree_expr_nonnegative_warnv_p): Don't
707 +       return true when truth_value_p is true and the type
708 +       is of signed:1.
709 +
710 +2007-05-27  H.J. Lu  <hongjiu.lu@intel.com>
711 +
712 +       Backport from mainline:
713 +       2007-05-25  Uros Bizjak  <ubizjak@gmail.com>
714 +
715 +       * config/i386/sse.md (*vec_extractv2di_1_sse2): Do not calculate
716 +       "memory" attribute for "sseishft" type insn without operands[2].
717 +
718 +       2007-05-25  H.J. Lu  <hongjiu.lu@intel.com>
719 +
720 +       * config/i386/sse.md (*vec_extractv2di_1_sse2): Correct shift.
721 +
722 +2007-05-22  Ian Lance Taylor  <iant@google.com>
723 +
724 +       * tree-vrp.c (avoid_overflow_infinity): New static function,
725 +       broken out of set_value_range_to_value.
726 +       (set_value_range_to_value): Call avoid_overflow_infinity.
727 +       (extract_range_from_assert): Likewise.
728 +
729 +2007-05-23  Chen Liqin  <liqin@sunnorth.com.cn>
730 +
731 +       PR target/30987
732 +       * config/score/misc.md (bitclr_c, bitset_c, bittgl_c): remove.
733 +       * config/score/predicate.md (const_pow2, const_npow2): remove.
734 +       * config/score/score.h (ASM_OUTPUT_EXTERNAL): add ASM_OUTPUT_EXTERNAL undef.
735 +       PR target/30474
736 +       * config/score/score.c (score_print_operand): makes sure that only lower 
737 +       bits are used.
738 +       
739 +2007-05-21  Uros Bizjak  <ubizjak@gmail.com>
740 +
741 +       PR target/31167
742 +       Backport from mainline.
743 +       * config/i386/i386.md (*addti3_1, *addti3_1 splitter): Use
744 +       x86_64_general_operand as operand[2] predicate.  Remove "iF"
745 +       from operand constraints and use "e" constraint instead.
746 +       (*subti3_1, *subti3_1 splitter): Ditto.
747 +       (*negti2_1, *negti2_1 splitter): Use nonimmediate_operand as
748 +       operand[1] predicate.
749 +
750 +2007-05-21  Uros Bizjak  <ubizjak@gmail.com>
751 +
752 +       PR target/30041
753 +       Backport from mainline.
754 +       * config/i386/sse.md ("*sse3_movddup"): Use operands[0] and
755 +       operands[1] in insn constraint.  Correct type attribute to sselog1.
756 +
757 +2007-05-20  Kaz Kojima  <kkojima@gcc.gnu.org>
758 +
759 +       PR target/31701
760 +       Backport from mainline.
761 +       * config/sh/sh.c (output_stack_adjust): Avoid using the frame
762 +       register itself to hold the offset constant.  Tell flow the use
763 +       of r4 and r5 when they are used.
764 +
765 +2007-05-20  Kaz Kojima  <kkojima@gcc.gnu.org>
766 +
767 +       PR target/31480
768 +       Backport from mainline.
769 +       * config/sh/sh.md (length): Check if prev_nonnote_insn (insn)
770 +       is null.
771 +
772 +2007-05-20  Kaz Kojima  <kkojima@gcc.gnu.org>
773 +
774 +       PR target/31022
775 +       Backport from mainline.
776 +       * config/sh/sh.c (sh_adjust_cost): Use the result of single_set
777 +       instead of PATTERN.
778 +
779 +2007-05-20  Kaz Kojima  <kkojima@gcc.gnu.org>
780 +
781 +       PR target/27405
782 +       Backport from mainline.
783 +       * config/sh/sh.md (cmp{eq,gt,gtu}{si,di}_media): Remove.
784 +       (cmpsi{eq,gt,gtu}{si,di}_media): Rename to
785 +       cmp{eq,gt,gtu}{si,di}_media.
786 +       (*cmpne0si_media): Remove.
787 +       (*movsicc_umin): Adjust gen_cmp*_media call.
788 +       (unordered): Change the mode of unordered and operands[1] to
789 +       SImode.
790 +       (seq): Adjust gen_cmp*_media calls.  Make the mode of
791 +       a temporary result of compare SImode if needed.  If the mode
792 +       of operands[0] is DImode, extend the temporary result to DImode.
793 +       (slt, sle, sgt, sge, sgtu, sltu, sleu, sgue, sne): Likewise.
794 +       (sunorderd): Change the mode of match_operand and unorderd to
795 +       SImode.
796 +       (cmpeq{sf,df}_media): Remove.
797 +       (cmpsieq{sf,df}_media): Rename to cmpeq{sf,df}_media.
798 +       (cmp{gt,ge,un}{sf,df}_media): Change the mode of match_operand
799 +       and compare operation to SImode.
800 +
801 +2007-05-18  Joseph Myers  <joseph@codesourcery.com>
802 +
803 +       * config/soft-fp/double.h, config/soft-fp/extended.h,
804 +       config/soft-fp/floatundidf.c, config/soft-fp/floatundisf.c,
805 +       config/soft-fp/floatunsidf.c, config/soft-fp/floatunsisf.c,
806 +       config/soft-fp/op-2.h, config/soft-fp/op-4.h,
807 +       config/soft-fp/op-common.h, config/soft-fp/quad.h: Update from
808 +       glibc CVS.
809 +
810 +2007-05-17  Ian Lance Taylor  <iant@google.com>
811 +
812 +       PR tree-optimization/31953
813 +       * tree-vrp.c (set_value_range_to_value): Add equiv parameter.
814 +       Change all callers.
815 +       (set_value_range_to_null): Call set_value_range_to_value.
816 +       (extract_range_from_comparison): Likewise.
817 +
818 +2007-05-17  Eric Botcazou  <ebotcazou@libertysurf.fr>
819 +
820 +       PR rtl-optimization/31691
821 +       * combine.c (simplify_set): Build a new src pattern instead of
822 +       substituting its operands in the COMPARE case.
823 +
824 +2007-05-14  Mark Mitchell  <mark@codesourcery.com>
825 +
826 +       * BASE-VER: Set to 4.2.1.
827 +       * DEV-PHASE: Set to prerelease.
828 +
829  2007-05-13  Release Manager
830  
831         * GCC 4.2.0 released.
832 @@ -307,7 +505,8 @@
833  2007-04-03  Stuart Hastings  <stuart@apple.com>
834  
835         PR 31281
836 -       * objc/objc-act.c (next_sjlj_build_catch_list): Delete volatile from rethrow decl.
837 +       * objc/objc-act.c (next_sjlj_build_catch_list): Delete volatile
838 +       from rethrow decl.
839         * cse.c (record_jump_equiv): Bail out on CCmode comparisons.
840  
841  2007-04-03  Jakub Jelinek  <jakub@redhat.com>
842 Index: gcc/testsuite/gcc.c-torture/execute/vrp-7.c
843 ===================================================================
844 --- gcc/testsuite/gcc.c-torture/execute/vrp-7.c (.../tags/gcc_4_2_0_release)    (wersja 0)
845 +++ gcc/testsuite/gcc.c-torture/execute/vrp-7.c (.../branches/gcc-4_2-branch)   (wersja 125589)
846 @@ -0,0 +1,20 @@
847 +
848 +void abort (void);
849 +
850 +struct T
851 +{
852 +  int b : 1;
853 +} t;
854 +
855 +void __attribute__((noinline)) foo (int f)
856 +{
857 +  t.b = (f & 0x10) ? 1 : 0;
858 +}
859 +
860 +int main (void)
861 +{
862 +  foo (0x10);
863 +  if (!t.b)
864 +    abort ();
865 +  return 0;
866 +}
867 Index: gcc/testsuite/gcc.c-torture/execute/20070517-1.c
868 ===================================================================
869 --- gcc/testsuite/gcc.c-torture/execute/20070517-1.c    (.../tags/gcc_4_2_0_release)    (wersja 0)
870 +++ gcc/testsuite/gcc.c-torture/execute/20070517-1.c    (.../branches/gcc-4_2-branch)   (wersja 125589)
871 @@ -0,0 +1,41 @@
872 +/* PR rtl-optimization/31691 */
873 +/* Origin: Chi-Hua Chen <stephaniechc-gccbug@yahoo.com> */
874 +
875 +extern void abort (void);
876 +
877 +static int get_kind(int) __attribute__ ((noinline));
878 +
879 +static int get_kind(int v)
880 +{
881 +  volatile int k = v;
882 +  return k;
883 +}
884 +
885 +static int some_call(void) __attribute__ ((noinline));
886 +
887 +static int some_call(void)
888 +{
889 +  return 0;
890 +}
891 +
892 +static void example (int arg)
893 +{
894 +  int tmp, kind = get_kind (arg);
895 +
896 +  if (kind == 9 || kind == 10 || kind == 5)
897 +    {
898 +      if (some_call() == 0)
899 +        {
900 +          if (kind == 9 || kind == 10)
901 +            tmp = arg;
902 +          else
903 +            abort();
904 +        }
905 +    }
906 +} 
907 +
908 +int main(void)
909 +{
910 +  example(10);
911 +  return 0;
912 +}
913 Index: gcc/testsuite/gcc.c-torture/compile/pr31953.c
914 ===================================================================
915 --- gcc/testsuite/gcc.c-torture/compile/pr31953.c       (.../tags/gcc_4_2_0_release)    (wersja 0)
916 +++ gcc/testsuite/gcc.c-torture/compile/pr31953.c       (.../branches/gcc-4_2-branch)   (wersja 125589)
917 @@ -0,0 +1,14 @@
918 +struct WView
919 +{
920 +  int hexedit_mode:1;
921 +};
922 +toggle_hexedit_mode (struct WView *view)
923 +{
924 +  if (view->hexedit_mode)
925 +    {
926 +    }
927 +  else
928 +    {
929 +      view->hexedit_mode = !view->hexedit_mode;
930 +    }
931 +}
932 Index: gcc/testsuite/gcc.target/i386/sse2-vec-3.c
933 ===================================================================
934 --- gcc/testsuite/gcc.target/i386/sse2-vec-3.c  (.../tags/gcc_4_2_0_release)    (wersja 0)
935 +++ gcc/testsuite/gcc.target/i386/sse2-vec-3.c  (.../branches/gcc-4_2-branch)   (wersja 125589)
936 @@ -0,0 +1,37 @@
937 +/* { dg-do run { target i?86-*-* x86_64-*-* } } */
938 +/* { dg-options "-O2 -msse2" } */
939 +
940 +#include "sse2-check.h"
941 +
942 +#include <emmintrin.h>
943 +
944 +static void
945 +sse2_test (void)
946 +{
947 +  union
948 +    {
949 +      __m128i x;
950 +      char c[16];
951 +      short s[8];
952 +      int i[4];
953 +      long long ll[2];
954 +    } val1;
955 +  int res[4];
956 +  int masks[4];
957 +  int i;
958 +
959 +  for (i = 0; i < 16; i++)
960 +    val1.c[i] = i;
961 +
962 +  res[0] = __builtin_ia32_vec_ext_v4si ((__v4si)val1.x, 0);
963 +  res[1] = __builtin_ia32_vec_ext_v4si ((__v4si)val1.x, 1);
964 +  res[2] = __builtin_ia32_vec_ext_v4si ((__v4si)val1.x, 2);
965 +  res[3] = __builtin_ia32_vec_ext_v4si ((__v4si)val1.x, 3);
966 +
967 +  for (i = 0; i < 4; i++)
968 +    masks[i] = i;
969 +
970 +  for (i = 0; i < 4; i++)
971 +    if (res[i] != val1.i [masks[i]])
972 +      abort ();
973 +}
974 Index: gcc/testsuite/gcc.target/i386/pr31167.c
975 ===================================================================
976 --- gcc/testsuite/gcc.target/i386/pr31167.c     (.../tags/gcc_4_2_0_release)    (wersja 0)
977 +++ gcc/testsuite/gcc.target/i386/pr31167.c     (.../branches/gcc-4_2-branch)   (wersja 125589)
978 @@ -0,0 +1,20 @@
979 +/* { dg-do compile { target x86_64-*-* } } */
980 +/* { dg-options "-O" } */
981 +
982 +typedef int int32_t;
983 +
984 +int32_t round32hi (const __int128_t arg)
985 +{
986 +  const int SHIFT = 96;
987 +  const int mshift = 96;
988 +  const __int128_t M = (~(__int128_t) 0) << mshift;
989 +  const __int128_t L = (~M) + 1;
990 +  const __int128_t L1 = ((__int128_t) L) >> 1;
991 +  const __int128_t Mlo = ((__int128_t) (~M)) >> 1;
992 +  __int128_t vv = arg & M;
993 +
994 +  if ((arg & (L1)) && ((arg & Mlo) || (arg & L)))
995 +    vv += L;
996 +
997 +  return (int32_t) (vv >> SHIFT);
998 +}
999 Index: gcc/testsuite/gcc.target/i386/sse2-vec-4.c
1000 ===================================================================
1001 --- gcc/testsuite/gcc.target/i386/sse2-vec-4.c  (.../tags/gcc_4_2_0_release)    (wersja 0)
1002 +++ gcc/testsuite/gcc.target/i386/sse2-vec-4.c  (.../branches/gcc-4_2-branch)   (wersja 125589)
1003 @@ -0,0 +1,41 @@
1004 +/* { dg-do run { target i?86-*-* x86_64-*-* } } */
1005 +/* { dg-options "-O2 -msse2" } */
1006 +
1007 +#include "sse2-check.h"
1008 +
1009 +#include <emmintrin.h>
1010 +
1011 +static void
1012 +sse2_test (void)
1013 +{
1014 +  union
1015 +    {
1016 +      __m128i x;
1017 +      char c[16];
1018 +      short s[8];
1019 +      int i[4];
1020 +      long long ll[2];
1021 +    } val1;
1022 +  short res[8];
1023 +  int masks[8];
1024 +  int i;
1025 +
1026 +  for (i = 0; i < 16; i++)
1027 +    val1.c[i] = i;
1028 +
1029 +  res[0] = __builtin_ia32_vec_ext_v8hi ((__v8hi)val1.x, 0);
1030 +  res[1] = __builtin_ia32_vec_ext_v8hi ((__v8hi)val1.x, 1);
1031 +  res[2] = __builtin_ia32_vec_ext_v8hi ((__v8hi)val1.x, 2);
1032 +  res[3] = __builtin_ia32_vec_ext_v8hi ((__v8hi)val1.x, 3);
1033 +  res[4] = __builtin_ia32_vec_ext_v8hi ((__v8hi)val1.x, 4);
1034 +  res[5] = __builtin_ia32_vec_ext_v8hi ((__v8hi)val1.x, 5);
1035 +  res[6] = __builtin_ia32_vec_ext_v8hi ((__v8hi)val1.x, 6);
1036 +  res[7] = __builtin_ia32_vec_ext_v8hi ((__v8hi)val1.x, 7);
1037 +
1038 +  for (i = 0; i < 8; i++)
1039 +    masks[i] = i;
1040 +
1041 +  for (i = 0; i < 8; i++)
1042 +    if (res[i] != val1.s [masks[i]])
1043 +      abort ();
1044 +}
1045 Index: gcc/testsuite/gcc.target/i386/sse2-check.h
1046 ===================================================================
1047 --- gcc/testsuite/gcc.target/i386/sse2-check.h  (.../tags/gcc_4_2_0_release)    (wersja 0)
1048 +++ gcc/testsuite/gcc.target/i386/sse2-check.h  (.../branches/gcc-4_2-branch)   (wersja 125589)
1049 @@ -0,0 +1,20 @@
1050 +#include <stdio.h>
1051 +#include <stdlib.h>
1052 +
1053 +#include "../../gcc.dg/i386-cpuid.h"
1054 +
1055 +static void sse2_test (void);
1056 +
1057 +int
1058 +main ()
1059 +{
1060 +  unsigned long cpu_facilities;
1061
1062 +  cpu_facilities = i386_cpuid_edx ();
1063 +
1064 +  /* Run SSE2 test only if host has SSE2 support.  */
1065 +  if ((cpu_facilities & bit_SSE2))
1066 +    sse2_test ();
1067 +
1068 +  exit (0);
1069 +}
1070 Index: gcc/testsuite/gcc.target/i386/sse2-vec-1.c
1071 ===================================================================
1072 --- gcc/testsuite/gcc.target/i386/sse2-vec-1.c  (.../tags/gcc_4_2_0_release)    (wersja 0)
1073 +++ gcc/testsuite/gcc.target/i386/sse2-vec-1.c  (.../branches/gcc-4_2-branch)   (wersja 125589)
1074 @@ -0,0 +1,35 @@
1075 +/* { dg-do run { target i?86-*-* x86_64-*-* } } */
1076 +/* { dg-options "-O2 -msse2" } */
1077 +
1078 +#include "sse2-check.h"
1079 +
1080 +#include <emmintrin.h>
1081 +
1082 +#define msk0   0
1083 +#define msk1   1
1084 +
1085 +static void
1086 +sse2_test (void)
1087 +{
1088 +  union
1089 +    {
1090 +      __m128d x;
1091 +      double d[2];
1092 +    } val1;
1093 +  double res[2];
1094 +  int masks[2];
1095 +  int i;
1096 +
1097 +  val1.d[0] = 23.;
1098 +  val1.d[1] = 45;
1099 +
1100 +  res[0] = __builtin_ia32_vec_ext_v2df ((__v2df)val1.x, msk0);
1101 +  res[1] = __builtin_ia32_vec_ext_v2df ((__v2df)val1.x, msk1);
1102 +
1103 +  masks[0] = msk0;
1104 +  masks[1] = msk1;
1105 +
1106 +  for (i = 0; i < 2; i++)
1107 +    if (res[i] != val1.d [masks[i]])
1108 +      abort ();
1109 +}
1110 Index: gcc/testsuite/gcc.target/i386/sse2-vec-5.c
1111 ===================================================================
1112 --- gcc/testsuite/gcc.target/i386/sse2-vec-5.c  (.../tags/gcc_4_2_0_release)    (wersja 0)
1113 +++ gcc/testsuite/gcc.target/i386/sse2-vec-5.c  (.../branches/gcc-4_2-branch)   (wersja 125589)
1114 @@ -0,0 +1,49 @@
1115 +/* { dg-do run { target i?86-*-* x86_64-*-* } } */
1116 +/* { dg-options "-O2 -msse2" } */
1117 +
1118 +#include "sse2-check.h"
1119 +
1120 +#include <emmintrin.h>
1121 +
1122 +static void
1123 +sse2_test (void)
1124 +{
1125 +  union
1126 +    {
1127 +      __m128i x;
1128 +      char c[16];
1129 +      short s[8];
1130 +      int i[4];
1131 +      long long ll[2];
1132 +    } val1;
1133 +  char res[16];
1134 +  int masks[16];
1135 +  int i;
1136 +
1137 +  for (i = 0; i < 16; i++)
1138 +    val1.c[i] = i;
1139 +
1140 +  res[0] = __builtin_ia32_vec_ext_v16qi ((__v16qi)val1.x, 0);
1141 +  res[1] = __builtin_ia32_vec_ext_v16qi ((__v16qi)val1.x, 1);
1142 +  res[2] = __builtin_ia32_vec_ext_v16qi ((__v16qi)val1.x, 2);
1143 +  res[3] = __builtin_ia32_vec_ext_v16qi ((__v16qi)val1.x, 3);
1144 +  res[4] = __builtin_ia32_vec_ext_v16qi ((__v16qi)val1.x, 4);
1145 +  res[5] = __builtin_ia32_vec_ext_v16qi ((__v16qi)val1.x, 5);
1146 +  res[6] = __builtin_ia32_vec_ext_v16qi ((__v16qi)val1.x, 6);
1147 +  res[7] = __builtin_ia32_vec_ext_v16qi ((__v16qi)val1.x, 7);
1148 +  res[8] = __builtin_ia32_vec_ext_v16qi ((__v16qi)val1.x, 8);
1149 +  res[9] = __builtin_ia32_vec_ext_v16qi ((__v16qi)val1.x, 9);
1150 +  res[10] = __builtin_ia32_vec_ext_v16qi ((__v16qi)val1.x, 10);
1151 +  res[11] = __builtin_ia32_vec_ext_v16qi ((__v16qi)val1.x, 11);
1152 +  res[12] = __builtin_ia32_vec_ext_v16qi ((__v16qi)val1.x, 12);
1153 +  res[13] = __builtin_ia32_vec_ext_v16qi ((__v16qi)val1.x, 13);
1154 +  res[14] = __builtin_ia32_vec_ext_v16qi ((__v16qi)val1.x, 14);
1155 +  res[15] = __builtin_ia32_vec_ext_v16qi ((__v16qi)val1.x, 15);
1156 +
1157 +  for (i = 0; i < 16; i++)
1158 +    masks[i] = i;
1159 +
1160 +  for (i = 0; i < 16; i++)
1161 +    if (res[i] != val1.c [masks[i]])
1162 +      abort ();
1163 +}
1164 Index: gcc/testsuite/gcc.target/i386/sse2-vec-2.c
1165 ===================================================================
1166 --- gcc/testsuite/gcc.target/i386/sse2-vec-2.c  (.../tags/gcc_4_2_0_release)    (wersja 0)
1167 +++ gcc/testsuite/gcc.target/i386/sse2-vec-2.c  (.../branches/gcc-4_2-branch)   (wersja 125589)
1168 @@ -0,0 +1,35 @@
1169 +/* { dg-do run { target i?86-*-* x86_64-*-* } } */
1170 +/* { dg-options "-O2 -msse2" } */
1171 +
1172 +#include "sse2-check.h"
1173 +
1174 +#include <emmintrin.h>
1175 +
1176 +static void
1177 +sse2_test (void)
1178 +{
1179 +  union
1180 +    {
1181 +      __m128i x;
1182 +      char c[16];
1183 +      short s[8];
1184 +      int i[4];
1185 +      long long ll[2];
1186 +    } val1;
1187 +  long long res[2];
1188 +  int masks[2];
1189 +  int i;
1190 +
1191 +  for (i = 0; i < 16; i++)
1192 +    val1.c[i] = i;
1193 +
1194 +  res[0] = __builtin_ia32_vec_ext_v2di ((__v2di)val1.x, 0);
1195 +  res[1] = __builtin_ia32_vec_ext_v2di ((__v2di)val1.x, 1);
1196 +
1197 +  for (i = 0; i < 2; i++)
1198 +    masks[i] = i;
1199 +
1200 +  for (i = 0; i < 2; i++)
1201 +    if (res[i] != val1.ll [masks[i]])
1202 +      abort ();
1203 +}
1204 Index: gcc/testsuite/gcc.target/i386/sse2-vec-6.c
1205 ===================================================================
1206 --- gcc/testsuite/gcc.target/i386/sse2-vec-6.c  (.../tags/gcc_4_2_0_release)    (wersja 0)
1207 +++ gcc/testsuite/gcc.target/i386/sse2-vec-6.c  (.../branches/gcc-4_2-branch)   (wersja 125589)
1208 @@ -0,0 +1,69 @@
1209 +/* { dg-do run { target i?86-*-* x86_64-*-* } } */
1210 +/* { dg-options "-O2 -msse2" } */
1211 +
1212 +#include "sse2-check.h"
1213 +
1214 +#include <emmintrin.h>
1215 +#include <string.h>
1216 +
1217 +static void
1218 +sse2_test (void)
1219 +{
1220 +  union
1221 +    {
1222 +      __m128i x;
1223 +      char c[16];
1224 +      short s[8];
1225 +      int i[4];
1226 +      long long ll[2];
1227 +    } val1, res[16], tmp;
1228 +  short ins[8] = { 8, 5, 9, 4, 2, 6, 1, 20 };
1229 +  int masks[8];
1230 +  int i;
1231 +
1232 +  for (i = 0; i < 16; i++)
1233 +    val1.c[i] = i;
1234 +
1235 +  res[0].x = (__m128i) __builtin_ia32_vec_set_v8hi ((__v8hi)val1.x,
1236 +                                                   ins[0], 0);
1237 +  res[1].x = (__m128i) __builtin_ia32_vec_set_v8hi ((__v8hi)val1.x,
1238 +                                                   ins[0], 1);
1239 +  res[2].x = (__m128i) __builtin_ia32_vec_set_v8hi ((__v8hi)val1.x,
1240 +                                                   ins[0], 2);
1241 +  res[3].x = (__m128i) __builtin_ia32_vec_set_v8hi ((__v8hi)val1.x,
1242 +                                                   ins[0], 3);
1243 +  res[4].x = (__m128i) __builtin_ia32_vec_set_v8hi ((__v8hi)val1.x,
1244 +                                                   ins[0], 4);
1245 +  res[5].x = (__m128i) __builtin_ia32_vec_set_v8hi ((__v8hi)val1.x,
1246 +                                                   ins[0], 5);
1247 +  res[6].x = (__m128i) __builtin_ia32_vec_set_v8hi ((__v8hi)val1.x,
1248 +                                                   ins[0], 6);
1249 +  res[7].x = (__m128i) __builtin_ia32_vec_set_v8hi ((__v8hi)val1.x,
1250 +                                                   ins[0], 7);
1251 +
1252 +  for (i = 0; i < 8; i++)
1253 +    masks[i] = i;
1254 +
1255 +  for (i = 0; i < 8; i++)
1256 +    {
1257 +      tmp.x = val1.x;
1258 +      tmp.s[masks[i]] = ins[0];
1259 +      if (memcmp (&tmp, &res[i], sizeof (tmp)))
1260 +       abort ();
1261 +    }
1262 +
1263 +  for (i = 0; i < 8; i++)
1264 +    {
1265 +      res[i].x = (__m128i) __builtin_ia32_vec_set_v8hi ((__v8hi)val1.x,
1266 +                                                       ins[i], 0);
1267 +      masks[i] = 0;
1268 +    }
1269 +
1270 +  for (i = 0; i < 8; i++)
1271 +    {
1272 +      tmp.x = val1.x;
1273 +      tmp.s[masks[i]] = ins[i];
1274 +      if (memcmp (&tmp, &res[i], sizeof (tmp)))
1275 +       abort ();
1276 +    }
1277 +}
1278 Index: gcc/testsuite/gcc.dg/Wstrict-overflow-18.c
1279 ===================================================================
1280 --- gcc/testsuite/gcc.dg/Wstrict-overflow-18.c  (.../tags/gcc_4_2_0_release)    (wersja 0)
1281 +++ gcc/testsuite/gcc.dg/Wstrict-overflow-18.c  (.../branches/gcc-4_2-branch)   (wersja 125589)
1282 @@ -0,0 +1,22 @@
1283 +/* { dg-do compile } */
1284 +/* { dg-options "-fstrict-overflow -O2 -Wstrict-overflow" } */
1285 +
1286 +/* Don't warn about an overflow when folding i > 0.  The loop analysis
1287 +   should determine that i does not wrap.  */
1288 +
1289 +struct c { unsigned int a; unsigned int b; };
1290 +extern void bar (struct c *);
1291 +int
1292 +foo (struct c *p)
1293 +{
1294 +  int i;
1295 +  int sum = 0;
1296 +
1297 +  for (i = 0; i < p->a - p->b; ++i)
1298 +    {
1299 +      if (i > 0)
1300 +       sum += 2;
1301 +      bar (p);
1302 +    }
1303 +  return sum;
1304 +}
1305 Index: gcc/testsuite/gcc.dg/Wstrict-overflow-19.c
1306 ===================================================================
1307 --- gcc/testsuite/gcc.dg/Wstrict-overflow-19.c  (.../tags/gcc_4_2_0_release)    (wersja 0)
1308 +++ gcc/testsuite/gcc.dg/Wstrict-overflow-19.c  (.../branches/gcc-4_2-branch)   (wersja 125589)
1309 @@ -0,0 +1,15 @@
1310 +/* { dg-do compile } */
1311 +/* { dg-options "-fstrict-overflow -O2 -Wstrict-overflow" } */
1312 +
1313 +/* Don't warn about an overflow when threading jumps.  We used to get
1314 +   a warning from comparing bounds generated by VRP.  */
1315 +
1316 +int
1317 +bar(int a, int b, int n)
1318 +{
1319 +  if (b > a)
1320 +    n = a - b;
1321 +  if (a >= b)
1322 +    n = 1;
1323 +  return n;
1324 +}
1325 Index: gcc/testsuite/ChangeLog
1326 ===================================================================
1327 --- gcc/testsuite/ChangeLog     (.../tags/gcc_4_2_0_release)    (wersja 125589)
1328 +++ gcc/testsuite/ChangeLog     (.../branches/gcc-4_2-branch)   (wersja 125589)
1329 @@ -1,3 +1,124 @@
1330 +2007-06-08  Dirk Mueller  <dmueller@suse.de>
1331 +
1332 +       PR c++/31809
1333 +       Backport from mainline:
1334 +       2007-05-30  Jakub Jelinek  <jakub@redhat.com>
1335 +
1336 +       * g++.dg/opt/static5.C: New test.
1337 +
1338 +2007-06-06  Ian Lance Taylor  <iant@google.com>
1339 +
1340 +       * g++.dg/conversion/enum1.C: New test.
1341 +
1342 +2007-06-05  Ian Lance Taylor  <iant@google.com>
1343 +
1344 +       * gcc.dg/Wstrict-overflow-19.c: New test.
1345 +
1346 +2007-06-04  Ian Lance Taylor  <iant@google.com>
1347 +
1348 +       * gcc.dg/Wstrict-overflow-18.c: New test.
1349 +
1350 +2007-05-31  H.J. Lu  <hongjiu.lu@intel.com>
1351 +
1352 +       Backport from mainline:
1353 +       2007-05-25  H.J. Lu  <hongjiu.lu@intel.com>
1354 +
1355 +       * gcc.target/i386/sse2-check.h: New.
1356 +       * gcc.target/i386/sse2-vec-1.c: Likewise.
1357 +       * gcc.target/i386/sse2-vec-2.c: Likewise.
1358 +       * gcc.target/i386/sse2-vec-3.c: Likewise.
1359 +       * gcc.target/i386/sse2-vec-4.c: Likewise.
1360 +       * gcc.target/i386/sse2-vec-5.c: Likewise.
1361 +       * gcc.target/i386/sse2-vec-6.c: Likewise.
1362 +
1363 +2007-05-31  Paul Thomas  <pault@gcc.gnu.org>
1364 +
1365 +       PR fortran/31483
1366 +       * gfortran.dg/altreturn_5.f90: New test.
1367 +
1368 +       PR fortran/31540
1369 +       * gfortran.dg/char_result_5.f90: New test.
1370 +
1371 +       PR fortran/31867
1372 +       * gfortran.dg/char_length_5.f90: New test.
1373 +
1374 +       PR fortran/31994
1375 +       * gfortran.dg/array_reference_1.f90: New test.
1376 +
1377 +2007-05-22  Tobias Burnus  <burnus@net-b.de>
1378 +
1379 +       PR fortran/31559
1380 +       Backport from mainline.
1381 +       * primary.c (match_variable): External functions
1382 +       are no variables.
1383 +
1384 +2007-05-30  Jakub Jelinek  <jakub@redhat.com>
1385 +
1386 +       PR tree-optimization/31769
1387 +       * g++.dg/gomp/pr31769.C: New test.
1388 +
1389 +2007-05-28  Andrew Pinski  <andrew_pinski@playstation.sony.com>
1390 +
1391 +       PR tree-opt/32100
1392 +       * gcc.c-torture/execute/vrp-7.c: New test.
1393 +        
1394 +2007-05-23  Jerry DeLisle  <jvdelisle@gcc.gnu.org>
1395 +
1396 +       PR libfortran/31964
1397 +       * gfortran.fortran-torture/execute/intrinsic_bitops.f90: Update.
1398 +
1399 +2007-05-22  Jerry DeLisle  <jvdelisle@gcc.gnu.org>
1400 +
1401 +       PR libgfortran/31051
1402 +       * gfortran.dg/fmt_t_3.f90: New.
1403 +
1404 +2007-05-22  Dominique d'Humieres  <dominiq@lps.ens.fr>
1405 +
1406 +       * gfortran.dg/unf_io_convert_3.f90: Fix dg directive.
1407 +
1408 +2007-05-22  Tobias Burnus  <burnus@net-b.de>
1409 +
1410 +       PR fortran/31559
1411 +       Backport from mainline.
1412 +       * func_assign.f90: New test.
1413 +
1414 +2007-05-21  Uros Bizjak  <ubizjak@gmail.com>
1415 +
1416 +       PR target/31167
1417 +       Backport from mainline.
1418 +       * gcc.target/i386/pr31167.c: New test.
1419 +
1420 +2007-05-20  Jerry DeLisle  <jvdelisle@gcc.gnu.org>
1421 +
1422 +       PR libgfortran/31395
1423 +       * gfortran.dg/fmt_colon.f90: New test.
1424 +
1425 +2007-05-20  Thomas Koenig  <tkoenig@gcc.gnu.org>
1426 +
1427 +       PR fortran/31618
1428 +       Backport from trunk.
1429 +       * gfortran.dg/backspace_8.f:  New test case.
1430 +
1431 +2007-05-20  Thomas Koenig  <tkoenig@gcc.gnu.org>
1432 +
1433 +       PR libfortran/31196
1434 +       Backport from trunk.
1435 +       * gfortran.dg/reshape_transpose_1.f90:  New test.
1436 +
1437 +2007-05-17  Ian Lance Taylor  <iant@google.com>
1438 +
1439 +       PR tree-optimization/31953
1440 +       * gcc.c-torture/compile/pr31953.c: New test.
1441 +
1442 +2007-05-17  Eric Botcazou  <ebotcazou@libertysurf.fr>
1443 +
1444 +       * gcc.c-torture/execute/20070517-1.c: New test.
1445 +
1446 +2007-05-16  Francois-Xavier Coudert  <fxcoudert@gcc.gnu.org>
1447 +
1448 +       PR fortran/31725
1449 +       * gfortran.dg/substr_4.f: New test.
1450 +
1451  2007-05-13  Release Manager
1452  
1453         * GCC 4.2.0 released.
1454 Index: gcc/testsuite/gfortran.fortran-torture/execute/intrinsic_bitops.f90
1455 ===================================================================
1456 --- gcc/testsuite/gfortran.fortran-torture/execute/intrinsic_bitops.f90 (.../tags/gcc_4_2_0_release)    (wersja 125589)
1457 +++ gcc/testsuite/gfortran.fortran-torture/execute/intrinsic_bitops.f90 (.../branches/gcc-4_2-branch)   (wersja 125589)
1458 @@ -8,7 +8,8 @@
1459     i = 2
1460     j = 3
1461     k = 12
1462 -
1463 +   a = 5
1464 +   
1465     if (.not. btest (i, o+1)) call abort
1466     if (btest (i, o+2)) call abort
1467     if (iand (i, j) .ne. 2) call abort
1468 @@ -26,4 +27,6 @@
1469     if (ishftc (k, o-30) .ne. 48) call abort
1470     if (ishftc (k, o+1, o+3) .ne. 9) call abort
1471     if (not (i) .ne. -3) call abort
1472 +   if (ishftc (a, 1, bit_size(a)) .ne. 10) call abort
1473 +   if (ishftc (1, 1, 32) .ne. 2) call abort
1474  end program
1475 Index: gcc/testsuite/g++.dg/conversion/enum1.C
1476 ===================================================================
1477 --- gcc/testsuite/g++.dg/conversion/enum1.C     (.../tags/gcc_4_2_0_release)    (wersja 0)
1478 +++ gcc/testsuite/g++.dg/conversion/enum1.C     (.../branches/gcc-4_2-branch)   (wersja 125589)
1479 @@ -0,0 +1,10 @@
1480 +// { dg-do run }
1481 +// { dg-options "-O2 -finline-functions" }
1482 +
1483 +enum E { V = 1 };
1484 +static const E E_MIN = V;
1485 +static const E E_MAX = V;
1486 +
1487 +bool valid(E v) { return v >= E_MIN && v <= E_MAX; }
1488 +
1489 +int main() { return valid(E(2)); }
1490 Index: gcc/testsuite/g++.dg/gomp/pr31769.C
1491 ===================================================================
1492 --- gcc/testsuite/g++.dg/gomp/pr31769.C (.../tags/gcc_4_2_0_release)    (wersja 0)
1493 +++ gcc/testsuite/g++.dg/gomp/pr31769.C (.../branches/gcc-4_2-branch)   (wersja 125589)
1494 @@ -0,0 +1,61 @@
1495 +// PR tree-optimization/31769
1496 +// { dg-options "-O2 -fopenmp" }
1497 +// { dg-do compile }
1498 +
1499 +struct B
1500 +{
1501 +  B () {}
1502 +  virtual ~B () {}
1503 +};
1504 +struct C
1505 +{
1506 +  C (int x, int y) {}
1507 +};
1508 +template<typename T, int U>
1509 +struct D
1510 +{
1511 +  D () {}
1512 +  ~D () {}
1513 +};
1514 +struct E
1515 +{
1516 +  E () {}
1517 +  ~E () {}
1518 +  D<int, 1> e;
1519 +};
1520 +struct A
1521 +{
1522 +  B *b;
1523 +  A () { b = __null; }
1524 +  ~A () { if (b != __null) delete b; }
1525 +};
1526 +struct F : public A
1527 +{
1528 +  explicit F (int x) { foo (0); }
1529 +  F (const F &x) {}
1530 +  F (F &x, C y) {}
1531 +  F operator () (C x) const
1532 +  {
1533 +    return F (const_cast<F &>(*this), x);
1534 +  }
1535 +  template <typename U> F & operator+= (const U &);
1536 +  void foo (int);
1537 +  E f;
1538 +};
1539 +
1540 +int
1541 +main ()
1542 +{
1543 +  try
1544 +  {
1545 +    F f (10);
1546 +    F g (10);
1547 +    C h (0, 9);
1548 +#pragma omp parallel for
1549 +    for (int i = 0; i < 2; ++i)
1550 +      g += f (h);
1551 +  }
1552 +  catch (int &e)
1553 +  {
1554 +  }
1555 +}
1556 Index: gcc/testsuite/g++.dg/opt/static5.C
1557 ===================================================================
1558 --- gcc/testsuite/g++.dg/opt/static5.C  (.../tags/gcc_4_2_0_release)    (wersja 0)
1559 +++ gcc/testsuite/g++.dg/opt/static5.C  (.../branches/gcc-4_2-branch)   (wersja 125589)
1560 @@ -0,0 +1,29 @@
1561 +// PR c++/31809
1562 +// { dg-do run }
1563 +// { dg-options "-O2" }
1564 +
1565 +struct S
1566 +{
1567 +  unsigned v;
1568 +  static inline S f (unsigned a);
1569 +};
1570 +
1571 +inline S
1572 +S::f (unsigned a)
1573 +{
1574 +  static S t = { a };
1575 +  return t;
1576 +}
1577 +
1578 +const static S s = S::f (26);
1579 +
1580 +extern "C" void abort (void);
1581 +
1582 +int
1583 +main ()
1584 +{
1585 +  S t = s;
1586 +  if (t.v != 26)
1587 +    abort ();
1588 +  return 0;
1589 +}
1590 Index: gcc/testsuite/gfortran.dg/char_length_5.f90
1591 ===================================================================
1592 --- gcc/testsuite/gfortran.dg/char_length_5.f90 (.../tags/gcc_4_2_0_release)    (wersja 0)
1593 +++ gcc/testsuite/gfortran.dg/char_length_5.f90 (.../branches/gcc-4_2-branch)   (wersja 125589)
1594 @@ -0,0 +1,61 @@
1595 +! { dg-do run }
1596 +! Tests the fix for PR31867, in which the interface evaluation
1597 +! of the character length of 'join' (ie. the length available in
1598 +! the caller) was wrong.
1599 +!
1600 +! Contributed by <beliavsky@aol.com> 
1601 +!
1602 +module util_mod
1603 +  implicit none
1604 +contains
1605 +  function join (words, sep) result(str)
1606 +    character (len=*), intent(in)        :: words(:),sep
1607 +    character (len = (size (words) - 1) * len_trim (sep) + & 
1608 +               sum (len_trim (words)))   :: str
1609 +    integer                              :: i,nw
1610 +    nw  = size (words)
1611 +    str = ""
1612 +    if (nw < 1) then
1613 +      return
1614 +    else
1615 +      str = words(1)
1616 +    end if
1617 +    do i=2,nw
1618 +      str = trim (str) // trim (sep) // words(i)
1619 +    end do
1620 +  end function join
1621 +end module util_mod
1622 +!
1623 +program xjoin
1624 +  use util_mod, only: join
1625 +  implicit none
1626 +  integer yy
1627 +  character (len=5) :: words(5:8) = (/"two  ","three","four ","five "/), sep = "^#^"
1628 +  character (len=5) :: words2(4) = (/"bat  ","ball ","goal ","stump"/), sep2 = "&"
1629 +
1630 +  if (join (words, sep) .ne. "two^#^three^#^four^#^five") call abort ()
1631 +  if (len (join (words, sep)) .ne. 25) call abort ()
1632 +
1633 +  if (join (words(5:6), sep) .ne. "two^#^three") call abort ()
1634 +  if (len (join (words(5:6), sep)) .ne. 11) call abort ()
1635 +
1636 +  if (join (words(7:8), sep) .ne. "four^#^five") call abort ()
1637 +  if (len (join (words(7:8), sep)) .ne. 11) call abort ()
1638 +
1639 +  if (join (words(5:7:2), sep) .ne. "two^#^four") call abort ()
1640 +  if (len (join (words(5:7:2), sep)) .ne. 10) call abort ()
1641 +
1642 +  if (join (words(6:8:2), sep) .ne. "three^#^five") call abort ()
1643 +  if (len (join (words(6:8:2), sep)) .ne. 12) call abort ()
1644 +
1645 +  if (join (words2, sep2) .ne. "bat&ball&goal&stump") call abort ()
1646 +  if (len (join (words2, sep2)) .ne. 19) call abort ()
1647 +
1648 +  if (join (words2(1:2), sep2) .ne. "bat&ball") call abort ()
1649 +  if (len (join (words2(1:2), sep2)) .ne. 8) call abort ()
1650 +
1651 +  if (join (words2(2:4:2), sep2) .ne. "ball&stump") call abort ()
1652 +  if (len (join (words2(2:4:2), sep2)) .ne. 10) call abort ()
1653 +
1654 +end program xjoin
1655 +! { dg-final { cleanup-modules "util_mod" } }
1656 Index: gcc/testsuite/gfortran.dg/array_reference_1.f90
1657 ===================================================================
1658 --- gcc/testsuite/gfortran.dg/array_reference_1.f90     (.../tags/gcc_4_2_0_release)    (wersja 0)
1659 +++ gcc/testsuite/gfortran.dg/array_reference_1.f90     (.../branches/gcc-4_2-branch)   (wersja 125589)
1660 @@ -0,0 +1,35 @@
1661 +! { dg-do run }
1662 +! Tests the fix for PR31994, aka 31867, in which the offset
1663 +! of 'a' in both subroutines was being evaluated incorrectly.
1664 +! The testcase for PR31867 is char_length_5.f90
1665 +!
1666 +! Contributed by Elizabeth Yip <elizabeth.l.yip@boeing.com>
1667 +!            and Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
1668 +!
1669 +program main
1670 +  call PR31994
1671 +  call PR31994_comment6
1672 +contains
1673 +  subroutine PR31994
1674 +    implicit none
1675 +    complex (kind=4), dimension(2,2) :: a, b, c
1676 +    a(1,1) = (1.,1.)
1677 +    a(2,1) = (2.,2.)
1678 +    a(1,2) = (3.,3.)
1679 +    a(2,2) = (4.,4.)
1680 +    b=conjg (transpose (a))
1681 +    c=transpose (a)
1682 +    c=conjg (c)
1683 +    if (any (b .ne. c)) call abort ()
1684 +  end subroutine PR31994
1685 +  subroutine PR31994_comment6
1686 +    implicit none
1687 +    real ,dimension(2,2)::a
1688 +    integer ,dimension(2,2) :: b, c
1689 +    a = reshape ((/1.,2.,3.,4./), (/2,2/))
1690 +    b=int (transpose(a))
1691 +    c = int (a)
1692 +    c = transpose (c)
1693 +    if (any (b .ne. c)) call abort ()
1694 +  end subroutine PR31994_comment6
1695 +END program main
1696 Index: gcc/testsuite/gfortran.dg/reshape_transpose_1.f90
1697 ===================================================================
1698 --- gcc/testsuite/gfortran.dg/reshape_transpose_1.f90   (.../tags/gcc_4_2_0_release)    (wersja 0)
1699 +++ gcc/testsuite/gfortran.dg/reshape_transpose_1.f90   (.../branches/gcc-4_2-branch)   (wersja 125589)
1700 @@ -0,0 +1,18 @@
1701 +! { dg-do run }
1702 +! PR 31196 - reshape of transposed derived types generated
1703 +!            wront results.
1704 +program main
1705 +  implicit none
1706 +  TYPE datatype
1707 +     INTEGER :: I
1708 +  END TYPE datatype
1709 +  character (len=20) line1, line2
1710 +  TYPE(datatype), dimension(2,2) :: data, result
1711 +  data(1,1)%i = 1
1712 +  data(2,1)%i = 2
1713 +  data(1,2)%i = 3
1714 +  data(2,2)%i = 4
1715 +  write (unit=line1, fmt="(4I4)") reshape(transpose(data),shape(data))
1716 +  write (unit=line2, fmt="(4I4)") (/ 1, 3, 2, 4 /)
1717 +  if (line1 /= line2) call abort
1718 +END program main
1719 Index: gcc/testsuite/gfortran.dg/fmt_colon.f90
1720 ===================================================================
1721 --- gcc/testsuite/gfortran.dg/fmt_colon.f90     (.../tags/gcc_4_2_0_release)    (wersja 0)
1722 +++ gcc/testsuite/gfortran.dg/fmt_colon.f90     (.../branches/gcc-4_2-branch)   (wersja 125589)
1723 @@ -0,0 +1,14 @@
1724 +! { dg-do run }
1725 +! PR31395 Colon edit descriptor is ignored.
1726 +! Test case derived from PR. Prepared by Jerry DeLisle
1727 +! <jvdelisle@gcc.gnu.org>
1728 +PROGRAM test
1729 +    INTEGER :: i = 1
1730 +    character(30) :: astring
1731 +    WRITE(astring, 10) i
1732 + 10 FORMAT('i =',I2:' this should not print')
1733 +    if (astring.ne."i = 1") call abort
1734 +    write(astring, 20) i, i
1735 + 20 format('i =',I2:' this should print',I2)
1736 +    if (astring.ne."i = 1 this should print 1") call abort
1737 +END PROGRAM test
1738 \ brakuje znaku koÅ„ca linii na koÅ„cu pliku 
1739 Index: gcc/testsuite/gfortran.dg/char_result_13.f90
1740 ===================================================================
1741 --- gcc/testsuite/gfortran.dg/char_result_13.f90        (.../tags/gcc_4_2_0_release)    (wersja 0)
1742 +++ gcc/testsuite/gfortran.dg/char_result_13.f90        (.../branches/gcc-4_2-branch)   (wersja 125589)
1743 @@ -0,0 +1,13 @@
1744 +! { dg-do compile }
1745 +! tests the fix for PR31540, in which the character lengths in
1746 +! parentheses were not resolved.
1747 +!
1748 +! Contributed by Tobias Burnus <burnus@gcc.gnu.org>
1749 +!
1750 +        subroutine pfb()
1751 +        implicit none
1752 +        external pfname1, pfname2
1753 +        character ((136)) pfname1
1754 +        character ((129+7)) pfname2
1755 +        return
1756 +        end
1757 Index: gcc/testsuite/gfortran.dg/altreturn_5.f90
1758 ===================================================================
1759 --- gcc/testsuite/gfortran.dg/altreturn_5.f90   (.../tags/gcc_4_2_0_release)    (wersja 0)
1760 +++ gcc/testsuite/gfortran.dg/altreturn_5.f90   (.../branches/gcc-4_2-branch)   (wersja 125589)
1761 @@ -0,0 +1,30 @@
1762 +! { dg-do run }
1763 +! Tests the fix for PR31483, in which dummy argument procedures
1764 +! produced an ICE if they had an alternate return.
1765 +!
1766 +! Contributed by Mathias Fröhlich <M.Froehlich@science-computing.de>
1767 +
1768 +      SUBROUTINE R (i, *, *)
1769 +      INTEGER i
1770 +      RETURN i
1771 +      END
1772 +
1773 +      SUBROUTINE PHLOAD (READER, i, res)
1774 +      IMPLICIT NONE
1775 +      EXTERNAL         READER
1776 +      integer i
1777 +      character(3) res
1778 +      CALL READER (i, *1, *2)
1779 + 1    res = "one"
1780 +      return
1781 + 2    res = "two"
1782 +      return
1783 +      END
1784 +
1785 +      EXTERNAL R
1786 +      character(3) res
1787 +      call PHLOAD (R, 1, res)
1788 +      if (res .ne. "one") call abort ()
1789 +      CALL PHLOAD (R, 2, res)
1790 +      if (res .ne. "two") call abort ()
1791 +      END
1792 \ brakuje znaku koÅ„ca linii na koÅ„cu pliku 
1793 Index: gcc/testsuite/gfortran.dg/substr_4.f
1794 ===================================================================
1795 --- gcc/testsuite/gfortran.dg/substr_4.f        (.../tags/gcc_4_2_0_release)    (wersja 0)
1796 +++ gcc/testsuite/gfortran.dg/substr_4.f        (.../branches/gcc-4_2-branch)   (wersja 125589)
1797 @@ -0,0 +1,69 @@
1798 +! { dg-do run }
1799 +      subroutine test_lower
1800 +      implicit none
1801 +      character(3), dimension(3) :: zsymel,zsymelr
1802 +      common /xx/ zsymel, zsymelr
1803 +      integer :: znsymelr
1804 +      zsymel = (/ 'X', 'Y', ' ' /)
1805 +      zsymelr= (/ 'X', 'Y', ' ' /)
1806 +      znsymelr=2
1807 +      call check_zsymel(zsymel,zsymelr,znsymelr)
1808 +
1809 +      contains
1810 +
1811 +      subroutine check_zsymel(zsymel,zsymelr,znsymelr)
1812 +        implicit none
1813 +        integer znsymelr, isym
1814 +        character(*) zsymel(*),zsymelr(*)
1815 +        character(len=80) buf
1816 +        zsymel(3)(lenstr(zsymel(3))+1:)='X'
1817 +        write (buf,10) (trim(zsymelr(isym)),isym=1,znsymelr)
1818 +10      format(3(a,:,','))
1819 +        if (trim(buf) /= 'X,Y') call abort
1820 +      end subroutine check_zsymel
1821 +
1822 +      function lenstr(s)
1823 +        character(len=*),intent(in) :: s
1824 +        integer :: lenstr
1825 +        if (len_trim(s) /= 0) call abort
1826 +        lenstr = len_trim(s)
1827 +      end function lenstr
1828 +
1829 +      end subroutine test_lower
1830 +
1831 +      subroutine test_upper
1832 +      implicit none
1833 +      character(3), dimension(3) :: zsymel,zsymelr
1834 +      common /xx/ zsymel, zsymelr
1835 +      integer :: znsymelr
1836 +      zsymel = (/ 'X', 'Y', ' ' /)
1837 +      zsymelr= (/ 'X', 'Y', ' ' /)
1838 +      znsymelr=2
1839 +      call check_zsymel(zsymel,zsymelr,znsymelr)
1840 +
1841 +      contains
1842 +
1843 +      subroutine check_zsymel(zsymel,zsymelr,znsymelr)
1844 +        implicit none
1845 +        integer znsymelr, isym
1846 +        character(*) zsymel(*),zsymelr(*)
1847 +        character(len=80) buf
1848 +        zsymel(3)(:lenstr(zsymel(3))+1)='X'
1849 +        write (buf,20) (trim(zsymelr(isym)),isym=1,znsymelr)
1850 +20      format(3(a,:,','))
1851 +        if (trim(buf) /= 'X,Y') call abort
1852 +      end subroutine check_zsymel
1853 +
1854 +      function lenstr(s)
1855 +        character(len=*),intent(in) :: s
1856 +        integer :: lenstr
1857 +        if (len_trim(s) /= 0) call abort
1858 +        lenstr = len_trim(s)
1859 +      end function lenstr
1860 +
1861 +      end subroutine test_upper
1862 +
1863 +      program test
1864 +        call test_lower
1865 +        call test_upper
1866 +      end program test
1867 Index: gcc/testsuite/gfortran.dg/fmt_t_3.f90
1868 ===================================================================
1869 --- gcc/testsuite/gfortran.dg/fmt_t_3.f90       (.../tags/gcc_4_2_0_release)    (wersja 0)
1870 +++ gcc/testsuite/gfortran.dg/fmt_t_3.f90       (.../branches/gcc-4_2-branch)   (wersja 125589)
1871 @@ -0,0 +1,15 @@
1872 +! { dg-do run }
1873 +! PR31051 bug with x and t format descriptors.
1874 +! Test case prepared by Jerry DeLisle  <jvdelisle@gcc.gnu.org> from PR.
1875 +program t
1876 +   integer, parameter :: n = 9
1877 +   character(len=40) :: fmt
1878 +   character(len=2), dimension(n) :: y
1879 +   open(unit=10, status="scratch")
1880 +   y = 'a '
1881 +   fmt = '(a,1x,(t7, 3a))'
1882 +   write(10, fmt) 'xxxx', (y(i), i = 1,n)
1883 +   rewind(10)
1884 +   read(10, '(a)') fmt
1885 +   if (fmt.ne."xxxx  a a a") call abort()
1886 +end program t
1887 Index: gcc/testsuite/gfortran.dg/backspace_8.f
1888 ===================================================================
1889 --- gcc/testsuite/gfortran.dg/backspace_8.f     (.../tags/gcc_4_2_0_release)    (wersja 0)
1890 +++ gcc/testsuite/gfortran.dg/backspace_8.f     (.../branches/gcc-4_2-branch)   (wersja 125589)
1891 @@ -0,0 +1,18 @@
1892 +C { dg-do run }
1893 +C PR libfortran/31618 - backspace after an error didn't work.
1894 +      program main
1895 +      character*78 msg
1896 +      open (21, file="backspace_7.dat", form="unformatted")
1897 +      write (21) 42, 43
1898 +      write (21) 4711, 4712
1899 +      write (21) -1, -4
1900 +      rewind (21)
1901 +      read (21) i,j
1902 +      read (21,err=100,end=100) i,j,k
1903 +      call abort
1904 + 100  continue
1905 +      backspace 21
1906 +      read (21) i,j
1907 +      if (i .ne. 4711 .or. j .ne. 4712) call abort
1908 +      close (21,status="delete")
1909 +      end
1910 Index: gcc/testsuite/gfortran.dg/func_assign.f90
1911 ===================================================================
1912 --- gcc/testsuite/gfortran.dg/func_assign.f90   (.../tags/gcc_4_2_0_release)    (wersja 0)
1913 +++ gcc/testsuite/gfortran.dg/func_assign.f90   (.../branches/gcc-4_2-branch)   (wersja 125589)
1914 @@ -0,0 +1,33 @@
1915 +! { dg-do compile }
1916 +!
1917 +! PR fortran/31559
1918 +! Do not allow assigning to external functions
1919 +!
1920 +! Contributed by Steve Kargl <sgk@troutmask.apl.washington.edu>
1921 +!
1922 +module mod
1923 +  implicit none
1924 +contains
1925 +  integer function bar()
1926 +    bar = 4
1927 +  end function bar
1928 +
1929 +  subroutine a() 
1930 +   implicit none
1931 +   real :: fun
1932 +   external fun
1933 +   interface
1934 +     function funget(a)
1935 +       integer :: a
1936 +     end function
1937 +     subroutine sub()
1938 +     end subroutine sub
1939 +   end interface
1940 +   sub = 'a'  ! { dg-error "Expected VARIABLE" }
1941 +   fun = 4.4  ! { dg-error "Expected VARIABLE" }
1942 +   funget = 4 ! { dg-error "is not a VALUE" }
1943 +   bar = 5    ! { dg-error "is not a VALUE" }
1944 +  end subroutine a
1945 +end module mod
1946 +
1947 +end
1948 Index: gcc/testsuite/gfortran.dg/unf_io_convert_3.f90
1949 ===================================================================
1950 --- gcc/testsuite/gfortran.dg/unf_io_convert_3.f90      (.../tags/gcc_4_2_0_release)    (wersja 125589)
1951 +++ gcc/testsuite/gfortran.dg/unf_io_convert_3.f90      (.../branches/gcc-4_2-branch)   (wersja 125589)
1952 @@ -1,4 +1,4 @@
1953 -! { dg-do run}
1954 +! { dg-do run }
1955  ! { dg-require-effective-target fortran_large_real }
1956  program main
1957    integer,parameter :: k = selected_real_kind (precision (0.0_8) + 1)
1958 Index: gcc/cp/decl.c
1959 ===================================================================
1960 --- gcc/cp/decl.c       (.../tags/gcc_4_2_0_release)    (wersja 125589)
1961 +++ gcc/cp/decl.c       (.../branches/gcc-4_2-branch)   (wersja 125589)
1962 @@ -5368,7 +5368,18 @@
1963              initializer.  It is not legal to redeclare a static data
1964              member, so this issue does not arise in that case.  */
1965           if (var_definition_p && TREE_STATIC (decl))
1966 -           expand_static_init (decl, init);
1967 +           {
1968 +              /* If a TREE_READONLY variable needs initialization
1969 +                at runtime, it is no longer readonly and we need to
1970 +                avoid MEM_READONLY_P being set on RTL created for it.  */
1971 +             if (init)
1972 +               {
1973 +                 if (TREE_READONLY (decl))
1974 +                   TREE_READONLY (decl) = 0;
1975 +                 was_readonly = 0;
1976 +               }
1977 +             expand_static_init (decl, init);
1978 +           }
1979         }
1980      }
1981  
1982 Index: gcc/cp/ChangeLog
1983 ===================================================================
1984 --- gcc/cp/ChangeLog    (.../tags/gcc_4_2_0_release)    (wersja 125589)
1985 +++ gcc/cp/ChangeLog    (.../branches/gcc-4_2-branch)   (wersja 125589)
1986 @@ -1,3 +1,18 @@
1987 +2007-06-08  Dirk Mueller  <dmueller@suse.de>
1988 +
1989 +       PR c++/31809
1990 +       PR c++/31806
1991 +       Backport from mainline:
1992 +       2007-05-31  Jakub Jelinek  <jakub@redhat.com>
1993 +
1994 +       * decl.c (cp_finish_decl): Also clear was_readonly if a static var
1995 +       needs runtime initialization.
1996 +
1997 +       2007-05-30  Jakub Jelinek  <jakub@redhat.com>
1998 +
1999 +       * decl.c (cp_finish_decl): Clear TREE_READONLY flag on TREE_STATIC
2000 +       variables that need runtime initialization.
2001 +
2002  2007-05-13  Release Manager
2003  
2004         * GCC 4.2.0 released.
2005 Index: gcc/fortran/trans-expr.c
2006 ===================================================================
2007 --- gcc/fortran/trans-expr.c    (.../tags/gcc_4_2_0_release)    (wersja 125589)
2008 +++ gcc/fortran/trans-expr.c    (.../branches/gcc-4_2-branch)   (wersja 125589)
2009 @@ -255,6 +255,10 @@
2010      gfc_conv_string_parameter (se);
2011    else
2012      {
2013 +      /* Avoid multiple evaluation of substring start.  */
2014 +      if (!CONSTANT_CLASS_P (start.expr) && !DECL_P (start.expr))
2015 +       start.expr = gfc_evaluate_now (start.expr, &se->pre);
2016 +
2017        /* Change the start of the string.  */
2018        if (TYPE_STRING_FLAG (TREE_TYPE (se->expr)))
2019         tmp = se->expr;
2020 @@ -273,6 +277,10 @@
2021        gfc_conv_expr_type (&end, ref->u.ss.end, gfc_charlen_type_node);
2022        gfc_add_block_to_block (&se->pre, &end.pre);
2023      }
2024 +
2025 +  if (!CONSTANT_CLASS_P (end.expr) && !DECL_P (end.expr))
2026 +    end.expr = gfc_evaluate_now (end.expr, &se->pre);
2027 +
2028    tmp = fold_build2 (MINUS_EXPR, gfc_charlen_type_node,
2029                      build_int_cst (gfc_charlen_type_node, 1),
2030                      start.expr);
2031 @@ -2340,17 +2348,23 @@
2032  
2033    /* Generate the actual call.  */
2034    gfc_conv_function_val (se, sym);
2035 +
2036    /* If there are alternate return labels, function type should be
2037       integer.  Can't modify the type in place though, since it can be shared
2038 -     with other functions.  */
2039 +     with other functions.  For dummy arguments, the typing is done to
2040 +     to this result, even if it has to be repeated for each call.  */
2041    if (has_alternate_specifier
2042        && TREE_TYPE (TREE_TYPE (TREE_TYPE (se->expr))) != integer_type_node)
2043      {
2044 -      gcc_assert (! sym->attr.dummy);
2045 -      TREE_TYPE (sym->backend_decl)
2046 -        = build_function_type (integer_type_node,
2047 -                               TYPE_ARG_TYPES (TREE_TYPE (sym->backend_decl)));
2048 -      se->expr = build_fold_addr_expr (sym->backend_decl);
2049 +      if (!sym->attr.dummy)
2050 +       {
2051 +         TREE_TYPE (sym->backend_decl)
2052 +               = build_function_type (integer_type_node,
2053 +                     TYPE_ARG_TYPES (TREE_TYPE (sym->backend_decl)));
2054 +         se->expr = build_fold_addr_expr (sym->backend_decl);
2055 +       }
2056 +      else
2057 +       TREE_TYPE (TREE_TYPE (TREE_TYPE (se->expr))) = integer_type_node;
2058      }
2059  
2060    fntype = TREE_TYPE (TREE_TYPE (se->expr));
2061 Index: gcc/fortran/trans-array.c
2062 ===================================================================
2063 --- gcc/fortran/trans-array.c   (.../tags/gcc_4_2_0_release)    (wersja 125589)
2064 +++ gcc/fortran/trans-array.c   (.../branches/gcc-4_2-branch)   (wersja 125589)
2065 @@ -4422,6 +4422,8 @@
2066  
2067        if (se->direct_byref)
2068         base = gfc_index_zero_node;
2069 +      else if (GFC_ARRAY_TYPE_P (TREE_TYPE (desc)))
2070 +       base = gfc_evaluate_now (gfc_conv_array_offset (desc), &loop.pre);
2071        else
2072         base = NULL_TREE;
2073  
2074 @@ -4489,8 +4491,20 @@
2075                                 stride, info->stride[dim]);
2076  
2077           if (se->direct_byref)
2078 -           base = fold_build2 (MINUS_EXPR, TREE_TYPE (base),
2079 -                               base, stride);
2080 +           {
2081 +             base = fold_build2 (MINUS_EXPR, TREE_TYPE (base),
2082 +                                 base, stride);
2083 +           }
2084 +         else if (GFC_ARRAY_TYPE_P (TREE_TYPE (desc)))
2085 +           {
2086 +             tmp = gfc_conv_array_lbound (desc, n);
2087 +             tmp = fold_build2 (MINUS_EXPR, TREE_TYPE (base),
2088 +                                tmp, loop.from[dim]);
2089 +             tmp = fold_build2 (MULT_EXPR, TREE_TYPE (base),
2090 +                                tmp, gfc_conv_array_stride (desc, n));
2091 +             base = fold_build2 (PLUS_EXPR, TREE_TYPE (base),
2092 +                                 tmp, base);
2093 +           }
2094  
2095           /* Store the new stride.  */
2096           tmp = gfc_conv_descriptor_stride (parm, gfc_rank_cst[dim]);
2097 @@ -4511,7 +4525,8 @@
2098           gfc_conv_descriptor_data_set (&loop.pre, parm, offset);
2099         }
2100  
2101 -      if (se->direct_byref && !se->data_not_needed)
2102 +      if ((se->direct_byref || GFC_ARRAY_TYPE_P (TREE_TYPE (desc)))
2103 +            && !se->data_not_needed)
2104         {
2105           /* Set the offset.  */
2106           tmp = gfc_conv_descriptor_offset (parm);
2107 Index: gcc/fortran/gfortran.texi
2108 ===================================================================
2109 --- gcc/fortran/gfortran.texi   (.../tags/gcc_4_2_0_release)    (wersja 125589)
2110 +++ gcc/fortran/gfortran.texi   (.../branches/gcc-4_2-branch)   (wersja 125589)
2111 @@ -611,7 +611,7 @@
2112  to change the representation of data for unformatted files.
2113  The syntax for the @env{GFORTRAN_CONVERT_UNIT} variable is:
2114  @smallexample
2115 -GFORTRAN_CONVERT_UNIT: mode | mode ';' exception ;
2116 +GFORTRAN_CONVERT_UNIT: mode | mode ';' exception | exception ;
2117  mode: 'native' | 'swap' | 'big_endian' | 'little_endian' ;
2118  exception: mode ':' unit_list | unit_list ;
2119  unit_list: unit_spec | unit_list unit_spec ;
2120 @@ -668,7 +668,12 @@
2121  setting a default data representation for the whole program.  The
2122  @code{CONVERT} specifier overrides the @option{-fconvert} compile options.
2123  
2124 +@emph{Note that the values specified via the GFORTRAN_CONVERT_UNIT
2125 +environment variable will override the CONVERT specifier in the
2126 +open statement}.  This is to give control over data formats to
2127 +users who do not have the source code of their program available.
2128  
2129 +
2130  @c =====================================================================
2131  @c PART II: LANGUAGE REFERENCE
2132  @c =====================================================================
2133 Index: gcc/fortran/ChangeLog
2134 ===================================================================
2135 --- gcc/fortran/ChangeLog       (.../tags/gcc_4_2_0_release)    (wersja 125589)
2136 +++ gcc/fortran/ChangeLog       (.../branches/gcc-4_2-branch)   (wersja 125589)
2137 @@ -1,3 +1,30 @@
2138 +2007-05-31  Paul Thomas  <pault@gcc.gnu.org>
2139 +
2140 +       PR fortran/31483
2141 +       * trans-expr.c (gfc_conv_function_call): Give a dummy
2142 +       procedure the correct type if it has alternate returns.
2143 +       
2144 +
2145 +       PR fortran/31540
2146 +       * resolve.c (resolve_fl_procedure): Resolve constant character
2147 +       lengths.
2148 +
2149 +       PR fortran/31867
2150 +       PR fortran/31994
2151 +       * trans-array.c (gfc_conv_expr_descriptor): Obtain the stored
2152 +       offset for non-descriptor, source arrays and correct for stride
2153 +       not equal to one before writing to field of output descriptor.
2154 +
2155 +2007-05-17  Tobias Burnus  <burnus@net-b.de>
2156 +
2157 +       * gfortran.texi (GFORTRAN_CONVERT_UNIT): Improve documentation.
2158 +
2159 +2007-05-16  Francois-Xavier Coudert  <fxcoudert@gcc.gnu.org>
2160 +
2161 +       PR fortran/31725
2162 +       * trans-expr.c (gfc_conv_substring): Evaluate substring bounds
2163 +       only once.
2164 +
2165  2007-05-13  Release Manager
2166  
2167         * GCC 4.2.0 released.
2168 Index: gcc/fortran/resolve.c
2169 ===================================================================
2170 --- gcc/fortran/resolve.c       (.../tags/gcc_4_2_0_release)    (wersja 125589)
2171 +++ gcc/fortran/resolve.c       (.../branches/gcc-4_2-branch)   (wersja 125589)
2172 @@ -5742,6 +5742,11 @@
2173    if (sym->ts.type == BT_CHARACTER)
2174      {
2175        gfc_charlen *cl = sym->ts.cl;
2176 +
2177 +      if (cl && cl->length && gfc_is_constant_expr (cl->length)
2178 +            && resolve_charlen (cl) == FAILURE)
2179 +       return FAILURE;
2180 +
2181        if (!cl || !cl->length || cl->length->expr_type != EXPR_CONSTANT)
2182         {
2183           if (sym->attr.proc == PROC_ST_FUNCTION)
2184 Index: gcc/fortran/primary.c
2185 ===================================================================
2186 --- gcc/fortran/primary.c       (.../tags/gcc_4_2_0_release)    (wersja 125589)
2187 +++ gcc/fortran/primary.c       (.../branches/gcc-4_2-branch)   (wersja 125589)
2188 @@ -2415,7 +2415,8 @@
2189  
2190      case FL_PROCEDURE:
2191        /* Check for a nonrecursive function result */
2192 -      if (sym->attr.function && (sym->result == sym || sym->attr.entry))
2193 +      if (sym->attr.function && (sym->result == sym || sym->attr.entry)
2194 +         && !sym->attr.external)
2195         {
2196           /* If a function result is a derived type, then the derived
2197              type may still have to be resolved.  */
2198 Index: gcc/BASE-VER
2199 ===================================================================
2200 --- gcc/BASE-VER        (.../tags/gcc_4_2_0_release)    (wersja 125589)
2201 +++ gcc/BASE-VER        (.../branches/gcc-4_2-branch)   (wersja 125589)
2202 @@ -1 +1 @@
2203 -4.2.0
2204 +4.2.1
2205 Index: gcc/except.c
2206 ===================================================================
2207 --- gcc/except.c        (.../tags/gcc_4_2_0_release)    (wersja 125589)
2208 +++ gcc/except.c        (.../branches/gcc-4_2-branch)   (wersja 125589)
2209 @@ -1005,7 +1005,11 @@
2210      for (prev_try = VEC_index (eh_region, cfun->eh->region_array, outer_region);
2211           prev_try && prev_try->type != ERT_TRY;
2212          prev_try = prev_try->outer)
2213 -      ;
2214 +      if (prev_try->type == ERT_MUST_NOT_THROW)
2215 +       {
2216 +         prev_try = NULL;
2217 +         break;
2218 +       }
2219  
2220    /* Remap all of the internal catch and cleanup linkages.  Since we 
2221       duplicate entire subtrees, all of the referenced regions will have
2222 Index: gcc/combine.c
2223 ===================================================================
2224 --- gcc/combine.c       (.../tags/gcc_4_2_0_release)    (wersja 125589)
2225 +++ gcc/combine.c       (.../branches/gcc-4_2-branch)   (wersja 125589)
2226 @@ -5341,14 +5341,14 @@
2227         }
2228        else if (GET_MODE (op0) == compare_mode && op1 == const0_rtx)
2229         {
2230 -         SUBST(SET_SRC (x), op0);
2231 +         SUBST (SET_SRC (x), op0);
2232           src = SET_SRC (x);
2233         }
2234 -      else
2235 +      /* Otherwise, update the COMPARE if needed.  */
2236 +      else if (XEXP (src, 0) != op0 || XEXP (src, 1) != op1)
2237         {
2238 -         /* Otherwise, update the COMPARE if needed.  */
2239 -         SUBST (XEXP (src, 0), op0);
2240 -         SUBST (XEXP (src, 1), op1);
2241 +         SUBST (SET_SRC (x), gen_rtx_COMPARE (compare_mode, op0, op1));
2242 +         src = SET_SRC (x);
2243         }
2244      }
2245    else
2246 Index: gcc/Makefile.in
2247 ===================================================================
2248 --- gcc/Makefile.in     (.../tags/gcc_4_2_0_release)    (wersja 125589)
2249 +++ gcc/Makefile.in     (.../branches/gcc-4_2-branch)   (wersja 125589)
2250 @@ -1839,7 +1839,7 @@
2251  tree-ssa-structalias.o: tree-ssa-structalias.c tree-ssa-structalias.h \
2252     $(SYSTEM_H) $(CONFIG_H) $(GGC_H) $(TREE_H) $(TREE_FLOW_H) \
2253     $(TM_H) coretypes.h $(CGRAPH_H) tree-pass.h $(TIMEVAR_H) \
2254 -   gt-tree-ssa-structalias.h $(PARAMS_H)
2255 +   gt-tree-ssa-structalias.h $(PARAMS_H) pointer-set.h
2256  tree-ssa.o : tree-ssa.c $(TREE_FLOW_H) $(CONFIG_H) $(SYSTEM_H) \
2257     $(RTL_H) $(TREE_H) $(TM_P_H) $(EXPR_H) output.h $(DIAGNOSTIC_H) \
2258     toplev.h $(FUNCTION_H) $(TIMEVAR_H) $(TM_H) coretypes.h \
2259 Index: gcc/tree-ssa-structalias.c
2260 ===================================================================
2261 --- gcc/tree-ssa-structalias.c  (.../tags/gcc_4_2_0_release)    (wersja 125589)
2262 +++ gcc/tree-ssa-structalias.c  (.../branches/gcc-4_2-branch)   (wersja 125589)
2263 @@ -51,10 +51,11 @@
2264  #include "params.h"
2265  #include "tree-ssa-structalias.h"
2266  #include "cgraph.h"
2267 +#include "pointer-set.h"
2268  
2269  /* The idea behind this analyzer is to generate set constraints from the
2270     program, then solve the resulting constraints in order to generate the
2271 -   points-to sets. 
2272 +   points-to sets.
2273  
2274     Set constraints are a way of modeling program analysis problems that
2275     involve sets.  They consist of an inclusion constraint language,
2276 @@ -70,33 +71,33 @@
2277  
2278     Also see "Ultra-fast Aliasing Analysis using CLA: A Million Lines
2279     of C Code in a Second" by ""Nevin Heintze and Olivier Tardieu" at
2280 -   http://citeseer.ist.psu.edu/heintze01ultrafast.html 
2281 +   http://citeseer.ist.psu.edu/heintze01ultrafast.html
2282  
2283 -   There are three types of constraint expressions, DEREF, ADDRESSOF, and
2284 -   SCALAR.  Each constraint expression consists of a constraint type,
2285 -   a variable, and an offset.  
2286 -   
2287 +   There are three types of real constraint expressions, DEREF,
2288 +   ADDRESSOF, and SCALAR.  Each constraint expression consists
2289 +   of a constraint type, a variable, and an offset.
2290 +
2291     SCALAR is a constraint expression type used to represent x, whether
2292     it appears on the LHS or the RHS of a statement.
2293     DEREF is a constraint expression type used to represent *x, whether
2294 -   it appears on the LHS or the RHS of a statement. 
2295 +   it appears on the LHS or the RHS of a statement.
2296     ADDRESSOF is a constraint expression used to represent &x, whether
2297     it appears on the LHS or the RHS of a statement.
2298 -   
2299 +
2300     Each pointer variable in the program is assigned an integer id, and
2301     each field of a structure variable is assigned an integer id as well.
2302 -   
2303 +
2304     Structure variables are linked to their list of fields through a "next
2305     field" in each variable that points to the next field in offset
2306 -   order.  
2307 -   Each variable for a structure field has 
2308 +   order.
2309 +   Each variable for a structure field has
2310  
2311     1. "size", that tells the size in bits of that field.
2312     2. "fullsize, that tells the size in bits of the entire structure.
2313     3. "offset", that tells the offset in bits from the beginning of the
2314     structure to this field.
2315  
2316 -   Thus, 
2317 +   Thus,
2318     struct f
2319     {
2320       int a;
2321 @@ -110,50 +111,51 @@
2322     foo.b -> id 2, size 32, offset 32, fullsize 64, next NULL
2323     bar -> id 3, size 32, offset 0, fullsize 32, next NULL
2324  
2325 -   
2326 +
2327    In order to solve the system of set constraints, the following is
2328    done:
2329  
2330    1. Each constraint variable x has a solution set associated with it,
2331    Sol(x).
2332 -  
2333 +
2334    2. Constraints are separated into direct, copy, and complex.
2335    Direct constraints are ADDRESSOF constraints that require no extra
2336    processing, such as P = &Q
2337    Copy constraints are those of the form P = Q.
2338 -  Complex constraints are all the constraints involving dereferences.
2339 -  
2340 +  Complex constraints are all the constraints involving dereferences
2341 +  and offsets (including offsetted copies).
2342 +
2343    3. All direct constraints of the form P = &Q are processed, such
2344 -  that Q is added to Sol(P) 
2345 +  that Q is added to Sol(P)
2346  
2347    4. All complex constraints for a given constraint variable are stored in a
2348 -  linked list attached to that variable's node.  
2349 +  linked list attached to that variable's node.
2350  
2351    5. A directed graph is built out of the copy constraints. Each
2352 -  constraint variable is a node in the graph, and an edge from 
2353 +  constraint variable is a node in the graph, and an edge from
2354    Q to P is added for each copy constraint of the form P = Q
2355 -  
2356 +
2357    6. The graph is then walked, and solution sets are
2358    propagated along the copy edges, such that an edge from Q to P
2359    causes Sol(P) <- Sol(P) union Sol(Q).
2360 -  
2361 +
2362    7.  As we visit each node, all complex constraints associated with
2363    that node are processed by adding appropriate copy edges to the graph, or the
2364 -  appropriate variables to the solution set.  
2365 +  appropriate variables to the solution set.
2366  
2367    8. The process of walking the graph is iterated until no solution
2368    sets change.
2369  
2370    Prior to walking the graph in steps 6 and 7, We perform static
2371 -  cycle elimination on the constraint graph, as well 
2372 +  cycle elimination on the constraint graph, as well
2373    as off-line variable substitution.
2374 -  
2375 +
2376    TODO: Adding offsets to pointer-to-structures can be handled (IE not punted
2377    on and turned into anything), but isn't.  You can just see what offset
2378    inside the pointed-to struct it's going to access.
2379 -  
2380 +
2381    TODO: Constant bounded arrays can be handled as if they were structs of the
2382 -  same number of elements. 
2383 +  same number of elements.
2384  
2385    TODO: Modeling heap and incoming pointers becomes much better if we
2386    add fields to them as we discover them, which we could do.
2387 @@ -161,20 +163,29 @@
2388    TODO: We could handle unions, but to be honest, it's probably not
2389    worth the pain or slowdown.  */
2390  
2391 -static GTY ((if_marked ("tree_map_marked_p"), param_is (struct tree_map))) 
2392 -htab_t heapvar_for_stmt;
2393 +static GTY ((if_marked ("tree_map_marked_p"), param_is (struct tree_map))) htab_t heapvar_for_stmt;
2394  
2395  /* One variable to represent all non-local accesses.  */
2396  tree nonlocal_all;
2397  
2398  static bool use_field_sensitive = true;
2399  static int in_ipa_mode = 0;
2400 +
2401 +/* Used for predecessor bitmaps. */
2402  static bitmap_obstack predbitmap_obstack;
2403 -static bitmap_obstack ptabitmap_obstack;
2404 +
2405 +/* Used for points-to sets.  */
2406 +static bitmap_obstack pta_obstack;
2407 +
2408 +/* Used for oldsolution members of variables. */
2409 +static bitmap_obstack oldpta_obstack;
2410 +
2411 +/* Used for per-solver-iteration bitmaps.  */
2412  static bitmap_obstack iteration_obstack;
2413  
2414  static unsigned int create_variable_info_for (tree, const char *);
2415 -static void build_constraint_graph (void);
2416 +typedef struct constraint_graph *constraint_graph_t;
2417 +static void unify_nodes (constraint_graph_t, unsigned int, unsigned int, bool);
2418  
2419  DEF_VEC_P(constraint_t);
2420  DEF_VEC_ALLOC_P(constraint_t,heap);
2421 @@ -186,11 +197,13 @@
2422  static struct constraint_stats
2423  {
2424    unsigned int total_vars;
2425 -  unsigned int collapsed_vars;
2426 +  unsigned int nonpointer_vars;
2427    unsigned int unified_vars_static;
2428    unsigned int unified_vars_dynamic;
2429    unsigned int iterations;
2430    unsigned int num_edges;
2431 +  unsigned int num_implicit_edges;
2432 +  unsigned int points_to_sets_created;
2433  } stats;
2434  
2435  struct variable_info
2436 @@ -205,7 +218,7 @@
2437    tree decl;
2438  
2439    /* Offset of this variable, in bits, from the base variable  */
2440 -  unsigned HOST_WIDE_INT offset;  
2441 +  unsigned HOST_WIDE_INT offset;
2442  
2443    /* Size of the variable, in bits.  */
2444    unsigned HOST_WIDE_INT size;
2445 @@ -216,34 +229,21 @@
2446    /* A link to the variable for the next field in this structure.  */
2447    struct variable_info *next;
2448  
2449 -  /* Node in the graph that represents the constraints and points-to
2450 -     solution for the variable.  */
2451 -  unsigned int node;
2452 -
2453 -  /* True if the address of this variable is taken.  Needed for
2454 -     variable substitution.  */
2455 -  unsigned int address_taken:1;
2456 -
2457 -  /* True if this variable is the target of a dereference.  Needed for
2458 -     variable substitution.  */
2459 -  unsigned int indirect_target:1;
2460 -  
2461    /* True if the variable is directly the target of a dereference.
2462       This is used to track which variables are *actually* dereferenced
2463 -     so we can prune their points to listed. This is equivalent to the
2464 -     indirect_target flag when no merging of variables happens.  */
2465 +     so we can prune their points to listed. */
2466    unsigned int directly_dereferenced:1;
2467  
2468    /* True if this is a variable created by the constraint analysis, such as
2469       heap variables and constraints we had to break up.  */
2470    unsigned int is_artificial_var:1;
2471 -  
2472 +
2473    /* True if this is a special variable whose solution set should not be
2474       changed.  */
2475    unsigned int is_special_var:1;
2476  
2477    /* True for variables whose size is not known or variable.  */
2478 -  unsigned int is_unknown_size_var:1;  
2479 +  unsigned int is_unknown_size_var:1;
2480  
2481    /* True for variables that have unions somewhere in them.  */
2482    unsigned int has_union:1;
2483 @@ -254,16 +254,15 @@
2484    /* Points-to set for this variable.  */
2485    bitmap solution;
2486  
2487 +  /* Old points-to set for this variable.  */
2488 +  bitmap oldsolution;
2489 +
2490    /* Variable ids represented by this node.  */
2491    bitmap variables;
2492  
2493 -  /* Vector of complex constraints for this node.  Complex
2494 -     constraints are those involving dereferences.  */
2495 -  VEC(constraint_t,heap) *complex;
2496 -  
2497 -  /* Variable id this was collapsed to due to type unsafety.
2498 -     This should be unused completely after build_constraint_graph, or
2499 -     something is broken.  */
2500 +  /* Variable id this was collapsed to due to type unsafety.  This
2501 +     should be unused completely after build_succ_graph, or something
2502 +     is broken.  */
2503    struct variable_info *collapsed_to;
2504  };
2505  typedef struct variable_info *varinfo_t;
2506 @@ -277,8 +276,8 @@
2507  
2508  DEF_VEC_ALLOC_P(varinfo_t, heap);
2509  
2510 -/* Table of variable info structures for constraint variables.  Indexed directly
2511 -   by variable info id.  */
2512 +/* Table of variable info structures for constraint variables.
2513 +   Indexed directly by variable info id.  */
2514  static VEC(varinfo_t,heap) *varmap;
2515  
2516  /* Return the varmap element N */
2517 @@ -286,7 +285,7 @@
2518  static inline varinfo_t
2519  get_varinfo (unsigned int n)
2520  {
2521 -  return VEC_index(varinfo_t, varmap, n);
2522 +  return VEC_index (varinfo_t, varmap, n);
2523  }
2524  
2525  /* Return the varmap element N, following the collapsed_to link.  */
2526 @@ -294,7 +293,7 @@
2527  static inline varinfo_t
2528  get_varinfo_fc (unsigned int n)
2529  {
2530 -  varinfo_t v = VEC_index(varinfo_t, varmap, n);
2531 +  varinfo_t v = VEC_index (varinfo_t, varmap, n);
2532  
2533    if (v->collapsed_to)
2534      return v->collapsed_to;
2535 @@ -331,10 +330,9 @@
2536  /* Variable that represents non-local variables before we expand it to
2537     one for each type.  */
2538  static unsigned int nonlocal_vars_id;
2539 -
2540  /* Lookup a heap var for FROM, and return it if we find one.  */
2541  
2542 -static tree 
2543 +static tree
2544  heapvar_lookup (tree from)
2545  {
2546    struct tree_map *h, in;
2547 @@ -367,25 +365,21 @@
2548     named NAME, and using constraint graph node NODE.  */
2549  
2550  static varinfo_t
2551 -new_var_info (tree t, unsigned int id, const char *name, unsigned int node)
2552 +new_var_info (tree t, unsigned int id, const char *name)
2553  {
2554    varinfo_t ret = pool_alloc (variable_info_pool);
2555  
2556    ret->id = id;
2557    ret->name = name;
2558    ret->decl = t;
2559 -  ret->node = node;
2560 -  ret->address_taken = false;
2561 -  ret->indirect_target = false;
2562    ret->directly_dereferenced = false;
2563    ret->is_artificial_var = false;
2564    ret->is_heap_var = false;
2565    ret->is_special_var = false;
2566    ret->is_unknown_size_var = false;
2567    ret->has_union = false;
2568 -  ret->solution = BITMAP_ALLOC (&ptabitmap_obstack);
2569 -  ret->variables = BITMAP_ALLOC (&ptabitmap_obstack);
2570 -  ret->complex = NULL;
2571 +  ret->solution = BITMAP_ALLOC (&pta_obstack);
2572 +  ret->oldsolution = BITMAP_ALLOC (&oldpta_obstack);
2573    ret->next = NULL;
2574    ret->collapsed_to = NULL;
2575    return ret;
2576 @@ -395,7 +389,7 @@
2577  
2578  /* An expression that appears in a constraint.  */
2579  
2580 -struct constraint_expr 
2581 +struct constraint_expr
2582  {
2583    /* Constraint type.  */
2584    constraint_expr_type type;
2585 @@ -418,7 +412,7 @@
2586  static void do_deref (VEC (ce_s, heap) **);
2587  
2588  /* Our set constraints are made up of two constraint expressions, one
2589 -   LHS, and one RHS.  
2590 +   LHS, and one RHS.
2591  
2592     As described in the introduction, our set constraints each represent an
2593     operation between set valued variables.
2594 @@ -434,63 +428,98 @@
2595  static VEC(constraint_t,heap) *constraints;
2596  static alloc_pool constraint_pool;
2597  
2598 -/* An edge in the weighted constraint graph.   The edges are weighted,
2599 -   with a bit set in weights meaning their is an edge with that
2600 -   weight. 
2601 -   We don't keep the src in the edge, because we always know what it
2602 -   is. */
2603  
2604 -struct constraint_edge
2605 +DEF_VEC_I(int);
2606 +DEF_VEC_ALLOC_I(int, heap);
2607 +
2608 +/* The constraint graph is represented as an array of bitmaps
2609 +   containing successor nodes.  */
2610 +
2611 +struct constraint_graph
2612  {
2613 -  unsigned int dest;
2614 -  bitmap weights;
2615 -};
2616 +  /* Size of this graph, which may be different than the number of
2617 +     nodes in the variable map.  */
2618 +  unsigned int size;
2619  
2620 -typedef struct constraint_edge *constraint_edge_t;
2621 -static alloc_pool constraint_edge_pool;
2622 +  /* Explicit successors of each node. */
2623 +  bitmap *succs;
2624  
2625 -/* Return a new constraint edge from SRC to DEST.  */
2626 +  /* Implicit predecessors of each node (Used for variable
2627 +     substitution). */
2628 +  bitmap *implicit_preds;
2629  
2630 -static constraint_edge_t
2631 -new_constraint_edge (unsigned int dest)
2632 -{
2633 -  constraint_edge_t ret = pool_alloc (constraint_edge_pool);
2634 -  ret->dest = dest;
2635 -  ret->weights = NULL;
2636 -  return ret;
2637 -}
2638 +  /* Explicit predecessors of each node (Used for variable substitution).  */
2639 +  bitmap *preds;
2640  
2641 -DEF_VEC_P(constraint_edge_t);
2642 -DEF_VEC_ALLOC_P(constraint_edge_t,heap);
2643 +  /* Indirect cycle representatives, or -1 if the node has no indirect
2644 +     cycles.  */
2645 +  int *indirect_cycles;
2646  
2647 +  /* Representative node for a node.  rep[a] == a unless the node has
2648 +     been unified. */
2649 +  unsigned int *rep;
2650  
2651 -/* The constraint graph is represented internally in two different
2652 -   ways.  The overwhelming majority of edges in the constraint graph
2653 -   are zero weigh edges, and thus, using a vector of contrainst_edge_t
2654 -   is a waste of time and memory, since they have no weights.  We
2655 -   simply use a bitmap to store the preds and succs for each node.
2656 -   The weighted edges are stored as a set of adjacency vectors, one
2657 -   per variable. succs[x] is the vector of successors for variable x,
2658 -   and preds[x] is the vector of predecessors for variable x.  IOW,
2659 -   all edges are "forward" edges, which is not like our CFG.  So
2660 -   remember that preds[x]->src == x, and succs[x]->src == x.  */
2661 +  /* Equivalence class representative for a node.  This is used for
2662 +     variable substitution.  */
2663 +  int *eq_rep;
2664  
2665 -struct constraint_graph
2666 -{
2667 -  bitmap *zero_weight_succs;
2668 -  bitmap *zero_weight_preds;
2669 -  VEC(constraint_edge_t,heap) **succs;
2670 -  VEC(constraint_edge_t,heap) **preds;
2671 +  /* Label for each node, used during variable substitution.  */
2672 +  unsigned int *label;
2673 +
2674 +  /* Bitmap of nodes where the bit is set if the node is a direct
2675 +     node.  Used for variable substitution.  */
2676 +  sbitmap direct_nodes;
2677 +
2678 +  /* Vector of complex constraints for each graph node.  Complex
2679 +     constraints are those involving dereferences or offsets that are
2680 +     not 0.  */
2681 +  VEC(constraint_t,heap) **complex;
2682  };
2683  
2684 -typedef struct constraint_graph *constraint_graph_t;
2685 -
2686  static constraint_graph_t graph;
2687 -static int graph_size;
2688  
2689 +/* During variable substitution and the offline version of indirect
2690 +   cycle finding, we create nodes to represent dereferences and
2691 +   address taken constraints.  These represent where these start and
2692 +   end.  */
2693 +#define FIRST_REF_NODE (VEC_length (varinfo_t, varmap))
2694 +#define LAST_REF_NODE (FIRST_REF_NODE + (FIRST_REF_NODE - 1))
2695 +#define FIRST_ADDR_NODE (LAST_REF_NODE + 1)
2696 +
2697 +/* Return the representative node for NODE, if NODE has been unioned
2698 +   with another NODE.
2699 +   This function performs path compression along the way to finding
2700 +   the representative.  */
2701 +
2702 +static unsigned int
2703 +find (unsigned int node)
2704 +{
2705 +  gcc_assert (node < graph->size);
2706 +  if (graph->rep[node] != node)
2707 +    return graph->rep[node] = find (graph->rep[node]);
2708 +  return node;
2709 +}
2710 +
2711 +/* Union the TO and FROM nodes to the TO nodes.
2712 +   Note that at some point in the future, we may want to do
2713 +   union-by-rank, in which case we are going to have to return the
2714 +   node we unified to.  */
2715 +
2716 +static bool
2717 +unite (unsigned int to, unsigned int from)
2718 +{
2719 +  gcc_assert (to < graph->size && from < graph->size);
2720 +  if (to != from && graph->rep[from] != to)
2721 +    {
2722 +      graph->rep[from] = to;
2723 +      return true;
2724 +    }
2725 +  return false;
2726 +}
2727 +
2728  /* Create a new constraint consisting of LHS and RHS expressions.  */
2729  
2730 -static constraint_t 
2731 +static constraint_t
2732  new_constraint (const struct constraint_expr lhs,
2733                 const struct constraint_expr rhs)
2734  {
2735 @@ -508,7 +537,7 @@
2736    if (c->lhs.type == ADDRESSOF)
2737      fprintf (file, "&");
2738    else if (c->lhs.type == DEREF)
2739 -    fprintf (file, "*");  
2740 +    fprintf (file, "*");
2741    fprintf (file, "%s", get_varinfo_fc (c->lhs.var)->name);
2742    if (c->lhs.offset != 0)
2743      fprintf (file, " + " HOST_WIDE_INT_PRINT_DEC, c->lhs.offset);
2744 @@ -550,23 +579,24 @@
2745    dump_constraints (stderr);
2746  }
2747  
2748 -/* SOLVER FUNCTIONS 
2749 +/* SOLVER FUNCTIONS
2750  
2751     The solver is a simple worklist solver, that works on the following
2752     algorithm:
2753 -   
2754 -   sbitmap changed_nodes = all ones;
2755 -   changed_count = number of nodes;
2756 -   For each node that was already collapsed:
2757 -       changed_count--;
2758  
2759 +   sbitmap changed_nodes = all zeroes;
2760 +   changed_count = 0;
2761 +   For each node that is not already collapsed:
2762 +       changed_count++;
2763 +       set bit in changed nodes
2764 +
2765     while (changed_count > 0)
2766     {
2767       compute topological ordering for constraint graph
2768 -  
2769 +
2770       find and collapse cycles in the constraint graph (updating
2771       changed if necessary)
2772 -     
2773 +
2774       for each node (n) in the graph in topological order:
2775         changed_count--;
2776  
2777 @@ -619,11 +649,11 @@
2778  }
2779  
2780  /* Return true if two constraints A and B are equal.  */
2781 -  
2782 +
2783  static bool
2784  constraint_equal (struct constraint a, struct constraint b)
2785  {
2786 -  return constraint_expr_equal (a.lhs, b.lhs) 
2787 +  return constraint_expr_equal (a.lhs, b.lhs)
2788      && constraint_expr_equal (a.rhs, b.rhs);
2789  }
2790  
2791 @@ -634,7 +664,7 @@
2792  constraint_vec_find (VEC(constraint_t,heap) *vec,
2793                      struct constraint lookfor)
2794  {
2795 -  unsigned int place;  
2796 +  unsigned int place;
2797    constraint_t found;
2798  
2799    if (vec == NULL)
2800 @@ -684,7 +714,7 @@
2801        /* If this is a properly sized variable, only add offset if it's
2802          less than end.  Otherwise, it is globbed to a single
2803          variable.  */
2804 -      
2805 +
2806        if ((get_varinfo (i)->offset + offset) < get_varinfo (i)->fullsize)
2807         {
2808           unsigned HOST_WIDE_INT fieldoffset = get_varinfo (i)->offset + offset;
2809 @@ -693,15 +723,15 @@
2810             continue;
2811           bitmap_set_bit (result, v->id);
2812         }
2813 -      else if (get_varinfo (i)->is_artificial_var 
2814 +      else if (get_varinfo (i)->is_artificial_var
2815                || get_varinfo (i)->has_union
2816                || get_varinfo (i)->is_unknown_size_var)
2817         {
2818           bitmap_set_bit (result, i);
2819         }
2820      }
2821 -  
2822 -  bitmap_copy (set, result);  
2823 +
2824 +  bitmap_copy (set, result);
2825    BITMAP_FREE (result);
2826  }
2827  
2828 @@ -727,397 +757,149 @@
2829      }
2830  }
2831  
2832 -/* Insert constraint C into the list of complex constraints for VAR.  */
2833 +/* Insert constraint C into the list of complex constraints for graph
2834 +   node VAR.  */
2835  
2836  static void
2837 -insert_into_complex (unsigned int var, constraint_t c)
2838 +insert_into_complex (constraint_graph_t graph,
2839 +                    unsigned int var, constraint_t c)
2840  {
2841 -  varinfo_t vi = get_varinfo (var);
2842 -  unsigned int place = VEC_lower_bound (constraint_t, vi->complex, c,
2843 +  VEC (constraint_t, heap) *complex = graph->complex[var];
2844 +  unsigned int place = VEC_lower_bound (constraint_t, complex, c,
2845                                         constraint_less);
2846 -  VEC_safe_insert (constraint_t, heap, vi->complex, place, c);
2847 -}
2848  
2849 -
2850 -/* Compare two constraint edges A and B, return true if they are equal.  */
2851 -
2852 -static bool
2853 -constraint_edge_equal (struct constraint_edge a, struct constraint_edge b)
2854 -{
2855 -  return a.dest == b.dest;
2856 +  /* Only insert constraints that do not already exist.  */
2857 +  if (place >= VEC_length (constraint_t, complex)
2858 +      || !constraint_equal (*c, *VEC_index (constraint_t, complex, place)))
2859 +    VEC_safe_insert (constraint_t, heap, graph->complex[var], place, c);
2860  }
2861  
2862 -/* Compare two constraint edges, return true if A is less than B */
2863  
2864 -static bool
2865 -constraint_edge_less (const constraint_edge_t a, const constraint_edge_t b)
2866 -{
2867 -  if (a->dest < b->dest)
2868 -    return true;
2869 -  return false;
2870 -}
2871 -
2872 -/* Find the constraint edge that matches LOOKFOR, in VEC.
2873 -   Return the edge, if found, NULL otherwise.  */
2874 -
2875 -static constraint_edge_t 
2876 -constraint_edge_vec_find (VEC(constraint_edge_t,heap) *vec, 
2877 -                         struct constraint_edge lookfor)
2878 -{
2879 -  unsigned int place;  
2880 -  constraint_edge_t edge = NULL;
2881 -
2882 -  place = VEC_lower_bound (constraint_edge_t, vec, &lookfor, 
2883 -                          constraint_edge_less);
2884 -  if (place >= VEC_length (constraint_edge_t, vec))
2885 -    return NULL;
2886 -  edge = VEC_index (constraint_edge_t, vec, place);
2887 -  if (!constraint_edge_equal (*edge, lookfor))
2888 -    return NULL;
2889 -  return edge;
2890 -}
2891 -
2892  /* Condense two variable nodes into a single variable node, by moving
2893     all associated info from SRC to TO.  */
2894  
2895 -static void 
2896 -condense_varmap_nodes (unsigned int to, unsigned int src)
2897 +static void
2898 +merge_node_constraints (constraint_graph_t graph, unsigned int to,
2899 +                       unsigned int from)
2900  {
2901 -  varinfo_t tovi = get_varinfo (to);
2902 -  varinfo_t srcvi = get_varinfo (src);
2903    unsigned int i;
2904    constraint_t c;
2905 -  bitmap_iterator bi;
2906 -  
2907 -  /* the src node, and all its variables, are now the to node.  */
2908 -  srcvi->node = to;
2909 -  EXECUTE_IF_SET_IN_BITMAP (srcvi->variables, 0, i, bi)
2910 -    get_varinfo (i)->node = to;
2911 -  
2912 -  /* Merge the src node variables and the to node variables.  */
2913 -  bitmap_set_bit (tovi->variables, src);
2914 -  bitmap_ior_into (tovi->variables, srcvi->variables);
2915 -  bitmap_clear (srcvi->variables);
2916 -  
2917 +
2918 +  gcc_assert (find (from) == to);
2919 +
2920    /* Move all complex constraints from src node into to node  */
2921 -  for (i = 0; VEC_iterate (constraint_t, srcvi->complex, i, c); i++)
2922 +  for (i = 0; VEC_iterate (constraint_t, graph->complex[from], i, c); i++)
2923      {
2924        /* In complex constraints for node src, we may have either
2925 -        a = *src, and *src = a.  */
2926 -      
2927 +        a = *src, and *src = a, or an offseted constraint which are
2928 +        always added to the rhs node's constraints.  */
2929 +
2930        if (c->rhs.type == DEREF)
2931         c->rhs.var = to;
2932 +      else if (c->lhs.type == DEREF)
2933 +       c->lhs.var = to;
2934        else
2935 -       c->lhs.var = to;
2936 +       c->rhs.var = to;
2937      }
2938 -  constraint_set_union (&tovi->complex, &srcvi->complex);
2939 -  VEC_free (constraint_t, heap, srcvi->complex);
2940 -  srcvi->complex = NULL;
2941 +  constraint_set_union (&graph->complex[to], &graph->complex[from]);
2942 +  VEC_free (constraint_t, heap, graph->complex[from]);
2943 +  graph->complex[from] = NULL;
2944  }
2945  
2946 -/* Erase an edge from SRC to SRC from GRAPH.  This routine only
2947 -   handles self-edges (e.g. an edge from a to a).  */
2948  
2949 -static void
2950 -erase_graph_self_edge (constraint_graph_t graph, unsigned int src)
2951 -{
2952 -  VEC(constraint_edge_t,heap) *predvec = graph->preds[src];
2953 -  VEC(constraint_edge_t,heap) *succvec = graph->succs[src];
2954 -  struct constraint_edge edge;
2955 -  unsigned int place;
2956 -
2957 -  edge.dest = src;
2958 -
2959 -  /* Remove from the successors.  */
2960 -  place = VEC_lower_bound (constraint_edge_t, succvec, &edge, 
2961 -                          constraint_edge_less);
2962 -  
2963 -  /* Make sure we found the edge.  */
2964 -#ifdef ENABLE_CHECKING
2965 -  {
2966 -    constraint_edge_t tmp = VEC_index (constraint_edge_t, succvec, place);
2967 -    gcc_assert (constraint_edge_equal (*tmp, edge));
2968 -  }
2969 -#endif
2970 -  VEC_ordered_remove (constraint_edge_t, succvec, place);
2971 -
2972 -  /* Remove from the predecessors.  */
2973 -  place = VEC_lower_bound (constraint_edge_t, predvec, &edge,
2974 -                          constraint_edge_less);
2975 -
2976 -  /* Make sure we found the edge.  */
2977 -#ifdef ENABLE_CHECKING
2978 -  {
2979 -    constraint_edge_t tmp = VEC_index (constraint_edge_t, predvec, place);
2980 -    gcc_assert (constraint_edge_equal (*tmp, edge));
2981 -  }
2982 -#endif
2983 -  VEC_ordered_remove (constraint_edge_t, predvec, place);
2984 -}
2985 -
2986  /* Remove edges involving NODE from GRAPH.  */
2987  
2988  static void
2989  clear_edges_for_node (constraint_graph_t graph, unsigned int node)
2990  {
2991 -  VEC(constraint_edge_t,heap) *succvec = graph->succs[node];
2992 -  VEC(constraint_edge_t,heap) *predvec = graph->preds[node];
2993 -  bitmap_iterator bi;
2994 -  unsigned int j;
2995 -  constraint_edge_t c = NULL;
2996 -  int i;
2997 -
2998 -  /* Walk the successors, erase the associated preds.  */
2999 -  
3000 -  EXECUTE_IF_IN_NONNULL_BITMAP (graph->zero_weight_succs[node], 0, j, bi)
3001 -    if (j != node)
3002 -      bitmap_clear_bit (graph->zero_weight_preds[j], node);
3003 -  
3004 -  for (i = 0; VEC_iterate (constraint_edge_t, succvec, i, c); i++)
3005 -    if (c->dest != node)
3006 -      {
3007 -       unsigned int place;
3008 -       struct constraint_edge lookfor;
3009 -       constraint_edge_t result;
3010 -
3011 -       lookfor.dest = node;
3012 -       place = VEC_lower_bound (constraint_edge_t, graph->preds[c->dest], 
3013 -                                &lookfor, constraint_edge_less);
3014 -       result = VEC_ordered_remove (constraint_edge_t, 
3015 -                                    graph->preds[c->dest], place);
3016 -       pool_free (constraint_edge_pool, result);
3017 -      }
3018 -
3019 -  /* Walk the preds, erase the associated succs.  */
3020 -
3021 -  EXECUTE_IF_IN_NONNULL_BITMAP (graph->zero_weight_preds[node], 0, j, bi)
3022 -    if (j != node)
3023 -      bitmap_clear_bit (graph->zero_weight_succs[j], node);
3024 -  
3025 -  for (i =0; VEC_iterate (constraint_edge_t, predvec, i, c); i++)
3026 -    if (c->dest != node)
3027 -      {
3028 -       unsigned int place;
3029 -       struct constraint_edge lookfor;
3030 -       constraint_edge_t result;
3031 -
3032 -       lookfor.dest = node;
3033 -       place = VEC_lower_bound (constraint_edge_t, graph->succs[c->dest],
3034 -                                &lookfor, constraint_edge_less);
3035 -       result = VEC_ordered_remove (constraint_edge_t, 
3036 -                                    graph->succs[c->dest], place);
3037 -       pool_free (constraint_edge_pool, result);
3038 -
3039 -      }    
3040 -
3041 -  if (graph->zero_weight_preds[node])
3042 -    {
3043 -      BITMAP_FREE (graph->zero_weight_preds[node]);
3044 -      graph->zero_weight_preds[node] = NULL;
3045 -    } 
3046 -
3047 -  if (graph->zero_weight_succs[node])
3048 -    {
3049 -      BITMAP_FREE (graph->zero_weight_succs[node]);
3050 -      graph->zero_weight_succs[node] = NULL;
3051 -    } 
3052 -
3053 -  VEC_free (constraint_edge_t, heap, graph->preds[node]);
3054 -  VEC_free (constraint_edge_t, heap, graph->succs[node]);
3055 -  graph->preds[node] = NULL;
3056 -  graph->succs[node] = NULL;
3057 +  if (graph->succs[node])
3058 +    BITMAP_FREE (graph->succs[node]);
3059  }
3060  
3061 -static bool edge_added = false;
3062 -  
3063 -/* Add edge (src, dest) to the graph.  */
3064 -
3065 -static bool
3066 -add_graph_edge (constraint_graph_t graph, unsigned int src, unsigned int dest)
3067 -{
3068 -  unsigned int place;
3069 -  VEC(constraint_edge_t,heap) *vec;
3070 -  struct constraint_edge newe;
3071 -  newe.dest = dest;
3072 -
3073 -  vec = graph->preds[src];
3074 -  place = VEC_lower_bound (constraint_edge_t, vec, &newe, 
3075 -                          constraint_edge_less);
3076 -  if (place == VEC_length (constraint_edge_t, vec)
3077 -      || VEC_index (constraint_edge_t, vec, place)->dest != dest)
3078 -    {
3079 -      constraint_edge_t edge = new_constraint_edge (dest);
3080 -
3081 -      VEC_safe_insert (constraint_edge_t, heap, graph->preds[src], 
3082 -                      place, edge);
3083 -      edge = new_constraint_edge (src);
3084 -
3085 -      place = VEC_lower_bound (constraint_edge_t, graph->succs[dest],
3086 -                              edge, constraint_edge_less);
3087 -      VEC_safe_insert (constraint_edge_t, heap, graph->succs[dest], 
3088 -                      place, edge);
3089 -      edge_added = true;
3090 -      stats.num_edges++;
3091 -      return true;
3092 -    }
3093 -  else
3094 -    return false;
3095 -}
3096 -
3097 -
3098 -/* Return the bitmap representing the weights of edge (SRC, DEST).  */
3099 -
3100 -static bitmap *
3101 -get_graph_weights (constraint_graph_t graph, unsigned int src,
3102 -                  unsigned int dest)
3103 -{
3104 -  constraint_edge_t edge;
3105 -  VEC(constraint_edge_t,heap) *vec;
3106 -  struct constraint_edge lookfor;
3107 -
3108 -  lookfor.dest = dest;
3109 -
3110 -  vec = graph->preds[src];
3111 -  edge = constraint_edge_vec_find (vec, lookfor);
3112 -  gcc_assert (edge != NULL);
3113 -  return &edge->weights;
3114 -}
3115 -
3116 -/* Allocate graph weight bitmap for the edges associated with SRC and
3117 -   DEST in GRAPH.  Both the pred and the succ edges share a single
3118 -   bitmap, so we need to set both edges to that bitmap.  */
3119 -
3120 -static bitmap
3121 -allocate_graph_weights (constraint_graph_t graph, unsigned int src, 
3122 -                       unsigned int dest)
3123 -{
3124 -  bitmap result;
3125 -  constraint_edge_t edge;
3126 -  VEC(constraint_edge_t,heap) *vec;
3127 -  struct constraint_edge lookfor;
3128 -  
3129 -  result = BITMAP_ALLOC (&ptabitmap_obstack);
3130 -
3131 -  /* Set the pred weight.  */
3132 -  lookfor.dest = dest;
3133 -  vec = graph->preds[src];
3134 -  edge = constraint_edge_vec_find (vec, lookfor);
3135 -  gcc_assert (edge != NULL);
3136 -  edge->weights = result;
3137 -
3138 -  /* Set the succ weight.  */  
3139 -  lookfor.dest = src;
3140 -  vec = graph->succs[dest];
3141 -  edge = constraint_edge_vec_find (vec, lookfor);
3142 -  gcc_assert (edge != NULL);
3143 -  edge->weights = result;
3144 -  
3145 -  return result;  
3146 -}
3147 -
3148 -
3149  /* Merge GRAPH nodes FROM and TO into node TO.  */
3150  
3151  static void
3152 -merge_graph_nodes (constraint_graph_t graph, unsigned int to, 
3153 +merge_graph_nodes (constraint_graph_t graph, unsigned int to,
3154                    unsigned int from)
3155  {
3156 -  VEC(constraint_edge_t,heap) *succvec = graph->succs[from];
3157 -  VEC(constraint_edge_t,heap) *predvec = graph->preds[from];
3158 -  int i;
3159 -  constraint_edge_t c;
3160 -  unsigned int j;
3161 -  bitmap_iterator bi;
3162 -
3163 -  /* Merge all the zero weighted predecessor edges.  */
3164 -  if (graph->zero_weight_preds[from])
3165 +  if (graph->indirect_cycles[from] != -1)
3166      {
3167 -      if (!graph->zero_weight_preds[to])
3168 -       graph->zero_weight_preds[to] = BITMAP_ALLOC (&predbitmap_obstack);
3169 -      
3170 -      EXECUTE_IF_SET_IN_BITMAP (graph->zero_weight_preds[from], 0, j, bi)
3171 +      /* If we have indirect cycles with the from node, and we have
3172 +        none on the to node, the to node has indirect cycles from the
3173 +        from node now that they are unified.
3174 +        If indirect cycles exist on both, unify the nodes that they
3175 +        are in a cycle with, since we know they are in a cycle with
3176 +        each other.  */
3177 +      if (graph->indirect_cycles[to] == -1)
3178         {
3179 -         if (j != to)
3180 -           {
3181 -             bitmap_clear_bit (graph->zero_weight_succs[j], from);
3182 -             bitmap_set_bit (graph->zero_weight_succs[j], to);
3183 -           }
3184 +         graph->indirect_cycles[to] = graph->indirect_cycles[from];
3185         }
3186 -      bitmap_ior_into (graph->zero_weight_preds[to], 
3187 -                      graph->zero_weight_preds[from]);
3188 -    }
3189 +      else
3190 +       {
3191 +         unsigned int tonode = find (graph->indirect_cycles[to]);
3192 +         unsigned int fromnode = find (graph->indirect_cycles[from]);
3193  
3194 -  /* Merge all the zero weighted successor edges.  */
3195 -  if (graph->zero_weight_succs[from])
3196 -    {
3197 -      if (!graph->zero_weight_succs[to])
3198 -       graph->zero_weight_succs[to] = BITMAP_ALLOC (&ptabitmap_obstack);
3199 -      EXECUTE_IF_SET_IN_BITMAP (graph->zero_weight_succs[from], 0, j, bi)
3200 -       {
3201 -         bitmap_clear_bit (graph->zero_weight_preds[j], from);
3202 -         bitmap_set_bit (graph->zero_weight_preds[j], to);
3203 +         if (unite (tonode, fromnode))
3204 +           unify_nodes (graph, tonode, fromnode, true);
3205         }
3206 -      bitmap_ior_into (graph->zero_weight_succs[to], 
3207 -                      graph->zero_weight_succs[from]);
3208      }
3209  
3210 -  /* Merge all the nonzero weighted predecessor edges.  */
3211 -  for (i = 0; VEC_iterate (constraint_edge_t, predvec, i, c); i++)
3212 +  /* Merge all the successor edges.  */
3213 +  if (graph->succs[from])
3214      {
3215 -      unsigned int d = c->dest;
3216 -      bitmap temp;
3217 -      bitmap *weights;
3218 +      if (!graph->succs[to])
3219 +       graph->succs[to] = BITMAP_ALLOC (&pta_obstack);
3220 +      bitmap_ior_into (graph->succs[to],
3221 +                      graph->succs[from]);
3222 +    }
3223  
3224 -      if (c->dest == from)
3225 -       d = to;
3226 +  clear_edges_for_node (graph, from);
3227 +}
3228  
3229 -      add_graph_edge (graph, to, d);
3230  
3231 -      temp = *(get_graph_weights (graph, from, c->dest));      
3232 -      if (temp)
3233 -       {
3234 -         weights = get_graph_weights (graph, to, d);
3235 -         if (!*weights)
3236 -           *weights = allocate_graph_weights (graph, to, d);
3237 -         
3238 -         bitmap_ior_into (*weights, temp);
3239 -       }
3240 -      
3241 -    }
3242 -  
3243 -  /* Merge all the nonzero weighted successor edges.  */
3244 -  for (i = 0; VEC_iterate (constraint_edge_t, succvec, i, c); i++)
3245 -    {
3246 -      unsigned int d = c->dest;
3247 -      bitmap temp;
3248 -      bitmap *weights;
3249 +/* Add an indirect graph edge to GRAPH, going from TO to FROM if
3250 +   it doesn't exist in the graph already.  */
3251  
3252 -      if (c->dest == from)
3253 -       d = to;
3254 +static void
3255 +add_implicit_graph_edge (constraint_graph_t graph, unsigned int to,
3256 +                        unsigned int from)
3257 +{
3258 +  if (to == from)
3259 +    return;
3260  
3261 -      add_graph_edge (graph, d, to);
3262 +  if (!graph->implicit_preds[to])
3263 +    graph->implicit_preds[to] = BITMAP_ALLOC (&predbitmap_obstack);
3264  
3265 -      temp = *(get_graph_weights (graph, c->dest, from));
3266 -      if (temp)
3267 -       {
3268 -         weights = get_graph_weights (graph, d, to);
3269 -         if (!*weights)
3270 -           *weights = allocate_graph_weights (graph, d, to);
3271 -         bitmap_ior_into (*weights, temp);
3272 -       }
3273 +  if (!bitmap_bit_p (graph->implicit_preds[to], from))
3274 +    {
3275 +      stats.num_implicit_edges++;
3276 +      bitmap_set_bit (graph->implicit_preds[to], from);
3277      }
3278 -  clear_edges_for_node (graph, from);
3279  }
3280  
3281 -/* Add a graph edge to GRAPH, going from TO to FROM, with WEIGHT, if
3282 +/* Add a predecessor graph edge to GRAPH, going from TO to FROM if
3283     it doesn't exist in the graph already.
3284     Return false if the edge already existed, true otherwise.  */
3285  
3286 +static void
3287 +add_pred_graph_edge (constraint_graph_t graph, unsigned int to,
3288 +                    unsigned int from)
3289 +{
3290 +  if (!graph->preds[to])
3291 +    graph->preds[to] = BITMAP_ALLOC (&predbitmap_obstack);
3292 +  if (!bitmap_bit_p (graph->preds[to], from))
3293 +    bitmap_set_bit (graph->preds[to], from);
3294 +}
3295 +
3296 +/* Add a graph edge to GRAPH, going from FROM to TO if
3297 +   it doesn't exist in the graph already.
3298 +   Return false if the edge already existed, true otherwise.  */
3299 +
3300  static bool
3301 -int_add_graph_edge (constraint_graph_t graph, unsigned int to, 
3302 -                   unsigned int from, unsigned HOST_WIDE_INT weight)
3303 +add_graph_edge (constraint_graph_t graph, unsigned int to,
3304 +               unsigned int from)
3305  {
3306 -  if (to == from && weight == 0)
3307 +  if (to == from)
3308      {
3309        return false;
3310      }
3311 @@ -1125,41 +907,15 @@
3312      {
3313        bool r = false;
3314  
3315 -      if (weight == 0)
3316 +      if (!graph->succs[from])
3317 +       graph->succs[from] = BITMAP_ALLOC (&pta_obstack);
3318 +      if (!bitmap_bit_p (graph->succs[from], to))
3319         {
3320 -          if (!graph->zero_weight_preds[to])
3321 -           graph->zero_weight_preds[to] = BITMAP_ALLOC (&predbitmap_obstack);
3322 -          if (!graph->zero_weight_succs[from])
3323 -           graph->zero_weight_succs[from] = BITMAP_ALLOC (&ptabitmap_obstack);
3324 -         if (!bitmap_bit_p (graph->zero_weight_succs[from], to))
3325 -           {
3326 -             edge_added = true;
3327 -             r = true;
3328 -             stats.num_edges++;
3329 -             bitmap_set_bit (graph->zero_weight_preds[to], from);
3330 -             bitmap_set_bit (graph->zero_weight_succs[from], to);
3331 -           }
3332 +         r = true;
3333 +         if (to < FIRST_REF_NODE && from < FIRST_REF_NODE)
3334 +           stats.num_edges++;
3335 +         bitmap_set_bit (graph->succs[from], to);
3336         }
3337 -      else
3338 -       {
3339 -         bitmap *weights;
3340 -
3341 -         r = add_graph_edge (graph, to, from);
3342 -         weights = get_graph_weights (graph, to, from);
3343 -
3344 -         if (!*weights)
3345 -           {
3346 -             r = true;
3347 -             *weights = allocate_graph_weights (graph, to, from);
3348 -             bitmap_set_bit (*weights, weight);
3349 -           }
3350 -         else
3351 -           {
3352 -             r |= !bitmap_bit_p (*weights, weight);
3353 -             bitmap_set_bit (*weights, weight);
3354 -           }
3355 -       }
3356 -      
3357        return r;
3358      }
3359  }
3360 @@ -1168,46 +924,51 @@
3361  /* Return true if {DEST.SRC} is an existing graph edge in GRAPH.  */
3362  
3363  static bool
3364 -valid_graph_edge (constraint_graph_t graph, unsigned int src, 
3365 +valid_graph_edge (constraint_graph_t graph, unsigned int src,
3366                   unsigned int dest)
3367  {
3368 -  struct constraint_edge lookfor;
3369 -  lookfor.dest = src;
3370 -  
3371 -  return (graph->zero_weight_succs[dest] 
3372 -      && bitmap_bit_p (graph->zero_weight_succs[dest], src)) 
3373 -    || constraint_edge_vec_find (graph->succs[dest], lookfor) != NULL;
3374 +  return (graph->succs[dest]
3375 +         && bitmap_bit_p (graph->succs[dest], src));
3376  }
3377  
3378 -/* Return true if {DEST, SRC} is an existing weighted graph edge (IE has
3379 -   a weight other than 0) in GRAPH.  */
3380 -static bool
3381 -valid_weighted_graph_edge (constraint_graph_t graph, unsigned int src, 
3382 -                          unsigned int dest)
3383 -{
3384 -  struct constraint_edge lookfor;
3385 -  lookfor.dest = src;
3386 -  
3387 -  return graph->preds[src] 
3388 -    && constraint_edge_vec_find (graph->succs[dest], lookfor) != NULL;
3389 -}
3390 +/* Build the constraint graph, adding only predecessor edges right now.  */
3391  
3392 -
3393 -/* Build the constraint graph.  */
3394 -
3395  static void
3396 -build_constraint_graph (void)
3397 +build_pred_graph (void)
3398  {
3399 -  int i = 0;
3400 +  int i;
3401    constraint_t c;
3402 +  unsigned int j;
3403  
3404    graph = XNEW (struct constraint_graph);
3405 -  graph_size = VEC_length (varinfo_t, varmap) + 1;
3406 -  graph->succs = XCNEWVEC (VEC(constraint_edge_t,heap) *, graph_size);
3407 -  graph->preds = XCNEWVEC (VEC(constraint_edge_t,heap) *, graph_size);
3408 -  graph->zero_weight_succs = XCNEWVEC (bitmap, graph_size);
3409 -  graph->zero_weight_preds = XCNEWVEC (bitmap, graph_size);
3410 +  graph->size = (VEC_length (varinfo_t, varmap)) * 3;
3411 +  graph->succs = XCNEWVEC (bitmap, graph->size);
3412 +  graph->implicit_preds = XCNEWVEC (bitmap, graph->size);
3413 +  graph->preds = XCNEWVEC (bitmap, graph->size);
3414 +  graph->indirect_cycles = XNEWVEC (int, VEC_length (varinfo_t, varmap));
3415 +  graph->label = XCNEWVEC (unsigned int, graph->size);
3416 +  graph->rep = XNEWVEC (unsigned int, graph->size);
3417 +  graph->eq_rep = XNEWVEC (int, graph->size);
3418 +  graph->complex = XCNEWVEC (VEC(constraint_t, heap) *,
3419 +                            VEC_length (varinfo_t, varmap));
3420 +  graph->direct_nodes = sbitmap_alloc (graph->size);
3421 +  sbitmap_zero (graph->direct_nodes);
3422  
3423 +  for (j = 0; j < FIRST_REF_NODE; j++)
3424 +    {
3425 +      if (!get_varinfo (j)->is_special_var)
3426 +       SET_BIT (graph->direct_nodes, j);
3427 +    }
3428 +
3429 +  for (j = 0; j < graph->size; j++)
3430 +    {
3431 +      graph->rep[j] = j;
3432 +      graph->eq_rep[j] = -1;
3433 +    }
3434 +
3435 +  for (j = 0; j < VEC_length (varinfo_t, varmap); j++)
3436 +    graph->indirect_cycles[j] = -1;
3437 +
3438    for (i = 0; VEC_iterate (constraint_t, constraints, i, c); i++)
3439      {
3440        struct constraint_expr lhs = c->lhs;
3441 @@ -1217,31 +978,92 @@
3442  
3443        if (lhs.type == DEREF)
3444         {
3445 -         /* *x = y or *x = &y (complex) */
3446 -         if (rhs.type == ADDRESSOF || rhsvar > anything_id)
3447 -           insert_into_complex (lhsvar, c);
3448 +         /* *x = y.  */
3449 +         if (rhs.offset == 0 && lhs.offset == 0 && rhs.type == SCALAR)
3450 +           add_pred_graph_edge (graph, FIRST_REF_NODE + lhsvar, rhsvar);
3451 +         if (rhs.type == ADDRESSOF)
3452 +           RESET_BIT (graph->direct_nodes, rhsvar);
3453         }
3454        else if (rhs.type == DEREF)
3455         {
3456 -         /* !special var= *y */
3457 -         if (!(get_varinfo (lhsvar)->is_special_var))
3458 -           insert_into_complex (rhsvar, c);
3459 +         /* x = *y */
3460 +         if (rhs.offset == 0 && lhs.offset == 0 && lhs.type == SCALAR)
3461 +           add_pred_graph_edge (graph, lhsvar, FIRST_REF_NODE + rhsvar);
3462 +         else
3463 +           RESET_BIT (graph->direct_nodes, lhsvar);
3464         }
3465        else if (rhs.type == ADDRESSOF)
3466         {
3467           /* x = &y */
3468 +         add_pred_graph_edge (graph, lhsvar, FIRST_ADDR_NODE + rhsvar);
3469 +         /* Implicitly, *x = y */
3470 +         add_implicit_graph_edge (graph, FIRST_REF_NODE + lhsvar, rhsvar);
3471 +
3472 +         RESET_BIT (graph->direct_nodes, rhsvar);
3473 +       }
3474 +      else if (lhsvar > anything_id
3475 +              && lhsvar != rhsvar && lhs.offset == 0 && rhs.offset == 0)
3476 +       {
3477 +         /* x = y */
3478 +         add_pred_graph_edge (graph, lhsvar, rhsvar);
3479 +         /* Implicitly, *x = *y */
3480 +         add_implicit_graph_edge (graph, FIRST_REF_NODE + lhsvar,
3481 +                                  FIRST_REF_NODE + rhsvar);
3482 +       }
3483 +      else if (lhs.offset != 0 || rhs.offset != 0)
3484 +       {
3485 +         if (rhs.offset != 0)
3486 +           RESET_BIT (graph->direct_nodes, lhs.var);
3487 +         if (lhs.offset != 0)
3488 +           RESET_BIT (graph->direct_nodes, rhs.var);
3489 +       }
3490 +    }
3491 +}
3492 +
3493 +/* Build the constraint graph, adding successor edges.  */
3494 +
3495 +static void
3496 +build_succ_graph (void)
3497 +{
3498 +  int i;
3499 +  constraint_t c;
3500 +
3501 +  for (i = 0; VEC_iterate (constraint_t, constraints, i, c); i++)
3502 +    {
3503 +      struct constraint_expr lhs;
3504 +      struct constraint_expr rhs;
3505 +      unsigned int lhsvar;
3506 +      unsigned int rhsvar;
3507 +
3508 +      if (!c)
3509 +       continue;
3510 +
3511 +      lhs = c->lhs;
3512 +      rhs = c->rhs;
3513 +      lhsvar = find (get_varinfo_fc (lhs.var)->id);
3514 +      rhsvar = find (get_varinfo_fc (rhs.var)->id);
3515 +
3516 +      if (lhs.type == DEREF)
3517 +       {
3518 +         if (rhs.offset == 0 && lhs.offset == 0 && rhs.type == SCALAR)
3519 +           add_graph_edge (graph, FIRST_REF_NODE + lhsvar, rhsvar);
3520 +       }
3521 +      else if (rhs.type == DEREF)
3522 +       {
3523 +         if (rhs.offset == 0 && lhs.offset == 0 && lhs.type == SCALAR)
3524 +           add_graph_edge (graph, lhsvar, FIRST_REF_NODE + rhsvar);
3525 +       }
3526 +      else if (rhs.type == ADDRESSOF)
3527 +       {
3528 +         /* x = &y */
3529 +         gcc_assert (find (get_varinfo_fc (rhs.var)->id)
3530 +                     == get_varinfo_fc (rhs.var)->id);
3531           bitmap_set_bit (get_varinfo (lhsvar)->solution, rhsvar);
3532         }
3533 -      else if (lhsvar > anything_id)
3534 +      else if (lhsvar > anything_id
3535 +              && lhsvar != rhsvar && lhs.offset == 0 && rhs.offset == 0)
3536         {
3537 -         /* Ignore 0 weighted self edges, as they can't possibly contribute
3538 -            anything */
3539 -         if (lhsvar != rhsvar || rhs.offset != 0 || lhs.offset != 0)
3540 -           {
3541 -             /* x = y (simple) */
3542 -             int_add_graph_edge (graph, lhs.var, rhs.var, rhs.offset);
3543 -           }
3544 -         
3545 +         add_graph_edge (graph, lhsvar, rhsvar);
3546         }
3547      }
3548  }
3549 @@ -1260,20 +1082,20 @@
3550  struct scc_info
3551  {
3552    sbitmap visited;
3553 -  sbitmap in_component;
3554 +  sbitmap roots;
3555 +  unsigned int *dfs;
3556 +  unsigned int *node_mapping;
3557    int current_index;
3558 -  unsigned int *visited_index;
3559    VEC(unsigned,heap) *scc_stack;
3560 -  VEC(unsigned,heap) *unification_queue;
3561  };
3562  
3563  
3564  /* Recursive routine to find strongly connected components in GRAPH.
3565     SI is the SCC info to store the information in, and N is the id of current
3566     graph node we are processing.
3567 -   
3568 +
3569     This is Tarjan's strongly connected component finding algorithm, as
3570 -   modified by Nuutila to keep only non-root nodes on the stack.  
3571 +   modified by Nuutila to keep only non-root nodes on the stack.
3572     The algorithm can be found in "On finding the strongly connected
3573     connected components in a directed graph" by Esko Nuutila and Eljas
3574     Soisalon-Soininen, in Information Processing Letters volume 49,
3575 @@ -1284,188 +1106,144 @@
3576  {
3577    unsigned int i;
3578    bitmap_iterator bi;
3579 +  unsigned int my_dfs;
3580  
3581 -  gcc_assert (get_varinfo (n)->node == n);
3582    SET_BIT (si->visited, n);
3583 -  RESET_BIT (si->in_component, n);
3584 -  si->visited_index[n] = si->current_index ++;
3585 -  
3586 +  si->dfs[n] = si->current_index ++;
3587 +  my_dfs = si->dfs[n];
3588 +
3589    /* Visit all the successors.  */
3590 -  EXECUTE_IF_IN_NONNULL_BITMAP (graph->zero_weight_succs[n], 0, i, bi)
3591 +  EXECUTE_IF_IN_NONNULL_BITMAP (graph->succs[n], 0, i, bi)
3592      {
3593 -      unsigned int w = i;
3594 +      unsigned int w;
3595 +
3596 +      if (i > LAST_REF_NODE)
3597 +       break;
3598 +
3599 +      w = find (i);
3600 +      if (TEST_BIT (si->roots, w))
3601 +       continue;
3602 +
3603        if (!TEST_BIT (si->visited, w))
3604         scc_visit (graph, si, w);
3605 -      if (!TEST_BIT (si->in_component, w))
3606 -       {
3607 -         unsigned int t = get_varinfo (w)->node;
3608 -         unsigned int nnode = get_varinfo (n)->node;
3609 -         if (si->visited_index[t] < si->visited_index[nnode])
3610 -           get_varinfo (n)->node = t;
3611 -       }
3612 +      {
3613 +       unsigned int t = find (w);
3614 +       unsigned int nnode = find (n);
3615 +       gcc_assert (nnode == n);
3616 +
3617 +       if (si->dfs[t] < si->dfs[nnode])
3618 +         si->dfs[n] = si->dfs[t];
3619 +      }
3620      }
3621 -  
3622 +
3623    /* See if any components have been identified.  */
3624 -  if (get_varinfo (n)->node == n)
3625 +  if (si->dfs[n] == my_dfs)
3626      {
3627 -      unsigned int t = si->visited_index[n];
3628 -      SET_BIT (si->in_component, n);
3629 -      while (VEC_length (unsigned, si->scc_stack) != 0 
3630 -            && t < si->visited_index[VEC_last (unsigned, si->scc_stack)])
3631 +      if (VEC_length (unsigned, si->scc_stack) > 0
3632 +         && si->dfs[VEC_last (unsigned, si->scc_stack)] >= my_dfs)
3633         {
3634 -         unsigned int w = VEC_pop (unsigned, si->scc_stack);
3635 -         get_varinfo (w)->node = n;
3636 -         SET_BIT (si->in_component, w);
3637 -         /* Mark this node for collapsing.  */
3638 -         VEC_safe_push (unsigned, heap, si->unification_queue, w);
3639 -       } 
3640 -    }
3641 -  else
3642 -    VEC_safe_push (unsigned, heap, si->scc_stack, n);
3643 -}
3644 +         bitmap scc = BITMAP_ALLOC (NULL);
3645 +         bool have_ref_node = n >= FIRST_REF_NODE;
3646 +         unsigned int lowest_node;
3647 +         bitmap_iterator bi;
3648  
3649 +         bitmap_set_bit (scc, n);
3650  
3651 -/* Collapse two variables into one variable.  */
3652 +         while (VEC_length (unsigned, si->scc_stack) != 0
3653 +                && si->dfs[VEC_last (unsigned, si->scc_stack)] >= my_dfs)
3654 +           {
3655 +             unsigned int w = VEC_pop (unsigned, si->scc_stack);
3656  
3657 -static void
3658 -collapse_nodes (constraint_graph_t graph, unsigned int to, unsigned int from)
3659 -{
3660 -  bitmap tosol, fromsol;
3661 +             bitmap_set_bit (scc, w);
3662 +             if (w >= FIRST_REF_NODE)
3663 +               have_ref_node = true;
3664 +           }
3665  
3666 -  condense_varmap_nodes (to, from);
3667 -  tosol = get_varinfo (to)->solution;
3668 -  fromsol = get_varinfo (from)->solution;
3669 -  bitmap_ior_into (tosol, fromsol);
3670 -  merge_graph_nodes (graph, to, from);
3671 -
3672 -  if (valid_graph_edge (graph, to, to))
3673 -    {
3674 -      if (graph->zero_weight_preds[to])
3675 -       {
3676 -         bitmap_clear_bit (graph->zero_weight_preds[to], to);
3677 -         bitmap_clear_bit (graph->zero_weight_succs[to], to);
3678 +         lowest_node = bitmap_first_set_bit (scc);
3679 +         gcc_assert (lowest_node < FIRST_REF_NODE);
3680 +         EXECUTE_IF_SET_IN_BITMAP (scc, 0, i, bi)
3681 +           {
3682 +             if (i < FIRST_REF_NODE)
3683 +               {
3684 +                 /* Mark this node for collapsing.  */
3685 +                 if (unite (lowest_node, i))
3686 +                   unify_nodes (graph, lowest_node, i, false);
3687 +               }
3688 +             else
3689 +               {
3690 +                 unite (lowest_node, i);
3691 +                 graph->indirect_cycles[i - FIRST_REF_NODE] = lowest_node;
3692 +               }
3693 +           }
3694         }
3695 -      if (valid_weighted_graph_edge (graph, to, to))
3696 -       {
3697 -         bitmap weights = *(get_graph_weights (graph, to, to));
3698 -         if (!weights || bitmap_empty_p (weights))
3699 -           erase_graph_self_edge (graph, to);
3700 -       }
3701 +      SET_BIT (si->roots, n);
3702      }
3703 -  BITMAP_FREE (fromsol);
3704 -  get_varinfo (to)->address_taken |= get_varinfo (from)->address_taken;
3705 -  get_varinfo (to)->indirect_target |= get_varinfo (from)->indirect_target;
3706 +  else
3707 +    VEC_safe_push (unsigned, heap, si->scc_stack, n);
3708  }
3709  
3710 +/* Unify node FROM into node TO, updating the changed count if
3711 +   necessary when UPDATE_CHANGED is true.  */
3712  
3713 -/* Unify nodes in GRAPH that we have found to be part of a cycle.
3714 -   SI is the Strongly Connected Components information structure that tells us
3715 -   what components to unify.
3716 -   UPDATE_CHANGED should be set to true if the changed sbitmap and changed
3717 -   count should be updated to reflect the unification.  */
3718 -
3719  static void
3720 -process_unification_queue (constraint_graph_t graph, struct scc_info *si,
3721 -                          bool update_changed)
3722 +unify_nodes (constraint_graph_t graph, unsigned int to, unsigned int from,
3723 +            bool update_changed)
3724  {
3725 -  size_t i = 0;
3726 -  bitmap tmp = BITMAP_ALLOC (update_changed ? &iteration_obstack : NULL);
3727 -  bitmap_clear (tmp);
3728  
3729 -  /* We proceed as follows:
3730 +  gcc_assert (to != from && find (to) == to);
3731 +  if (dump_file && (dump_flags & TDF_DETAILS))
3732 +    fprintf (dump_file, "Unifying %s to %s\n",
3733 +            get_varinfo (from)->name,
3734 +            get_varinfo (to)->name);
3735  
3736 -     For each component in the queue (components are delineated by
3737 -     when current_queue_element->node != next_queue_element->node):
3738 +  if (update_changed)
3739 +    stats.unified_vars_dynamic++;
3740 +  else
3741 +    stats.unified_vars_static++;
3742  
3743 -        rep = representative node for component
3744 +  merge_graph_nodes (graph, to, from);
3745 +  merge_node_constraints (graph, to, from);
3746  
3747 -        For each node (tounify) to be unified in the component,
3748 -           merge the solution for tounify into tmp bitmap
3749 -
3750 -           clear solution for tounify
3751 -
3752 -           merge edges from tounify into rep
3753 -
3754 -          merge complex constraints from tounify into rep
3755 -
3756 -          update changed count to note that tounify will never change
3757 -          again
3758 -
3759 -       Merge tmp into solution for rep, marking rep changed if this
3760 -       changed rep's solution.
3761 -       
3762 -       Delete any 0 weighted self-edges we now have for rep.  */
3763 -  while (i != VEC_length (unsigned, si->unification_queue))
3764 +  if (update_changed && TEST_BIT (changed, from))
3765      {
3766 -      unsigned int tounify = VEC_index (unsigned, si->unification_queue, i);
3767 -      unsigned int n = get_varinfo (tounify)->node;
3768 -
3769 -      if (dump_file && (dump_flags & TDF_DETAILS))
3770 -       fprintf (dump_file, "Unifying %s to %s\n", 
3771 -                get_varinfo (tounify)->name,
3772 -                get_varinfo (n)->name);
3773 -      if (update_changed)
3774 -       stats.unified_vars_dynamic++;
3775 +      RESET_BIT (changed, from);
3776 +      if (!TEST_BIT (changed, to))
3777 +       SET_BIT (changed, to);
3778        else
3779 -       stats.unified_vars_static++;
3780 -      bitmap_ior_into (tmp, get_varinfo (tounify)->solution);
3781 -      merge_graph_nodes (graph, n, tounify);
3782 -      condense_varmap_nodes (n, tounify);
3783 -      
3784 -      if (update_changed && TEST_BIT (changed, tounify))
3785         {
3786 -         RESET_BIT (changed, tounify);
3787 -         if (!TEST_BIT (changed, n))
3788 -           SET_BIT (changed, n);
3789 -         else
3790 -           {
3791 -             gcc_assert (changed_count > 0);
3792 -             changed_count--;
3793 -           }
3794 +         gcc_assert (changed_count > 0);
3795 +         changed_count--;
3796         }
3797 +    }
3798  
3799 -      bitmap_clear (get_varinfo (tounify)->solution);
3800 -      ++i;
3801 -
3802 -      /* If we've either finished processing the entire queue, or
3803 -        finished processing all nodes for component n, update the solution for
3804 -        n.  */
3805 -      if (i == VEC_length (unsigned, si->unification_queue)
3806 -         || get_varinfo (VEC_index (unsigned, si->unification_queue, i))->node != n)
3807 +  /* If the solution changes because of the merging, we need to mark
3808 +     the variable as changed.  */
3809 +  if (bitmap_ior_into (get_varinfo (to)->solution,
3810 +                      get_varinfo (from)->solution))
3811 +    {
3812 +      if (update_changed && !TEST_BIT (changed, to))
3813         {
3814 -         /* If the solution changes because of the merging, we need to mark
3815 -            the variable as changed.  */
3816 -         if (bitmap_ior_into (get_varinfo (n)->solution, tmp))
3817 -           {
3818 -             if (update_changed && !TEST_BIT (changed, n))
3819 -               {
3820 -                 SET_BIT (changed, n);
3821 -                 changed_count++;
3822 -               }
3823 -           }
3824 -         bitmap_clear (tmp);
3825 -
3826 -         if (valid_graph_edge (graph, n, n))
3827 -           {
3828 -             if (graph->zero_weight_succs[n])
3829 -               {
3830 -                 if (graph->zero_weight_preds[n])
3831 -                   bitmap_clear_bit (graph->zero_weight_preds[n], n);
3832 -                 bitmap_clear_bit (graph->zero_weight_succs[n], n);
3833 -               }
3834 -             if (valid_weighted_graph_edge (graph, n, n))
3835 -               {
3836 -                 bitmap weights = *(get_graph_weights (graph, n, n));
3837 -                 if (!weights || bitmap_empty_p (weights))
3838 -                   erase_graph_self_edge (graph, n);
3839 -               }
3840 -           }
3841 +         SET_BIT (changed, to);
3842 +         changed_count++;
3843         }
3844      }
3845 -  BITMAP_FREE (tmp);
3846 +
3847 +  BITMAP_FREE (get_varinfo (from)->solution);
3848 +  BITMAP_FREE (get_varinfo (from)->oldsolution);
3849 +
3850 +  if (stats.iterations > 0)
3851 +    {
3852 +      BITMAP_FREE (get_varinfo (to)->oldsolution);
3853 +      get_varinfo (to)->oldsolution = BITMAP_ALLOC (&oldpta_obstack);
3854 +    }
3855 +
3856 +  if (valid_graph_edge (graph, to, to))
3857 +    {
3858 +      if (graph->succs[to])
3859 +       bitmap_clear_bit (graph->succs[to], to);
3860 +    }
3861  }
3862  
3863 -
3864  /* Information needed to compute the topological ordering of a graph.  */
3865  
3866  struct topo_info
3867 @@ -1509,37 +1287,24 @@
3868  topo_visit (constraint_graph_t graph, struct topo_info *ti,
3869             unsigned int n)
3870  {
3871 -  VEC(constraint_edge_t,heap) *succs = graph->succs[n];
3872 -  bitmap temp;
3873    bitmap_iterator bi;
3874 -  constraint_edge_t c;
3875 -  int i;
3876    unsigned int j;
3877  
3878    SET_BIT (ti->visited, n);
3879 -  if (VEC_length (constraint_edge_t, succs) != 0)
3880 -    {
3881 -      temp = BITMAP_ALLOC (&iteration_obstack);
3882 -      if (graph->zero_weight_succs[n])
3883 -       bitmap_ior_into (temp, graph->zero_weight_succs[n]);
3884 -      for (i = 0; VEC_iterate (constraint_edge_t, succs, i, c); i++)
3885 -       bitmap_set_bit (temp, c->dest);
3886 -    }
3887 -  else 
3888 -    temp = graph->zero_weight_succs[n];
3889  
3890 -  if (temp) 
3891 -    EXECUTE_IF_SET_IN_BITMAP (temp, 0, j, bi)
3892 +  if (graph->succs[n])
3893 +    EXECUTE_IF_SET_IN_BITMAP (graph->succs[n], 0, j, bi)
3894        {
3895         if (!TEST_BIT (ti->visited, j))
3896           topo_visit (graph, ti, j);
3897        }
3898 +
3899    VEC_safe_push (unsigned, heap, ti->topo_order, n);
3900  }
3901  
3902  /* Return true if variable N + OFFSET is a legal field of N.  */
3903  
3904 -static bool 
3905 +static bool
3906  type_safe (unsigned int n, unsigned HOST_WIDE_INT *offset)
3907  {
3908    varinfo_t ninfo = get_varinfo (n);
3909 @@ -1582,10 +1347,10 @@
3910           v = first_vi_for_offset (get_varinfo (j), fieldoffset);
3911           if (!v)
3912             continue;
3913 -         t = v->node;
3914 +         t = find (v->id);
3915           sol = get_varinfo (t)->solution;
3916           if (!bitmap_bit_p (sol, rhs))
3917 -           {             
3918 +           {
3919               bitmap_set_bit (sol, rhs);
3920               if (!TEST_BIT (changed, t))
3921                 {
3922 @@ -1596,7 +1361,7 @@
3923         }
3924        else if (0 && dump_file && !(get_varinfo (j)->is_special_var))
3925         fprintf (dump_file, "Untypesafe usage in do_da_constraint.\n");
3926 -      
3927 +
3928      }
3929  }
3930  
3931 @@ -1607,7 +1372,7 @@
3932  do_sd_constraint (constraint_graph_t graph, constraint_t c,
3933                   bitmap delta)
3934  {
3935 -  unsigned int lhs = get_varinfo (c->lhs.var)->node;
3936 +  unsigned int lhs = find (c->lhs.var);
3937    bool flag = false;
3938    bitmap sol = get_varinfo (lhs)->solution;
3939    unsigned int j;
3940 @@ -1620,7 +1385,7 @@
3941         bitmap_set_bit (sol, anything_id);
3942       goto done;
3943     }
3944 -  /* For each variable j in delta (Sol(y)), add    
3945 +  /* For each variable j in delta (Sol(y)), add
3946       an edge in the graph from j to x, and union Sol(j) into Sol(x).  */
3947    EXECUTE_IF_SET_IN_BITMAP (delta, 0, j, bi)
3948      {
3949 @@ -1634,18 +1399,18 @@
3950           v = first_vi_for_offset (get_varinfo (j), fieldoffset);
3951           if (!v)
3952             continue;
3953 -         t = v->node;
3954 +         t = find (v->id);
3955  
3956           /* Adding edges from the special vars is pointless.
3957              They don't have sets that can change.  */
3958           if (get_varinfo (t) ->is_special_var)
3959             flag |= bitmap_ior_into (sol, get_varinfo (t)->solution);
3960 -         else if (int_add_graph_edge (graph, lhs, t, 0))
3961 +         else if (add_graph_edge (graph, lhs, t))
3962             flag |= bitmap_ior_into (sol, get_varinfo (t)->solution);
3963         }
3964        else if (0 && dump_file && !(get_varinfo (j)->is_special_var))
3965         fprintf (dump_file, "Untypesafe usage in do_sd_constraint\n");
3966 -      
3967 +
3968      }
3969  
3970  done:
3971 @@ -1658,15 +1423,15 @@
3972           SET_BIT (changed, lhs);
3973           changed_count++;
3974         }
3975 -    }    
3976 +    }
3977  }
3978  
3979  /* Process a constraint C that represents *x = y.  */
3980  
3981  static void
3982 -do_ds_constraint (constraint_graph_t graph, constraint_t c, bitmap delta)
3983 +do_ds_constraint (constraint_t c, bitmap delta)
3984  {
3985 -  unsigned int rhs = get_varinfo (c->rhs.var)->node;
3986 +  unsigned int rhs = find (c->rhs.var);
3987    unsigned HOST_WIDE_INT roff = c->rhs.offset;
3988    bitmap sol = get_varinfo (rhs)->solution;
3989    unsigned int j;
3990 @@ -1685,8 +1450,8 @@
3991          v = first_vi_for_offset (get_varinfo (j), fieldoffset);
3992          if (!v)
3993            continue;
3994 -        t = v->node;
3995 -        
3996 +        t = find (v->id);
3997 +
3998          if (!bitmap_bit_p (get_varinfo (t)->solution, anything_id))
3999            {
4000              bitmap_set_bit (get_varinfo (t)->solution, anything_id);
4001 @@ -1705,40 +1470,39 @@
4002    EXECUTE_IF_SET_IN_BITMAP (delta, 0, j, bi)
4003      {
4004        unsigned HOST_WIDE_INT loff = c->lhs.offset;
4005 -      if (type_safe (j, &loff) && !(get_varinfo(j)->is_special_var))
4006 +      if (type_safe (j, &loff) && !(get_varinfo (j)->is_special_var))
4007         {
4008           varinfo_t v;
4009           unsigned int t;
4010           unsigned HOST_WIDE_INT fieldoffset = get_varinfo (j)->offset + loff;
4011 +         bitmap tmp;
4012  
4013           v = first_vi_for_offset (get_varinfo (j), fieldoffset);
4014           if (!v)
4015             continue;
4016 -         t = v->node;
4017 -         if (int_add_graph_edge (graph, t, rhs, roff))
4018 +         t = find (v->id);
4019 +         tmp = get_varinfo (t)->solution;
4020 +
4021 +         if (set_union_with_increment (tmp, sol, roff))
4022             {
4023 -             bitmap tmp = get_varinfo (t)->solution;
4024 -             if (set_union_with_increment (tmp, sol, roff))
4025 +             get_varinfo (t)->solution = tmp;
4026 +             if (t == rhs)
4027 +               sol = get_varinfo (rhs)->solution;
4028 +             if (!TEST_BIT (changed, t))
4029                 {
4030 -                 get_varinfo (t)->solution = tmp;
4031 -                 if (t == rhs)
4032 -                   sol = get_varinfo (rhs)->solution;
4033 -                 if (!TEST_BIT (changed, t))
4034 -                   {
4035 -                     SET_BIT (changed, t);
4036 -                     changed_count++;
4037 -                   }
4038 +                 SET_BIT (changed, t);
4039 +                 changed_count++;
4040                 }
4041             }
4042 -       }    
4043 +       }
4044        else if (0 && dump_file && !(get_varinfo (j)->is_special_var))
4045         fprintf (dump_file, "Untypesafe usage in do_ds_constraint\n");
4046      }
4047  }
4048  
4049 -/* Handle a non-simple (simple meaning requires no iteration), non-copy
4050 -   constraint (IE *x = &y, x = *y, and *x = y).  */
4051 -   
4052 +/* Handle a non-simple (simple meaning requires no iteration),
4053 +   constraint (IE *x = &y, x = *y, *x = y, and x = y with offsets involved).  */
4054 +
4055  static void
4056  do_complex_constraint (constraint_graph_t graph, constraint_t c, bitmap delta)
4057  {
4058 @@ -1752,33 +1516,62 @@
4059        else
4060         {
4061           /* *x = y */
4062 -         do_ds_constraint (graph, c, delta);
4063 +         do_ds_constraint (c, delta);
4064         }
4065      }
4066 -  else
4067 +  else if (c->rhs.type == DEREF)
4068      {
4069        /* x = *y */
4070        if (!(get_varinfo (c->lhs.var)->is_special_var))
4071         do_sd_constraint (graph, c, delta);
4072      }
4073 +  else
4074 +    {
4075 +      bitmap tmp;
4076 +      bitmap solution;
4077 +      bool flag = false;
4078 +      unsigned int t;
4079 +
4080 +      gcc_assert (c->rhs.type == SCALAR && c->lhs.type == SCALAR);
4081 +      t = find (c->rhs.var);
4082 +      solution = get_varinfo (t)->solution;
4083 +      t = find (c->lhs.var);
4084 +      tmp = get_varinfo (t)->solution;
4085 +
4086 +      flag = set_union_with_increment (tmp, solution, c->rhs.offset);
4087 +
4088 +      if (flag)
4089 +       {
4090 +         get_varinfo (t)->solution = tmp;
4091 +         if (!TEST_BIT (changed, t))
4092 +           {
4093 +             SET_BIT (changed, t);
4094 +             changed_count++;
4095 +           }
4096 +       }
4097 +    }
4098  }
4099  
4100  /* Initialize and return a new SCC info structure.  */
4101  
4102  static struct scc_info *
4103 -init_scc_info (void)
4104 +init_scc_info (size_t size)
4105  {
4106    struct scc_info *si = XNEW (struct scc_info);
4107 -  size_t size = VEC_length (varinfo_t, varmap);
4108 +  size_t i;
4109  
4110    si->current_index = 0;
4111    si->visited = sbitmap_alloc (size);
4112    sbitmap_zero (si->visited);
4113 -  si->in_component = sbitmap_alloc (size);
4114 -  sbitmap_ones (si->in_component);
4115 -  si->visited_index = XCNEWVEC (unsigned int, size + 1);
4116 +  si->roots = sbitmap_alloc (size);
4117 +  sbitmap_zero (si->roots);
4118 +  si->node_mapping = XNEWVEC (unsigned int, size);
4119 +  si->dfs = XCNEWVEC (unsigned int, size);
4120 +
4121 +  for (i = 0; i < size; i++)
4122 +    si->node_mapping[i] = i;
4123 +
4124    si->scc_stack = VEC_alloc (unsigned, heap, 1);
4125 -  si->unification_queue = VEC_alloc (unsigned, heap, 1);
4126    return si;
4127  }
4128  
4129 @@ -1786,209 +1579,430 @@
4130  
4131  static void
4132  free_scc_info (struct scc_info *si)
4133 -{  
4134 +{
4135    sbitmap_free (si->visited);
4136 -  sbitmap_free (si->in_component);
4137 -  free (si->visited_index);
4138 +  sbitmap_free (si->roots);
4139 +  free (si->node_mapping);
4140 +  free (si->dfs);
4141    VEC_free (unsigned, heap, si->scc_stack);
4142 -  VEC_free (unsigned, heap, si->unification_queue);
4143 -  free(si); 
4144 +  free (si);
4145  }
4146  
4147  
4148 -/* Find cycles in GRAPH that occur, using strongly connected components, and
4149 -   collapse the cycles into a single representative node.  if UPDATE_CHANGED
4150 -   is true, then update the changed sbitmap to note those nodes whose
4151 -   solutions have changed as a result of collapsing.  */
4152 +/* Find indirect cycles in GRAPH that occur, using strongly connected
4153 +   components, and note them in the indirect cycles map.
4154  
4155 +   This technique comes from Ben Hardekopf and Calvin Lin,
4156 +   "It Pays to be Lazy: Fast and Accurate Pointer Analysis for Millions of
4157 +   Lines of Code", submitted to PLDI 2007.  */
4158 +
4159  static void
4160 -find_and_collapse_graph_cycles (constraint_graph_t graph, bool update_changed)
4161 +find_indirect_cycles (constraint_graph_t graph)
4162  {
4163    unsigned int i;
4164 -  unsigned int size = VEC_length (varinfo_t, varmap);
4165 -  struct scc_info *si = init_scc_info ();
4166 +  unsigned int size = graph->size;
4167 +  struct scc_info *si = init_scc_info (size);
4168  
4169 -  for (i = 0; i != size; ++i)
4170 -    if (!TEST_BIT (si->visited, i) && get_varinfo (i)->node == i)
4171 +  for (i = 0; i < MIN (LAST_REF_NODE, size); i ++ )
4172 +    if (!TEST_BIT (si->visited, i) && find (i) == i)
4173        scc_visit (graph, si, i);
4174 -  
4175 -  process_unification_queue (graph, si, update_changed);
4176 +
4177    free_scc_info (si);
4178  }
4179  
4180  /* Compute a topological ordering for GRAPH, and store the result in the
4181     topo_info structure TI.  */
4182  
4183 -static void 
4184 +static void
4185  compute_topo_order (constraint_graph_t graph,
4186                     struct topo_info *ti)
4187  {
4188    unsigned int i;
4189    unsigned int size = VEC_length (varinfo_t, varmap);
4190 -  
4191 +
4192    for (i = 0; i != size; ++i)
4193 -    if (!TEST_BIT (ti->visited, i) && get_varinfo (i)->node == i)
4194 +    if (!TEST_BIT (ti->visited, i) && find (i) == i)
4195        topo_visit (graph, ti, i);
4196  }
4197  
4198 -/* Return true if bitmap B is empty, or a bitmap other than bit 0 is set. */
4199 +/* Perform offline variable substitution.
4200  
4201 -static bool
4202 -bitmap_other_than_zero_bit_set (bitmap b)
4203 -{
4204 -  unsigned int i;
4205 -  bitmap_iterator bi;
4206 -
4207 -  if (bitmap_empty_p (b))
4208 -    return false;
4209 -  EXECUTE_IF_SET_IN_BITMAP (b, 1, i, bi)
4210 -    return true;
4211 -  return false;
4212 -}
4213 -
4214 -/* Perform offline variable substitution.
4215 -   
4216     This is a linear time way of identifying variables that must have
4217     equivalent points-to sets, including those caused by static cycles,
4218     and single entry subgraphs, in the constraint graph.
4219  
4220     The technique is described in "Off-line variable substitution for
4221     scaling points-to analysis" by Atanas Rountev and Satish Chandra,
4222 -   in "ACM SIGPLAN Notices" volume 35, number 5, pages 47-56.  */
4223 +   in "ACM SIGPLAN Notices" volume 35, number 5, pages 47-56.
4224  
4225 +   There is an optimal way to do this involving hash based value
4226 +   numbering, once the technique is published i will implement it
4227 +   here.  
4228 +
4229 +   The general method of finding equivalence classes is as follows:
4230 +   Add fake nodes (REF nodes) and edges for *a = b and a = *b constraints.
4231 +   Add fake nodes (ADDRESS nodes) and edges for a = &b constraints.
4232 +   Initialize all non-REF/ADDRESS nodes to be direct nodes
4233 +   For each SCC in the predecessor graph:
4234 +      for each member (x) of the SCC
4235 +         if x is not a direct node:
4236 +          set rootnode(SCC) to be not a direct node
4237 +        collapse node x into rootnode(SCC).
4238 +      if rootnode(SCC) is not a direct node:
4239 +        label rootnode(SCC) with a new equivalence class
4240 +      else:
4241 +        if all labeled predecessors of rootnode(SCC) have the same
4242 +       label:
4243 +         label rootnode(SCC) with this label
4244 +       else:
4245 +         label rootnode(SCC) with a new equivalence class
4246 +
4247 +   All direct nodes with the same equivalence class can be replaced
4248 +   with a single representative node.
4249 +   All unlabeled nodes (label == 0) are not pointers and all edges
4250 +   involving them can be eliminated.
4251 +   We perform these optimizations during move_complex_constraints.
4252 +*/
4253 +
4254 +static int equivalence_class;
4255 +
4256 +/* Recursive routine to find strongly connected components in GRAPH,
4257 +   and label it's nodes with equivalence classes.
4258 +   This is used during variable substitution to find cycles involving
4259 +   the regular or implicit predecessors, and label them as equivalent.
4260 +   The SCC finding algorithm used is the same as that for scc_visit.  */
4261 +
4262  static void
4263 -perform_var_substitution (constraint_graph_t graph)
4264 +label_visit (constraint_graph_t graph, struct scc_info *si, unsigned int n)
4265  {
4266 -  struct topo_info *ti = init_topo_info ();
4267
4268 -  bitmap_obstack_initialize (&iteration_obstack);
4269 -  /* Compute the topological ordering of the graph, then visit each
4270 -     node in topological order.  */
4271 -  compute_topo_order (graph, ti);
4272
4273 -  while (VEC_length (unsigned, ti->topo_order) != 0)
4274 +  unsigned int i;
4275 +  bitmap_iterator bi;
4276 +  unsigned int my_dfs;
4277 +
4278 +  gcc_assert (si->node_mapping[n] == n);
4279 +  SET_BIT (si->visited, n);
4280 +  si->dfs[n] = si->current_index ++;
4281 +  my_dfs = si->dfs[n];
4282 +
4283 +  /* Visit all the successors.  */
4284 +  EXECUTE_IF_IN_NONNULL_BITMAP (graph->preds[n], 0, i, bi)
4285      {
4286 -      unsigned int i = VEC_pop (unsigned, ti->topo_order);
4287 -      unsigned int pred;
4288 -      varinfo_t vi = get_varinfo (i);
4289 -      bool okay_to_elim = false;
4290 -      unsigned int root = VEC_length (varinfo_t, varmap);
4291 -      VEC(constraint_edge_t,heap) *predvec = graph->preds[i];
4292 -      constraint_edge_t ce = NULL;
4293 -      bitmap tmp;
4294 -      unsigned int k;
4295 -      bitmap_iterator bi;
4296 +      unsigned int w = si->node_mapping[i];
4297  
4298 -      /* We can't eliminate things whose address is taken, or which is
4299 -        the target of a dereference.  */
4300 -      if (vi->address_taken || vi->indirect_target)
4301 +      if (TEST_BIT (si->roots, w))
4302         continue;
4303  
4304 -      /* See if all predecessors of I are ripe for elimination */
4305 -      EXECUTE_IF_IN_NONNULL_BITMAP (graph->zero_weight_preds[i], 0, k, bi)
4306 -         {
4307 -           unsigned int w;
4308 -           w = get_varinfo (k)->node;
4309 +      if (!TEST_BIT (si->visited, w))
4310 +       label_visit (graph, si, w);
4311 +      {
4312 +       unsigned int t = si->node_mapping[w];
4313 +       unsigned int nnode = si->node_mapping[n];
4314 +       gcc_assert (nnode == n);
4315  
4316 -           /* We can't eliminate the node if one of the predecessors is
4317 -              part of a different strongly connected component.  */
4318 -           if (!okay_to_elim)
4319 -             {
4320 -               root = w;
4321 -               okay_to_elim = true;
4322 -             }
4323 -           else if (w != root)
4324 -             {
4325 -               okay_to_elim = false;
4326 -               break;
4327 -             }
4328 +       if (si->dfs[t] < si->dfs[nnode])
4329 +         si->dfs[n] = si->dfs[t];
4330 +      }
4331 +    }
4332  
4333 -           /* Theorem 4 in Rountev and Chandra: If i is a direct node,
4334 -              then Solution(i) is a subset of Solution (w), where w is a
4335 -              predecessor in the graph.  
4336 -              Corollary: If all predecessors of i have the same
4337 -              points-to set, then i has that same points-to set as
4338 -              those predecessors.  */
4339 -           tmp = BITMAP_ALLOC (NULL);
4340 -           bitmap_and_compl (tmp, get_varinfo (i)->solution,
4341 -                             get_varinfo (w)->solution);
4342 -           if (!bitmap_empty_p (tmp))
4343 -             {
4344 -               okay_to_elim = false;
4345 -               BITMAP_FREE (tmp);
4346 -               break;
4347 -             }
4348 -           BITMAP_FREE (tmp);
4349 -         }
4350 +  /* Visit all the implicit predecessors.  */
4351 +  EXECUTE_IF_IN_NONNULL_BITMAP (graph->implicit_preds[n], 0, i, bi)
4352 +    {
4353 +      unsigned int w = si->node_mapping[i];
4354  
4355 -      if (okay_to_elim)
4356 -       for (pred = 0; 
4357 -            VEC_iterate (constraint_edge_t, predvec, pred, ce); 
4358 -            pred++)
4359 -         {
4360 -           bitmap weight;
4361 -           unsigned int w;
4362 -           weight = *(get_graph_weights (graph, i, ce->dest));
4363 +      if (TEST_BIT (si->roots, w))
4364 +       continue;
4365  
4366 -           /* We can't eliminate variables that have nonzero weighted
4367 -              edges between them.  */
4368 -           if (weight && bitmap_other_than_zero_bit_set (weight))
4369 -             {
4370 -               okay_to_elim = false;
4371 -               break;
4372 -             }
4373 -           w = get_varinfo (ce->dest)->node;
4374 +      if (!TEST_BIT (si->visited, w))
4375 +       label_visit (graph, si, w);
4376 +      {
4377 +       unsigned int t = si->node_mapping[w];
4378 +       unsigned int nnode = si->node_mapping[n];
4379 +       gcc_assert (nnode == n);
4380  
4381 -           /* We can't eliminate the node if one of the predecessors is
4382 -              part of a different strongly connected component.  */
4383 -           if (!okay_to_elim)
4384 -             {
4385 -               root = w;
4386 -               okay_to_elim = true;
4387 -             }
4388 -           else if (w != root)
4389 -             {
4390 -               okay_to_elim = false;
4391 -               break;
4392 -             }
4393 +       if (si->dfs[t] < si->dfs[nnode])
4394 +         si->dfs[n] = si->dfs[t];
4395 +      }
4396 +    }
4397  
4398 -           /* Theorem 4 in Rountev and Chandra: If i is a direct node,
4399 -              then Solution(i) is a subset of Solution (w), where w is a
4400 -              predecessor in the graph.  
4401 -              Corollary: If all predecessors of i have the same
4402 -              points-to set, then i has that same points-to set as
4403 -              those predecessors.  */
4404 -           tmp = BITMAP_ALLOC (NULL);
4405 -           bitmap_and_compl (tmp, get_varinfo (i)->solution,
4406 -                             get_varinfo (w)->solution);
4407 -           if (!bitmap_empty_p (tmp))
4408 -             {
4409 -               okay_to_elim = false;
4410 -               BITMAP_FREE (tmp);
4411 -               break;
4412 -             }
4413 -           BITMAP_FREE (tmp);
4414 -         }
4415 +  /* See if any components have been identified.  */
4416 +  if (si->dfs[n] == my_dfs)
4417 +    {
4418 +      while (VEC_length (unsigned, si->scc_stack) != 0
4419 +            && si->dfs[VEC_last (unsigned, si->scc_stack)] >= my_dfs)
4420 +       {
4421 +         unsigned int w = VEC_pop (unsigned, si->scc_stack);
4422 +         si->node_mapping[w] = n;
4423  
4424 -      /* See if the root is different than the original node. 
4425 -        If so, we've found an equivalence.  */
4426 -      if (root != get_varinfo (i)->node && okay_to_elim)
4427 +         if (!TEST_BIT (graph->direct_nodes, w))
4428 +           RESET_BIT (graph->direct_nodes, n);
4429 +       }
4430 +      SET_BIT (si->roots, n);
4431 +
4432 +      if (!TEST_BIT (graph->direct_nodes, n))
4433         {
4434 -         /* Found an equivalence */
4435 -         get_varinfo (i)->node = root;
4436 -         collapse_nodes (graph, root, i);
4437 +         graph->label[n] = equivalence_class++;
4438 +       }
4439 +      else
4440 +       {
4441 +         unsigned int size = 0;
4442 +         unsigned int firstlabel = ~0;
4443 +
4444 +         EXECUTE_IF_IN_NONNULL_BITMAP (graph->preds[n], 0, i, bi)
4445 +           {
4446 +             unsigned int j = si->node_mapping[i];
4447 +
4448 +             if (j == n || graph->label[j] == 0)
4449 +               continue;
4450 +
4451 +             if (firstlabel == (unsigned int)~0)
4452 +               {
4453 +                 firstlabel = graph->label[j];
4454 +                 size++;
4455 +               }
4456 +             else if (graph->label[j] != firstlabel)
4457 +               size++;
4458 +           }
4459 +
4460 +         if (size == 0)
4461 +           graph->label[n] = 0;
4462 +         else if (size == 1)
4463 +           graph->label[n] = firstlabel;
4464 +         else
4465 +           graph->label[n] = equivalence_class++;
4466 +       }
4467 +    }
4468 +  else
4469 +    VEC_safe_push (unsigned, heap, si->scc_stack, n);
4470 +}
4471 +
4472 +/* Perform offline variable substitution, discovering equivalence
4473 +   classes, and eliminating non-pointer variables.  */
4474 +
4475 +static struct scc_info *
4476 +perform_var_substitution (constraint_graph_t graph)
4477 +{
4478 +  unsigned int i;
4479 +  unsigned int size = graph->size;
4480 +  struct scc_info *si = init_scc_info (size);
4481 +
4482 +  bitmap_obstack_initialize (&iteration_obstack);
4483 +  equivalence_class = 0;
4484 +
4485 +  /* We only need to visit the non-address nodes for labeling
4486 +     purposes, as the address nodes will never have any predecessors,
4487 +     because &x never appears on the LHS of a constraint.  */
4488 +  for (i = 0; i < LAST_REF_NODE; i++)
4489 +    if (!TEST_BIT (si->visited, si->node_mapping[i]))
4490 +      label_visit (graph, si, si->node_mapping[i]);
4491 +
4492 +  if (dump_file && (dump_flags & TDF_DETAILS))
4493 +    for (i = 0; i < FIRST_REF_NODE; i++)
4494 +      {
4495 +       bool direct_node = TEST_BIT (graph->direct_nodes, i);
4496 +       fprintf (dump_file,
4497 +                "Equivalence class for %s node id %d:%s is %d\n",
4498 +                direct_node ? "Direct node" : "Indirect node", i,
4499 +                get_varinfo (i)->name,
4500 +                graph->label[si->node_mapping[i]]);
4501 +      }
4502 +
4503 +  /* Quickly eliminate our non-pointer variables.  */
4504 +
4505 +  for (i = 0; i < FIRST_REF_NODE; i++)
4506 +    {
4507 +      unsigned int node = si->node_mapping[i];
4508 +
4509 +      if (graph->label[node] == 0 && TEST_BIT (graph->direct_nodes, node))
4510 +       {
4511           if (dump_file && (dump_flags & TDF_DETAILS))
4512 -           fprintf (dump_file, "Collapsing %s into %s\n",
4513 -                    get_varinfo (i)->name,
4514 -                    get_varinfo (root)->name);
4515 -         stats.collapsed_vars++;
4516 +           fprintf (dump_file,
4517 +                    "%s is a non-pointer variable, eliminating edges.\n",
4518 +                    get_varinfo (node)->name);
4519 +         stats.nonpointer_vars++;
4520 +         clear_edges_for_node (graph, node);
4521         }
4522      }
4523 +  return si;
4524 +}
4525  
4526 +/* Free information that was only necessary for variable
4527 +   substitution.  */
4528 +
4529 +static void
4530 +free_var_substitution_info (struct scc_info *si)
4531 +{
4532 +  free_scc_info (si);
4533 +  free (graph->label);
4534 +  free (graph->eq_rep);
4535 +  sbitmap_free (graph->direct_nodes);
4536    bitmap_obstack_release (&iteration_obstack);
4537 -  free_topo_info (ti);
4538  }
4539  
4540 +/* Return an existing node that is equivalent to NODE, which has
4541 +   equivalence class LABEL, if one exists.  Return NODE otherwise.  */
4542 +
4543 +static unsigned int
4544 +find_equivalent_node (constraint_graph_t graph,
4545 +                     unsigned int node, unsigned int label)
4546 +{
4547 +  /* If the address version of this variable is unused, we can
4548 +     substitute it for anything else with the same label.
4549 +     Otherwise, we know the pointers are equivalent, but not the
4550 +     locations.  */
4551 +
4552 +  if (graph->label[FIRST_ADDR_NODE + node] == 0)
4553 +    {
4554 +      gcc_assert (label < graph->size);
4555 +
4556 +      if (graph->eq_rep[label] != -1)
4557 +       {
4558 +         /* Unify the two variables since we know they are equivalent.  */
4559 +         if (unite (graph->eq_rep[label], node))
4560 +           unify_nodes (graph, graph->eq_rep[label], node, false);
4561 +         return graph->eq_rep[label];
4562 +       }
4563 +      else
4564 +       {
4565 +         graph->eq_rep[label] = node;
4566 +       }
4567 +    }
4568 +  return node;
4569 +}
4570 +
4571 +/* Move complex constraints to the appropriate nodes, and collapse
4572 +   variables we've discovered are equivalent during variable
4573 +   substitution.  SI is the SCC_INFO that is the result of
4574 +   perform_variable_substitution.  */
4575 +
4576 +static void
4577 +move_complex_constraints (constraint_graph_t graph,
4578 +                         struct scc_info *si)
4579 +{
4580 +  int i;
4581 +  unsigned int j;
4582 +  constraint_t c;
4583 +
4584 +  for (j = 0; j < graph->size; j++)
4585 +    gcc_assert (find (j) == j);
4586 +
4587 +  for (i = 0; VEC_iterate (constraint_t, constraints, i, c); i++)
4588 +    {
4589 +      struct constraint_expr lhs = c->lhs;
4590 +      struct constraint_expr rhs = c->rhs;
4591 +      unsigned int lhsvar = find (get_varinfo_fc (lhs.var)->id);
4592 +      unsigned int rhsvar = find (get_varinfo_fc (rhs.var)->id);
4593 +      unsigned int lhsnode, rhsnode;
4594 +      unsigned int lhslabel, rhslabel;
4595 +
4596 +      lhsnode = si->node_mapping[lhsvar];
4597 +      rhsnode = si->node_mapping[rhsvar];
4598 +      lhslabel = graph->label[lhsnode];
4599 +      rhslabel = graph->label[rhsnode];
4600 +
4601 +      /* See if it is really a non-pointer variable, and if so, ignore
4602 +        the constraint.  */
4603 +      if (lhslabel == 0)
4604 +       {
4605 +         if (!TEST_BIT (graph->direct_nodes, lhsnode))
4606 +           lhslabel = graph->label[lhsnode] = equivalence_class++;
4607 +         else
4608 +           {
4609 +             if (dump_file && (dump_flags & TDF_DETAILS))
4610 +               {
4611 +
4612 +                 fprintf (dump_file, "%s is a non-pointer variable,"
4613 +                          "ignoring constraint:",
4614 +                          get_varinfo (lhs.var)->name);
4615 +                 dump_constraint (dump_file, c);
4616 +               }
4617 +             VEC_replace (constraint_t, constraints, i, NULL);
4618 +             continue;
4619 +           }
4620 +       }
4621 +
4622 +      if (rhslabel == 0)
4623 +       {
4624 +         if (!TEST_BIT (graph->direct_nodes, rhsnode))
4625 +           rhslabel = graph->label[rhsnode] = equivalence_class++;
4626 +         else
4627 +           {
4628 +             if (dump_file && (dump_flags & TDF_DETAILS))
4629 +               {
4630 +
4631 +                 fprintf (dump_file, "%s is a non-pointer variable,"
4632 +                          "ignoring constraint:",
4633 +                          get_varinfo (rhs.var)->name);
4634 +                 dump_constraint (dump_file, c);
4635 +               }
4636 +             VEC_replace (constraint_t, constraints, i, NULL);
4637 +             continue;
4638 +           }
4639 +       }
4640 +
4641 +      lhsvar = find_equivalent_node (graph, lhsvar, lhslabel);
4642 +      rhsvar = find_equivalent_node (graph, rhsvar, rhslabel);
4643 +      c->lhs.var = lhsvar;
4644 +      c->rhs.var = rhsvar;
4645 +
4646 +      if (lhs.type == DEREF)
4647 +       {
4648 +         if (rhs.type == ADDRESSOF || rhsvar > anything_id)
4649 +           insert_into_complex (graph, lhsvar, c);
4650 +       }
4651 +      else if (rhs.type == DEREF)
4652 +       {
4653 +         if (!(get_varinfo (lhsvar)->is_special_var))
4654 +           insert_into_complex (graph, rhsvar, c);
4655 +       }
4656 +      else if (rhs.type != ADDRESSOF && lhsvar > anything_id
4657 +              && (lhs.offset != 0 || rhs.offset != 0))
4658 +       {
4659 +         insert_into_complex (graph, rhsvar, c);
4660 +       }
4661 +
4662 +    }
4663 +}
4664 +
4665 +/* Eliminate indirect cycles involving NODE.  Return true if NODE was
4666 +   part of an SCC, false otherwise.  */
4667 +
4668 +static bool
4669 +eliminate_indirect_cycles (unsigned int node)
4670 +{
4671 +  if (graph->indirect_cycles[node] != -1
4672 +      && !bitmap_empty_p (get_varinfo (node)->solution))
4673 +    {
4674 +      unsigned int i;
4675 +      VEC(unsigned,heap) *queue = NULL;
4676 +      int queuepos;
4677 +      unsigned int to = find (graph->indirect_cycles[node]);
4678 +      bitmap_iterator bi;
4679 +
4680 +      /* We can't touch the solution set and call unify_nodes
4681 +        at the same time, because unify_nodes is going to do
4682 +        bitmap unions into it. */
4683 +
4684 +      EXECUTE_IF_SET_IN_BITMAP (get_varinfo (node)->solution, 0, i, bi)
4685 +       {
4686 +         if (find (i) == i && i != to)
4687 +           {
4688 +             if (unite (to, i))
4689 +               VEC_safe_push (unsigned, heap, queue, i);
4690 +           }
4691 +       }
4692 +
4693 +      for (queuepos = 0;
4694 +          VEC_iterate (unsigned, queue, queuepos, i);
4695 +          queuepos++)
4696 +       {
4697 +         unify_nodes (graph, to, i, true);
4698 +       }
4699 +      VEC_free (unsigned, heap, queue);
4700 +      return true;
4701 +    }
4702 +  return false;
4703 +}
4704 +
4705  /* Solve the constraint graph GRAPH using our worklist solver.
4706     This is based on the PW* family of solvers from the "Efficient Field
4707     Sensitive Pointer Analysis for C" paper.
4708 @@ -2001,17 +2015,28 @@
4709  {
4710    unsigned int size = VEC_length (varinfo_t, varmap);
4711    unsigned int i;
4712 +  bitmap pts;
4713  
4714 -  changed_count = size;
4715 +  changed_count = 0;
4716    changed = sbitmap_alloc (size);
4717 -  sbitmap_ones (changed);
4718 -  
4719 -  /* The already collapsed/unreachable nodes will never change, so we
4720 -     need to  account for them in changed_count.  */
4721 +  sbitmap_zero (changed);
4722 +
4723 +  /* Mark all initial non-collapsed nodes as changed.  */
4724    for (i = 0; i < size; i++)
4725 -    if (get_varinfo (i)->node != i)
4726 -      changed_count--;
4727 -  
4728 +    {
4729 +      varinfo_t ivi = get_varinfo (i);
4730 +      if (find (i) == i && !bitmap_empty_p (ivi->solution)
4731 +         && ((graph->succs[i] && !bitmap_empty_p (graph->succs[i]))
4732 +             || VEC_length (constraint_t, graph->complex[i]) > 0))
4733 +       {
4734 +         SET_BIT (changed, i);
4735 +         changed_count++;
4736 +       }
4737 +    }
4738 +
4739 +  /* Allocate a bitmap to be used to store the changed bits.  */
4740 +  pts = BITMAP_ALLOC (&pta_obstack);
4741 +
4742    while (changed_count > 0)
4743      {
4744        unsigned int i;
4745 @@ -2019,41 +2044,45 @@
4746        stats.iterations++;
4747  
4748        bitmap_obstack_initialize (&iteration_obstack);
4749 -      
4750 -      if (edge_added)
4751 -       {
4752 -         /* We already did cycle elimination once, when we did
4753 -            variable substitution, so we don't need it again for the
4754 -            first iteration.  */
4755 -         if (stats.iterations > 1)
4756 -           find_and_collapse_graph_cycles (graph, true);
4757  
4758 -         edge_added = false;
4759 -       }
4760 -
4761        compute_topo_order (graph, ti);
4762  
4763        while (VEC_length (unsigned, ti->topo_order) != 0)
4764         {
4765 +
4766           i = VEC_pop (unsigned, ti->topo_order);
4767 -         gcc_assert (get_varinfo (i)->node == i);
4768  
4769 +         /* If this variable is not a representative, skip it.  */
4770 +         if (find (i) != i)
4771 +           continue;
4772 +
4773 +         /* In certain indirect cycle cases, we may merge this
4774 +            variable to another.  */
4775 +         if (eliminate_indirect_cycles (i) && find (i) != i)
4776 +           continue;
4777 +
4778           /* If the node has changed, we need to process the
4779              complex constraints and outgoing edges again.  */
4780           if (TEST_BIT (changed, i))
4781             {
4782               unsigned int j;
4783               constraint_t c;
4784 -             constraint_edge_t e = NULL;
4785               bitmap solution;
4786 -             bitmap_iterator bi;
4787 -             VEC(constraint_t,heap) *complex = get_varinfo (i)->complex;
4788 -             VEC(constraint_edge_t,heap) *succs;
4789 +             VEC(constraint_t,heap) *complex = graph->complex[i];
4790               bool solution_empty;
4791  
4792               RESET_BIT (changed, i);
4793               changed_count--;
4794  
4795 +             /* Compute the changed set of solution bits.  */
4796 +             bitmap_and_compl (pts, get_varinfo (i)->solution,
4797 +                               get_varinfo (i)->oldsolution);
4798 +
4799 +             if (bitmap_empty_p (pts))
4800 +               continue;
4801 +
4802 +             bitmap_ior_into (get_varinfo (i)->oldsolution, pts);
4803 +
4804               solution = get_varinfo (i)->solution;
4805               solution_empty = bitmap_empty_p (solution);
4806  
4807 @@ -2065,52 +2094,38 @@
4808                      is a constraint where the lhs side is receiving
4809                      some set from elsewhere.  */
4810                   if (!solution_empty || c->lhs.type != DEREF)
4811 -                   do_complex_constraint (graph, c, solution);
4812 +                   do_complex_constraint (graph, c, pts);
4813                 }
4814  
4815               solution_empty = bitmap_empty_p (solution);
4816  
4817               if (!solution_empty)
4818                 {
4819 +                 bitmap_iterator bi;
4820 +
4821                   /* Propagate solution to all successors.  */
4822 -                 succs = graph->succs[i];
4823 -                 
4824 -                 EXECUTE_IF_IN_NONNULL_BITMAP (graph->zero_weight_succs[i], 
4825 +                 EXECUTE_IF_IN_NONNULL_BITMAP (graph->succs[i],
4826                                                 0, j, bi)
4827                     {
4828 -                     bitmap tmp = get_varinfo (j)->solution;
4829 -                     bool flag = false;
4830 -                 
4831 -                     flag = set_union_with_increment (tmp, solution, 0);
4832 -                 
4833 -                     if (flag)
4834 -                       {
4835 -                         get_varinfo (j)->solution = tmp;
4836 -                         if (!TEST_BIT (changed, j))
4837 -                           {
4838 -                             SET_BIT (changed, j);
4839 -                             changed_count++;
4840 -                           }
4841 -                       }
4842 -                   }
4843 -                 for (j = 0; VEC_iterate (constraint_edge_t, succs, j, e); j++)
4844 -                   {
4845 -                     bitmap tmp = get_varinfo (e->dest)->solution;
4846 -                     bool flag = false;
4847 -                     unsigned int k;
4848 -                     bitmap weights = e->weights;
4849 -                     bitmap_iterator bi;
4850 +                     bitmap tmp;
4851 +                     bool flag;
4852  
4853 -                     gcc_assert (weights && !bitmap_empty_p (weights));
4854 -                     EXECUTE_IF_SET_IN_BITMAP (weights, 0, k, bi)
4855 -                       flag |= set_union_with_increment (tmp, solution, k);
4856 +                     unsigned int to = find (j);
4857 +                     tmp = get_varinfo (to)->solution;
4858 +                     flag = false;
4859  
4860 +                     /* Don't try to propagate to ourselves.  */
4861 +                     if (to == i)
4862 +                       continue;
4863 +
4864 +                     flag = set_union_with_increment (tmp, pts, 0);
4865 +
4866                       if (flag)
4867                         {
4868 -                         get_varinfo (e->dest)->solution = tmp;
4869 -                         if (!TEST_BIT (changed, e->dest))
4870 +                         get_varinfo (to)->solution = tmp;
4871 +                         if (!TEST_BIT (changed, to))
4872                             {
4873 -                             SET_BIT (changed, e->dest);
4874 +                             SET_BIT (changed, to);
4875                               changed_count++;
4876                             }
4877                         }
4878 @@ -2122,74 +2137,37 @@
4879        bitmap_obstack_release (&iteration_obstack);
4880      }
4881  
4882 +  BITMAP_FREE (pts);
4883    sbitmap_free (changed);
4884 +  bitmap_obstack_release (&oldpta_obstack);
4885  }
4886  
4887 +/* Map from trees to variable infos.  */
4888 +static struct pointer_map_t *vi_for_tree;
4889  
4890 -/* CONSTRAINT AND VARIABLE GENERATION FUNCTIONS */
4891  
4892 -/* Map from trees to variable ids.  */    
4893 -static htab_t id_for_tree;
4894 +/* Insert ID as the variable id for tree T in the vi_for_tree map.  */
4895  
4896 -typedef struct tree_id
4897 +static void
4898 +insert_vi_for_tree (tree t, varinfo_t vi)
4899  {
4900 -  tree t;
4901 -  unsigned int id;
4902 -} *tree_id_t;
4903 -
4904 -/* Hash a tree id structure.  */
4905 -
4906 -static hashval_t 
4907 -tree_id_hash (const void *p)
4908 -{
4909 -  const tree_id_t ta = (tree_id_t) p;
4910 -  return htab_hash_pointer (ta->t);
4911 -}
4912 -
4913 -/* Return true if the tree in P1 and the tree in P2 are the same.  */
4914 -
4915 -static int
4916 -tree_id_eq (const void *p1, const void *p2)
4917 -{
4918 -  const tree_id_t ta1 = (tree_id_t) p1;
4919 -  const tree_id_t ta2 = (tree_id_t) p2;
4920 -  return ta1->t == ta2->t;
4921 -}
4922 -
4923 -/* Insert ID as the variable id for tree T in the hashtable.  */
4924 -
4925 -static void 
4926 -insert_id_for_tree (tree t, int id)
4927 -{
4928 -  void **slot;
4929 -  struct tree_id finder;
4930 -  tree_id_t new_pair;
4931 -  
4932 -  finder.t = t;
4933 -  slot = htab_find_slot (id_for_tree, &finder, INSERT);
4934 +  void **slot = pointer_map_insert (vi_for_tree, t);
4935 +  gcc_assert (vi);
4936    gcc_assert (*slot == NULL);
4937 -  new_pair = XNEW (struct tree_id);
4938 -  new_pair->t = t;
4939 -  new_pair->id = id;
4940 -  *slot = (void *)new_pair;
4941 +  *slot = vi;
4942  }
4943  
4944 -/* Find the variable id for tree T in ID_FOR_TREE.  If T does not
4945 -   exist in the hash table, return false, otherwise, return true and
4946 -   set *ID to the id we found.  */
4947 +/* Find the variable info for tree T in VI_FOR_TREE.  If T does not
4948 +   exist in the map, return NULL, otherwise, return the varinfo we found.  */
4949  
4950 -static bool
4951 -lookup_id_for_tree (tree t, unsigned int *id)
4952 +static varinfo_t
4953 +lookup_vi_for_tree (tree t)
4954  {
4955 -  tree_id_t pair;
4956 -  struct tree_id finder;
4957 +  void **slot = pointer_map_contains (vi_for_tree, t);
4958 +  if (slot == NULL)
4959 +    return NULL;
4960  
4961 -  finder.t = t;
4962 -  pair = htab_find (id_for_tree,  &finder);
4963 -  if (pair == NULL)
4964 -    return false;
4965 -  *id = pair->id;
4966 -  return true;
4967 +  return (varinfo_t) *slot;
4968  }
4969  
4970  /* Return a printable name for DECL  */
4971 @@ -2210,7 +2188,7 @@
4972  
4973    if (TREE_CODE (decl) == SSA_NAME)
4974      {
4975 -      num_printed = asprintf (&temp, "%s_%u", 
4976 +      num_printed = asprintf (&temp, "%s_%u",
4977                               alias_get_name (SSA_NAME_VAR (decl)),
4978                               SSA_NAME_VERSION (decl));
4979      }
4980 @@ -2226,21 +2204,17 @@
4981    return res;
4982  }
4983  
4984 -/* Find the variable id for tree T in the hashtable.
4985 -   If T doesn't exist in the hash table, create an entry for it.  */
4986 +/* Find the variable id for tree T in the map.
4987 +   If T doesn't exist in the map, create an entry for it and return it.  */
4988  
4989 -static unsigned int
4990 -get_id_for_tree (tree t)
4991 +static varinfo_t
4992 +get_vi_for_tree (tree t)
4993  {
4994 -  tree_id_t pair;
4995 -  struct tree_id finder;
4996 +  void **slot = pointer_map_contains (vi_for_tree, t);
4997 +  if (slot == NULL)
4998 +    return get_varinfo (create_variable_info_for (t, alias_get_name (t)));
4999  
5000 -  finder.t = t;
5001 -  pair = htab_find (id_for_tree,  &finder);
5002 -  if (pair == NULL)
5003 -    return create_variable_info_for (t, alias_get_name (t));
5004 -  
5005 -  return pair->id;
5006 +  return (varinfo_t) *slot;
5007  }
5008  
5009  /* Get a constraint expression from an SSA_VAR_P node.  */
5010 @@ -2254,14 +2228,14 @@
5011  
5012    /* For parameters, get at the points-to set for the actual parm
5013       decl.  */
5014 -  if (TREE_CODE (t) == SSA_NAME 
5015 -      && TREE_CODE (SSA_NAME_VAR (t)) == PARM_DECL 
5016 +  if (TREE_CODE (t) == SSA_NAME
5017 +      && TREE_CODE (SSA_NAME_VAR (t)) == PARM_DECL
5018        && default_def (SSA_NAME_VAR (t)) == t)
5019      return get_constraint_exp_from_ssa_var (SSA_NAME_VAR (t));
5020  
5021    cexpr.type = SCALAR;
5022 -  
5023 -  cexpr.var = get_id_for_tree (t);
5024 +
5025 +  cexpr.var = get_vi_for_tree (t)->id;
5026    /* If we determine the result is "anything", and we know this is readonly,
5027       say it points to readonly memory instead.  */
5028    if (cexpr.var == anything_id && TREE_READONLY (t))
5029 @@ -2269,7 +2243,7 @@
5030        cexpr.type = ADDRESSOF;
5031        cexpr.var = readonly_id;
5032      }
5033 -    
5034 +
5035    cexpr.offset = 0;
5036    return cexpr;
5037  }
5038 @@ -2290,7 +2264,13 @@
5039      get_varinfo (lhs.var)->directly_dereferenced = true;
5040    if (rhs.type == DEREF)
5041      get_varinfo (rhs.var)->directly_dereferenced = true;
5042 -  
5043 +
5044 +  if (!use_field_sensitive)
5045 +    {
5046 +      t->rhs.offset = 0;
5047 +      t->lhs.offset = 0;
5048 +    }
5049 +
5050    /* ANYTHING == ANYTHING is pointless.  */
5051    if (lhs.var == anything_id && rhs.var == anything_id)
5052      return;
5053 @@ -2302,7 +2282,7 @@
5054        t->lhs = t->rhs;
5055        t->rhs = rhs;
5056        process_constraint (t);
5057 -    }   
5058 +    }
5059    /* This can happen in our IR with things like n->a = *p */
5060    else if (rhs.type == DEREF && lhs.type == DEREF && rhs.var != anything_id)
5061      {
5062 @@ -2312,33 +2292,19 @@
5063        tree pointedtotype = TREE_TYPE (pointertype);
5064        tree tmpvar = create_tmp_var_raw (pointedtotype, "doubledereftmp");
5065        struct constraint_expr tmplhs = get_constraint_exp_from_ssa_var (tmpvar);
5066 -      
5067 +
5068        /* If this is an aggregate of known size, we should have passed
5069          this off to do_structure_copy, and it should have broken it
5070          up.  */
5071 -      gcc_assert (!AGGREGATE_TYPE_P (pointedtotype) 
5072 +      gcc_assert (!AGGREGATE_TYPE_P (pointedtotype)
5073                   || get_varinfo (rhs.var)->is_unknown_size_var);
5074 -      
5075 +
5076        process_constraint (new_constraint (tmplhs, rhs));
5077        process_constraint (new_constraint (lhs, tmplhs));
5078      }
5079 -  else if (rhs.type == ADDRESSOF)
5080 -    {
5081 -      varinfo_t vi;
5082 -      gcc_assert (rhs.offset == 0);
5083 -      
5084 -      /* No need to mark address taken simply because of escaped vars
5085 -        constraints.  */
5086 -      if (lhs.var != escaped_vars_id)
5087 -       for (vi = get_varinfo (rhs.var); vi != NULL; vi = vi->next)
5088 -         vi->address_taken = true;
5089 -
5090 -      VEC_safe_push (constraint_t, heap, constraints, t);
5091 -    }
5092    else
5093      {
5094 -      if (lhs.type != DEREF && rhs.type == DEREF)
5095 -       get_varinfo (lhs.var)->indirect_target = true;
5096 +      gcc_assert (rhs.type != ADDRESSOF || rhs.offset == 0);
5097        VEC_safe_push (constraint_t, heap, constraints, t);
5098      }
5099  }
5100 @@ -2350,10 +2316,12 @@
5101  could_have_pointers (tree t)
5102  {
5103    tree type = TREE_TYPE (t);
5104 -  
5105 -  if (POINTER_TYPE_P (type) || AGGREGATE_TYPE_P (type)
5106 +
5107 +  if (POINTER_TYPE_P (type)
5108 +      || AGGREGATE_TYPE_P (type)
5109        || TREE_CODE (type) == COMPLEX_TYPE)
5110      return true;
5111 +
5112    return false;
5113  }
5114  
5115 @@ -2367,9 +2335,9 @@
5116    if (TREE_CODE (DECL_FIELD_OFFSET (fdecl)) != INTEGER_CST
5117        || TREE_CODE (DECL_FIELD_BIT_OFFSET (fdecl)) != INTEGER_CST)
5118      return -1;
5119 -  
5120 -  return (tree_low_cst (DECL_FIELD_OFFSET (fdecl), 1) * 8) 
5121 -         + tree_low_cst (DECL_FIELD_BIT_OFFSET (fdecl), 1);
5122 +
5123 +  return (tree_low_cst (DECL_FIELD_OFFSET (fdecl), 1) * 8)
5124 +        + tree_low_cst (DECL_FIELD_BIT_OFFSET (fdecl), 1);
5125  }
5126  
5127  
5128 @@ -2388,7 +2356,7 @@
5129      return true;
5130    if (accesspos < fieldpos && (accesspos + accesssize > fieldpos))
5131      return true;
5132 -  
5133 +
5134    return false;
5135  }
5136  
5137 @@ -2411,20 +2379,20 @@
5138    while (!SSA_VAR_P (forzero) && !CONSTANT_CLASS_P (forzero))
5139      forzero = TREE_OPERAND (forzero, 0);
5140  
5141 -  if (CONSTANT_CLASS_P (forzero) && integer_zerop (forzero)) 
5142 +  if (CONSTANT_CLASS_P (forzero) && integer_zerop (forzero))
5143      {
5144        struct constraint_expr temp;
5145 -      
5146 +
5147        temp.offset = 0;
5148        temp.var = integer_id;
5149        temp.type = SCALAR;
5150        VEC_safe_push (ce_s, heap, *results, &temp);
5151        return;
5152      }
5153
5154 +
5155    t = get_ref_base_and_extent (t, &bitpos, &bitsize, &bitmaxsize);
5156  
5157 -  /* String constants's are readonly, so there is nothing to really do
5158 +  /* String constants are readonly, so there is nothing to really do
5159       here.  */
5160    if (TREE_CODE (t) == STRING_CST)
5161      return;
5162 @@ -2438,21 +2406,21 @@
5163    /* This can also happen due to weird offsetof type macros.  */
5164    if (TREE_CODE (t) != ADDR_EXPR && result->type == ADDRESSOF)
5165      result->type = SCALAR;
5166
5167 +
5168    if (result->type == SCALAR)
5169      {
5170        /* In languages like C, you can access one past the end of an
5171          array.  You aren't allowed to dereference it, so we can
5172          ignore this constraint. When we handle pointer subtraction,
5173          we may have to do something cute here.  */
5174 -      
5175 +
5176        if (result->offset < get_varinfo (result->var)->fullsize
5177           && bitmaxsize != 0)
5178         {
5179           /* It's also not true that the constraint will actually start at the
5180              right offset, it may start in some padding.  We only care about
5181              setting the constraint to the first actual field it touches, so
5182 -            walk to find it.  */ 
5183 +            walk to find it.  */
5184           varinfo_t curr;
5185           for (curr = get_varinfo (result->var); curr; curr = curr->next)
5186             {
5187 @@ -2495,6 +2463,7 @@
5188  {
5189    struct constraint_expr *c;
5190    unsigned int i = 0;
5191 +
5192    for (i = 0; VEC_iterate (ce_s, *constraints, i, c); i++)
5193      {
5194        if (c->type == SCALAR)
5195 @@ -2576,6 +2545,7 @@
5196               tree pttype = TREE_TYPE (TREE_TYPE (t));
5197  
5198               get_constraint_for (exp, results);
5199 +
5200               /* Make sure we capture constraints to all elements
5201                  of an array.  */
5202               if ((handled_component_p (exp)
5203 @@ -2588,7 +2558,7 @@
5204  
5205                   if (VEC_length (ce_s, *results) == 0)
5206                     return;
5207 -                 
5208 +
5209                   gcc_assert (VEC_length (ce_s, *results) == 1);
5210                   origrhs = VEC_last (ce_s, *results);
5211                   tmp = *origrhs;
5212 @@ -2619,12 +2589,12 @@
5213                       VEC_safe_push (ce_s, heap, *results, &tmp);
5214                     }
5215                 }
5216 -             
5217 +
5218               for (i = 0; VEC_iterate (ce_s, *results, i, c); i++)
5219                 {
5220                   if (c->type == DEREF)
5221                     c->type = SCALAR;
5222 -                 else 
5223 +                 else
5224                     c->type = ADDRESSOF;
5225                 }
5226               return;
5227 @@ -2638,9 +2608,9 @@
5228               {
5229                 varinfo_t vi;
5230                 tree heapvar = heapvar_lookup (t);
5231 -               
5232 +
5233                 if (heapvar == NULL)
5234 -                 {                 
5235 +                 {
5236                     heapvar = create_tmp_var_raw (ptr_type_node, "HEAP");
5237                     DECL_EXTERNAL (heapvar) = 1;
5238                     if (referenced_vars)
5239 @@ -2650,7 +2620,7 @@
5240  
5241                 temp.var = create_variable_info_for (heapvar,
5242                                                      alias_get_name (heapvar));
5243 -               
5244 +
5245                 vi = get_varinfo (temp.var);
5246                 vi->is_artificial_var = 1;
5247                 vi->is_heap_var = 1;
5248 @@ -2712,7 +2682,7 @@
5249           case NON_LVALUE_EXPR:
5250             {
5251               tree op = TREE_OPERAND (t, 0);
5252 -             
5253 +
5254               /* Cast from non-pointer to pointers are bad news for us.
5255                  Anything else, we see through */
5256               if (!(POINTER_TYPE_P (TREE_TYPE (t))
5257 @@ -2738,7 +2708,7 @@
5258        {
5259         switch (TREE_CODE (t))
5260           {
5261 -         case PHI_NODE:           
5262 +         case PHI_NODE:
5263             {
5264               get_constraint_for (PHI_RESULT (t), results);
5265               return;
5266 @@ -2782,8 +2752,8 @@
5267  
5268  
5269  /* Handle the structure copy case where we have a simple structure copy
5270 -   between LHS and RHS that is of SIZE (in bits) 
5271 -  
5272 +   between LHS and RHS that is of SIZE (in bits)
5273 +
5274     For each field of the lhs variable (lhsfield)
5275       For each field of the rhs variable at lhsfield.offset (rhsfield)
5276         add the constraint lhsfield = rhsfield
5277 @@ -2808,7 +2778,7 @@
5278        struct constraint_expr temprhs = rhs;
5279        unsigned HOST_WIDE_INT fieldoffset;
5280  
5281 -      templhs.var = p->id;            
5282 +      templhs.var = p->id;
5283        q = get_varinfo (temprhs.var);
5284        fieldoffset = p->offset - pstart;
5285        q = first_vi_for_offset (q, q->offset + fieldoffset);
5286 @@ -2823,8 +2793,8 @@
5287  
5288  /* Handle the structure copy case where we have a  structure copy between a
5289     aggregate on the LHS and a dereference of a pointer on the RHS
5290 -   that is of SIZE (in bits) 
5291 -  
5292 +   that is of SIZE (in bits)
5293 +
5294     For each field of the lhs variable (lhsfield)
5295         rhs.offset = lhsfield->offset
5296         add the constraint lhsfield = rhs
5297 @@ -2849,12 +2819,12 @@
5298  
5299  
5300        if (templhs.type == SCALAR)
5301 -       templhs.var = p->id;      
5302 +       templhs.var = p->id;
5303        else
5304         templhs.offset = p->offset;
5305 -      
5306 +
5307        q = get_varinfo (temprhs.var);
5308 -      fieldoffset = p->offset - pstart;      
5309 +      fieldoffset = p->offset - pstart;
5310        temprhs.offset += fieldoffset;
5311        process_constraint (new_constraint (templhs, temprhs));
5312      }
5313 @@ -2862,7 +2832,7 @@
5314  
5315  /* Handle the structure copy case where we have a structure copy
5316     between a aggregate on the RHS and a dereference of a pointer on
5317 -   the LHS that is of SIZE (in bits) 
5318 +   the LHS that is of SIZE (in bits)
5319  
5320     For each field of the rhs variable (rhsfield)
5321         lhs.offset = rhsfield->offset
5322 @@ -2888,12 +2858,12 @@
5323  
5324  
5325        if (temprhs.type == SCALAR)
5326 -       temprhs.var = p->id;      
5327 +       temprhs.var = p->id;
5328        else
5329         temprhs.offset = p->offset;
5330 -      
5331 +
5332        q = get_varinfo (templhs.var);
5333 -      fieldoffset = p->offset - pstart;      
5334 +      fieldoffset = p->offset - pstart;
5335        templhs.offset += fieldoffset;
5336        process_constraint (new_constraint (templhs, temprhs));
5337      }
5338 @@ -2901,7 +2871,7 @@
5339  
5340  /* Sometimes, frontends like to give us bad type information.  This
5341     function will collapse all the fields from VAR to the end of VAR,
5342 -   into VAR, so that we treat those fields as a single variable. 
5343 +   into VAR, so that we treat those fields as a single variable.
5344     We return the variable they were collapsed into.  */
5345  
5346  static unsigned int
5347 @@ -2913,16 +2883,16 @@
5348    for (field = currvar->next; field; field = field->next)
5349      {
5350        if (dump_file)
5351 -       fprintf (dump_file, "Type safety: Collapsing var %s into %s\n", 
5352 +       fprintf (dump_file, "Type safety: Collapsing var %s into %s\n",
5353                  field->name, currvar->name);
5354 -      
5355 +
5356        gcc_assert (!field->collapsed_to);
5357        field->collapsed_to = currvar;
5358      }
5359  
5360    currvar->next = NULL;
5361    currvar->size = currvar->fullsize - currvar->offset;
5362 -  
5363 +
5364    return currvar->id;
5365  }
5366  
5367 @@ -2944,7 +2914,7 @@
5368    gcc_assert (VEC_length (ce_s, rhsc) == 1);
5369    lhs = *(VEC_last (ce_s, lhsc));
5370    rhs = *(VEC_last (ce_s, rhsc));
5371 -  
5372 +
5373    VEC_free (ce_s, heap, lhsc);
5374    VEC_free (ce_s, heap, rhsc);
5375  
5376 @@ -2955,7 +2925,7 @@
5377        lhs = rhs;
5378        rhs = tmp;
5379      }
5380 -  
5381 +
5382    /*  This is fairly conservative for the RHS == ADDRESSOF case, in that it's
5383        possible it's something we could handle.  However, most cases falling
5384        into this are dealing with transparent unions, which are slightly
5385 @@ -3021,11 +2991,11 @@
5386        else
5387         lhssize = TREE_INT_CST_LOW (lhstypesize);
5388  
5389 -  
5390 -      if (rhs.type == SCALAR && lhs.type == SCALAR)  
5391 +
5392 +      if (rhs.type == SCALAR && lhs.type == SCALAR)
5393         {
5394           if (!do_simple_structure_copy (lhs, rhs, MIN (lhssize, rhssize)))
5395 -           {         
5396 +           {
5397               lhs.var = collapse_rest_of_var (lhs.var);
5398               rhs.var = collapse_rest_of_var (rhs.var);
5399               lhs.offset = 0;
5400 @@ -3042,7 +3012,7 @@
5401        else
5402         {
5403           tree pointedtotype = lhstype;
5404 -         tree tmpvar;  
5405 +         tree tmpvar;
5406  
5407           gcc_assert (rhs.type == DEREF && lhs.type == DEREF);
5408           tmpvar = create_tmp_var_raw (pointedtotype, "structcopydereftmp");
5409 @@ -3052,6 +3022,7 @@
5410      }
5411  }
5412  
5413 +
5414  /* Update related alias information kept in AI.  This is used when
5415     building name tags, alias sets and deciding grouping heuristics.
5416     STMT is the statement to process.  This function also updates
5417 @@ -3261,7 +3232,6 @@
5418      }
5419  }
5420  
5421 -
5422  /* Handle pointer arithmetic EXPR when creating aliasing constraints.
5423     Expressions of the type PTR + CST can be handled in two ways:
5424  
5425 @@ -3307,6 +3277,7 @@
5426    else
5427      return false;
5428  
5429 +
5430    for (i = 0; VEC_iterate (ce_s, lhsc, i, c); i++)
5431      for (j = 0; VEC_iterate (ce_s, temp, j, c2); j++)
5432        {
5433 @@ -3360,12 +3331,12 @@
5434         {
5435           int i;
5436           unsigned int j;
5437 -         
5438 +
5439           /* For a phi node, assign all the arguments to
5440              the result.  */
5441           get_constraint_for (PHI_RESULT (t), &lhsc);
5442           for (i = 0; i < PHI_NUM_ARGS (t); i++)
5443 -           { 
5444 +           {
5445               tree rhstype;
5446               tree strippedrhs = PHI_ARG_DEF (t, i);
5447  
5448 @@ -3401,7 +3372,6 @@
5449      {
5450        tree lhsop;
5451        tree rhsop;
5452 -      unsigned int varid;
5453        tree arglist;
5454        varinfo_t fi;
5455        int i = 1;
5456 @@ -3423,17 +3393,16 @@
5457          we should still be able to handle.  */
5458        if (decl)
5459         {
5460 -         varid = get_id_for_tree (decl);
5461 +         fi = get_vi_for_tree (decl);
5462         }
5463        else
5464         {
5465           decl = TREE_OPERAND (rhsop, 0);
5466 -         varid = get_id_for_tree (decl);
5467 +         fi = get_vi_for_tree (decl);
5468         }
5469  
5470        /* Assign all the passed arguments to the appropriate incoming
5471          parameters of the function.  */
5472 -      fi = get_varinfo (varid);
5473        arglist = TREE_OPERAND (rhsop, 1);
5474         
5475        for (;arglist; arglist = TREE_CHAIN (arglist))
5476 @@ -3463,13 +3432,14 @@
5477             }
5478           i++;
5479         }
5480 +
5481        /* If we are returning a value, assign it to the result.  */
5482        if (lhsop)
5483         {
5484           struct constraint_expr rhs;
5485           struct constraint_expr *lhsp;
5486           unsigned int j = 0;
5487 -         
5488 +
5489           get_constraint_for (lhsop, &lhsc);
5490           if (TREE_CODE (decl) != FUNCTION_DECL)
5491             {
5492 @@ -3485,7 +3455,7 @@
5493             }
5494           for (j = 0; VEC_iterate (ce_s, lhsc, j, lhsp); j++)
5495             process_constraint (new_constraint (*lhsp, rhs));
5496 -       }      
5497 +       }
5498      }
5499    /* Otherwise, just a regular assignment statement.  */
5500    else if (TREE_CODE (t) == MODIFY_EXPR)
5501 @@ -3494,7 +3464,7 @@
5502        tree rhsop = TREE_OPERAND (t, 1);
5503        int i;
5504  
5505 -      if ((AGGREGATE_TYPE_P (TREE_TYPE (lhsop)) 
5506 +      if ((AGGREGATE_TYPE_P (TREE_TYPE (lhsop))
5507            || TREE_CODE (TREE_TYPE (lhsop)) == COMPLEX_TYPE)
5508           && (AGGREGATE_TYPE_P (TREE_TYPE (rhsop))
5509               || TREE_CODE (TREE_TYPE (lhsop)) == COMPLEX_TYPE))
5510 @@ -3513,7 +3483,7 @@
5511                 {
5512                   /* RHS that consist of unary operations,
5513                      exceptional types, or bare decls/constants, get
5514 -                    handled directly by get_constraint_for.  */ 
5515 +                    handled directly by get_constraint_for.  */
5516                   case tcc_reference:
5517                   case tcc_declaration:
5518                   case tcc_constant:
5519 @@ -3528,7 +3498,7 @@
5520                           {
5521                             struct constraint_expr *c2;
5522                             unsigned int k;
5523 -                           
5524 +
5525                             for (k = 0; VEC_iterate (ce_s, rhsc, k, c2); k++)
5526                               process_constraint (new_constraint (*c, *c2));
5527                           }
5528 @@ -3570,7 +3540,7 @@
5529                               }
5530                           }
5531                       }
5532 -               }      
5533 +               }
5534             }
5535         }
5536      }
5537 @@ -3578,7 +3548,7 @@
5538    /* After promoting variables and computing aliasing we will
5539       need to re-scan most statements.  FIXME: Try to minimize the
5540       number of statements re-scanned.  It's not really necessary to
5541 -     re-scan *all* statements.  */  
5542 +     re-scan *all* statements.  */
5543    mark_stmt_modified (origt);
5544    VEC_free (ce_s, heap, rhsc);
5545    VEC_free (ce_s, heap, lhsc);
5546 @@ -3591,7 +3561,7 @@
5547     first field that overlaps with OFFSET.
5548     Return NULL if we can't find one.  */
5549  
5550 -static varinfo_t 
5551 +static varinfo_t
5552  first_vi_for_offset (varinfo_t start, unsigned HOST_WIDE_INT offset)
5553  {
5554    varinfo_t curr = start;
5555 @@ -3617,7 +3587,7 @@
5556  {
5557    varinfo_t prev = base;
5558    varinfo_t curr = base->next;
5559 -  
5560 +
5561    field->next = curr;
5562    prev->next = field;
5563  }
5564 @@ -3630,7 +3600,7 @@
5565  {
5566    varinfo_t prev = base;
5567    varinfo_t curr = base->next;
5568 -  
5569 +
5570    if (curr == NULL)
5571      {
5572        prev->next = field;
5573 @@ -3652,13 +3622,13 @@
5574  
5575  /* qsort comparison function for two fieldoff's PA and PB */
5576  
5577 -static int 
5578 +static int
5579  fieldoff_compare (const void *pa, const void *pb)
5580  {
5581    const fieldoff_s *foa = (const fieldoff_s *)pa;
5582    const fieldoff_s *fob = (const fieldoff_s *)pb;
5583    HOST_WIDE_INT foasize, fobsize;
5584 -  
5585 +
5586    if (foa->offset != fob->offset)
5587      return foa->offset - fob->offset;
5588  
5589 @@ -3671,8 +3641,8 @@
5590  void
5591  sort_fieldstack (VEC(fieldoff_s,heap) *fieldstack)
5592  {
5593 -  qsort (VEC_address (fieldoff_s, fieldstack), 
5594 -        VEC_length (fieldoff_s, fieldstack), 
5595 +  qsort (VEC_address (fieldoff_s, fieldstack),
5596 +        VEC_length (fieldoff_s, fieldstack),
5597          sizeof (fieldoff_s),
5598          fieldoff_compare);
5599  }
5600 @@ -3686,12 +3656,12 @@
5601     TYPE.  */
5602  
5603  int
5604 -push_fields_onto_fieldstack (tree type, VEC(fieldoff_s,heap) **fieldstack, 
5605 +push_fields_onto_fieldstack (tree type, VEC(fieldoff_s,heap) **fieldstack,
5606                              HOST_WIDE_INT offset, bool *has_union)
5607  {
5608    tree field;
5609    int count = 0;
5610 -  
5611 +
5612    if (TREE_CODE (type) == COMPLEX_TYPE)
5613      {
5614        fieldoff_s *real_part, *img_part;
5615 @@ -3700,13 +3670,13 @@
5616        real_part->size = TYPE_SIZE (TREE_TYPE (type));
5617        real_part->offset = offset;
5618        real_part->decl = NULL_TREE;
5619 -      
5620 +
5621        img_part = VEC_safe_push (fieldoff_s, heap, *fieldstack, NULL);
5622        img_part->type = TREE_TYPE (type);
5623        img_part->size = TYPE_SIZE (TREE_TYPE (type));
5624        img_part->offset = offset + TREE_INT_CST_LOW (TYPE_SIZE (TREE_TYPE (type)));
5625        img_part->decl = NULL_TREE;
5626 -      
5627 +
5628        return 2;
5629      }
5630  
5631 @@ -3733,12 +3703,12 @@
5632         {
5633           bool push = false;
5634           int pushed = 0;
5635 -       
5636 -         if (has_union 
5637 +
5638 +         if (has_union
5639               && (TREE_CODE (TREE_TYPE (type)) == QUAL_UNION_TYPE
5640                   || TREE_CODE (TREE_TYPE (type)) == UNION_TYPE))
5641             *has_union = true;
5642 -       
5643 +
5644           if (!AGGREGATE_TYPE_P (TREE_TYPE (type))) /* var_can_have_subvars */
5645             push = true;
5646           else if (!(pushed = push_fields_onto_fieldstack
5647 @@ -3772,12 +3742,12 @@
5648        {
5649         bool push = false;
5650         int pushed = 0;
5651 -       
5652 -       if (has_union 
5653 +
5654 +       if (has_union
5655             && (TREE_CODE (TREE_TYPE (field)) == QUAL_UNION_TYPE
5656                 || TREE_CODE (TREE_TYPE (field)) == UNION_TYPE))
5657           *has_union = true;
5658 -       
5659 +
5660         if (!var_can_have_subvars (field))
5661           push = true;
5662         else if (!(pushed = push_fields_onto_fieldstack
5663 @@ -3789,7 +3759,7 @@
5664              see if we didn't push any subfields and the size is
5665              nonzero, push the field onto the stack */
5666           push = true;
5667 -       
5668 +
5669         if (push)
5670           {
5671             fieldoff_s *pair;
5672 @@ -3848,15 +3818,15 @@
5673    unsigned int i = 0;
5674    tree t;
5675  
5676 -  for (t = TYPE_ARG_TYPES (TREE_TYPE (decl)); 
5677 +  for (t = TYPE_ARG_TYPES (TREE_TYPE (decl));
5678         t;
5679         t = TREE_CHAIN (t))
5680 -    {  
5681 +    {
5682        if (TREE_VALUE (t) == void_type_node)
5683         break;
5684        i++;
5685      }
5686 -  
5687 +
5688    if (!t)
5689      *is_varargs = true;
5690    return i;
5691 @@ -3870,19 +3840,19 @@
5692  {
5693    unsigned int index = VEC_length (varinfo_t, varmap);
5694    varinfo_t vi;
5695 -  tree arg; 
5696 +  tree arg;
5697    unsigned int i;
5698    bool is_varargs = false;
5699  
5700    /* Create the variable info.  */
5701  
5702 -  vi = new_var_info (decl, index, name, index);
5703 +  vi = new_var_info (decl, index, name);
5704    vi->decl = decl;
5705    vi->offset = 0;
5706    vi->has_union = 0;
5707    vi->size = 1;
5708    vi->fullsize = count_num_arguments (decl, &is_varargs) + 1;
5709 -  insert_id_for_tree (vi->decl, index);  
5710 +  insert_vi_for_tree (vi->decl, vi);
5711    VEC_safe_push (varinfo_t, heap, varmap, vi);
5712  
5713    stats.total_vars++;
5714 @@ -3898,12 +3868,12 @@
5715        return index;
5716      }
5717  
5718 -  
5719 +
5720    arg = DECL_ARGUMENTS (decl);
5721  
5722    /* Set up variables for each argument.  */
5723    for (i = 1; i < vi->fullsize; i++)
5724 -    {      
5725 +    {
5726        varinfo_t argvi;
5727        const char *newname;
5728        char *tempname;
5729 @@ -3912,13 +3882,13 @@
5730  
5731        if (arg)
5732         argdecl = arg;
5733 -      
5734 +
5735        newindex = VEC_length (varinfo_t, varmap);
5736        asprintf (&tempname, "%s.arg%d", name, i-1);
5737        newname = ggc_strdup (tempname);
5738        free (tempname);
5739  
5740 -      argvi = new_var_info (argdecl, newindex,newname, newindex);
5741 +      argvi = new_var_info (argdecl, newindex, newname);
5742        argvi->decl = argdecl;
5743        VEC_safe_push (varinfo_t, heap, varmap, argvi);
5744        argvi->offset = i;
5745 @@ -3929,7 +3899,7 @@
5746        stats.total_vars ++;
5747        if (arg)
5748         {
5749 -         insert_id_for_tree (arg, newindex);
5750 +         insert_vi_for_tree (arg, argvi);
5751           arg = TREE_CHAIN (arg);
5752         }
5753      }
5754 @@ -3948,13 +3918,13 @@
5755  
5756        if (DECL_RESULT (decl))
5757         resultdecl = DECL_RESULT (decl);
5758 -      
5759 +
5760        newindex = VEC_length (varinfo_t, varmap);
5761        asprintf (&tempname, "%s.result", name);
5762        newname = ggc_strdup (tempname);
5763        free (tempname);
5764  
5765 -      resultvi = new_var_info (resultdecl, newindex, newname, newindex);
5766 +      resultvi = new_var_info (resultdecl, newindex, newname);
5767        resultvi->decl = resultdecl;
5768        VEC_safe_push (varinfo_t, heap, varmap, resultvi);
5769        resultvi->offset = i;
5770 @@ -3964,13 +3934,13 @@
5771        insert_into_field_list_sorted (vi, resultvi);
5772        stats.total_vars ++;
5773        if (DECL_RESULT (decl))
5774 -       insert_id_for_tree (DECL_RESULT (decl), newindex);
5775 +       insert_vi_for_tree (DECL_RESULT (decl), resultvi);
5776      }
5777    return index;
5778 -}  
5779 +}
5780  
5781  
5782 -/* Return true if FIELDSTACK contains fields that overlap. 
5783 +/* Return true if FIELDSTACK contains fields that overlap.
5784     FIELDSTACK is assumed to be sorted by offset.  */
5785  
5786  static bool
5787 @@ -4057,12 +4027,12 @@
5788    bool hasunion;
5789    bool is_global = DECL_P (decl) ? is_global_var (decl) : false;
5790    VEC (fieldoff_s,heap) *fieldstack = NULL;
5791 -  
5792 +
5793    if (TREE_CODE (decl) == FUNCTION_DECL && in_ipa_mode)
5794      return create_function_info_for (decl, name);
5795  
5796    hasunion = TREE_CODE (decltype) == UNION_TYPE
5797 -             || TREE_CODE (decltype) == QUAL_UNION_TYPE;
5798 +            || TREE_CODE (decltype) == QUAL_UNION_TYPE;
5799    if (var_can_have_subvars (decl) && use_field_sensitive && !hasunion)
5800      {
5801        push_fields_onto_fieldstack (decltype, &fieldstack, 0, &hasunion);
5802 @@ -4072,12 +4042,12 @@
5803           notokay = true;
5804         }
5805      }
5806 -  
5807  
5808 +
5809    /* If the variable doesn't have subvars, we may end up needing to
5810       sort the field list and create fake variables for all the
5811       fields.  */
5812 -  vi = new_var_info (decl, index, name, index);
5813 +  vi = new_var_info (decl, index, name);
5814    vi->decl = decl;
5815    vi->offset = 0;
5816    vi->has_union = hasunion;
5817 @@ -4095,8 +4065,8 @@
5818        vi->fullsize = TREE_INT_CST_LOW (declsize);
5819        vi->size = vi->fullsize;
5820      }
5821 -  
5822 -  insert_id_for_tree (vi->decl, index);  
5823 +
5824 +  insert_vi_for_tree (vi->decl, vi);
5825    VEC_safe_push (varinfo_t, heap, varmap, vi);
5826    if (is_global && (!flag_whole_program || !in_ipa_mode))
5827      {
5828 @@ -4122,9 +4092,9 @@
5829      }
5830  
5831    stats.total_vars++;
5832 -  if (use_field_sensitive 
5833 -      && !notokay 
5834 -      && !vi->is_unknown_size_var 
5835 +  if (use_field_sensitive
5836 +      && !notokay
5837 +      && !vi->is_unknown_size_var
5838        && var_can_have_subvars (decl)
5839        && VEC_length (fieldoff_s, fieldstack) <= MAX_FIELDS_FOR_FIELD_SENSITIVE)
5840      {
5841 @@ -4148,7 +4118,7 @@
5842          without creating varinfos for the fields anyway, so sorting them is a
5843          waste to boot.  */
5844        if (!notokay)
5845 -       {       
5846 +       {
5847           sort_fieldstack (fieldstack);
5848           /* Due to some C++ FE issues, like PR 22488, we might end up
5849              what appear to be overlapping fields even though they,
5850 @@ -4156,8 +4126,8 @@
5851              we will simply disable field-sensitivity for these cases.  */
5852           notokay = check_for_overlaps (fieldstack);
5853         }
5854 -      
5855 -      
5856 +
5857 +
5858        if (VEC_length (fieldoff_s, fieldstack) != 0)
5859         fo = VEC_index (fieldoff_s, fieldstack, 0);
5860  
5861 @@ -4169,11 +4139,11 @@
5862           VEC_free (fieldoff_s, heap, fieldstack);
5863           return index;
5864         }
5865 -      
5866 +
5867        vi->size = TREE_INT_CST_LOW (fo->size);
5868        vi->offset = fo->offset;
5869 -      for (i = VEC_length (fieldoff_s, fieldstack) - 1; 
5870 -          i >= 1 && VEC_iterate (fieldoff_s, fieldstack, i, fo); 
5871 +      for (i = VEC_length (fieldoff_s, fieldstack) - 1;
5872 +          i >= 1 && VEC_iterate (fieldoff_s, fieldstack, i, fo);
5873            i--)
5874         {
5875           varinfo_t newvi;
5876 @@ -4184,15 +4154,15 @@
5877           if (dump_file)
5878             {
5879               if (fo->decl)
5880 -               asprintf (&tempname, "%s.%s",
5881 +               asprintf (&tempname, "%s.%s",
5882                           vi->name, alias_get_name (fo->decl));
5883               else
5884 -               asprintf (&tempname, "%s." HOST_WIDE_INT_PRINT_DEC,
5885 +               asprintf (&tempname, "%s." HOST_WIDE_INT_PRINT_DEC,
5886                           vi->name, fo->offset);
5887               newname = ggc_strdup (tempname);
5888               free (tempname);
5889             }
5890 -         newvi = new_var_info (decl, newindex, newname, newindex);
5891 +         newvi = new_var_info (decl, newindex, newname);
5892           newvi->offset = fo->offset;
5893           newvi->size = TREE_INT_CST_LOW (fo->size);
5894           newvi->fullsize = vi->fullsize;
5895 @@ -4228,14 +4198,22 @@
5896  {
5897    varinfo_t vi = get_varinfo (var);
5898    unsigned int i;
5899 -  bitmap_iterator bi; 
5900 -  
5901 -  fprintf (file, "%s = { ", vi->name);
5902 -  EXECUTE_IF_SET_IN_BITMAP (get_varinfo (vi->node)->solution, 0, i, bi)
5903 +  bitmap_iterator bi;
5904 +
5905 +  if (find (var) != var)
5906      {
5907 -      fprintf (file, "%s ", get_varinfo (i)->name);
5908 +      varinfo_t vipt = get_varinfo (find (var));
5909 +      fprintf (file, "%s = same as %s\n", vi->name, vipt->name);
5910      }
5911 -  fprintf (file, "}\n");
5912 +  else
5913 +    {
5914 +      fprintf (file, "%s = { ", vi->name);
5915 +      EXECUTE_IF_SET_IN_BITMAP (vi->solution, 0, i, bi)
5916 +       {
5917 +         fprintf (file, "%s ", get_varinfo (i)->name);
5918 +       }
5919 +      fprintf (file, "}\n");
5920 +    }
5921  }
5922  
5923  /* Print the points-to solution for VAR to stdout.  */
5924 @@ -4266,7 +4244,7 @@
5925        if (!could_have_pointers (t))
5926         continue;
5927        
5928 -      arg_id = get_id_for_tree (t);
5929 +      arg_id = get_vi_for_tree (t)->id;
5930  
5931        /* With flag_argument_noalias greater than two means that the incoming
5932           argument cannot alias anything except for itself so create a HEAP
5933 @@ -4276,11 +4254,10 @@
5934         {
5935           varinfo_t vi;
5936           tree heapvar = heapvar_lookup (t);
5937 -         unsigned int id;
5938           
5939           lhs.offset = 0;
5940           lhs.type = SCALAR;
5941 -         lhs.var  = get_id_for_tree (t);
5942 +         lhs.var  = get_vi_for_tree (t)->id;
5943           
5944           if (heapvar == NULL_TREE)
5945             {
5946 @@ -4291,11 +4268,11 @@
5947                 add_referenced_var (heapvar);
5948               heapvar_insert (t, heapvar);
5949             }
5950 -         id = get_id_for_tree (heapvar);
5951 -         vi = get_varinfo (id);
5952 +
5953 +         vi = get_vi_for_tree (heapvar);
5954           vi->is_artificial_var = 1;
5955           vi->is_heap_var = 1;
5956 -         rhs.var = id;
5957 +         rhs.var = vi->id;
5958           rhs.type = ADDRESSOF;
5959           rhs.offset = 0;
5960            for (p = get_varinfo (lhs.var); p; p = p->next)
5961 @@ -4409,8 +4386,8 @@
5962  bool
5963  find_what_p_points_to (tree p)
5964  {
5965 -  unsigned int id = 0;
5966    tree lookup_p = p;
5967 +  varinfo_t vi;
5968  
5969    if (!have_alias_info)
5970      return false;
5971 @@ -4422,10 +4399,10 @@
5972        && default_def (SSA_NAME_VAR (p)) == p)
5973      lookup_p = SSA_NAME_VAR (p);
5974  
5975 -  if (lookup_id_for_tree (lookup_p, &id))
5976 +  vi = lookup_vi_for_tree (lookup_p);
5977 +  if (vi)
5978      {
5979 -      varinfo_t vi = get_varinfo (id);
5980 -
5981 +      
5982        if (vi->is_artificial_var)
5983         return false;
5984  
5985 @@ -4447,7 +4424,7 @@
5986  
5987           /* This variable may have been collapsed, let's get the real
5988              variable.  */
5989 -         vi = get_varinfo (vi->node);
5990 +         vi = get_varinfo (find (vi->id));
5991           
5992           /* Translate artificial variables into SSA_NAME_PTR_INFO
5993              attributes.  */
5994 @@ -4506,13 +4483,16 @@
5995      {
5996        fprintf (outfile, "Stats:\n");
5997        fprintf (outfile, "Total vars:               %d\n", stats.total_vars);
5998 +      fprintf (outfile, "Non-pointer vars:          %d\n",
5999 +              stats.nonpointer_vars);
6000        fprintf (outfile, "Statically unified vars:  %d\n",
6001                stats.unified_vars_static);
6002 -      fprintf (outfile, "Collapsed vars:           %d\n", stats.collapsed_vars);
6003        fprintf (outfile, "Dynamically unified vars: %d\n",
6004                stats.unified_vars_dynamic);
6005        fprintf (outfile, "Iterations:               %d\n", stats.iterations);
6006        fprintf (outfile, "Number of edges:          %d\n", stats.num_edges);
6007 +      fprintf (outfile, "Number of implicit edges: %d\n",
6008 +              stats.num_implicit_edges);
6009      }
6010  
6011    for (i = 0; i < VEC_length (varinfo_t, varmap); i++)
6012 @@ -4540,8 +4520,8 @@
6013    /* Create the NULL variable, used to represent that a variable points
6014       to NULL.  */
6015    nothing_tree = create_tmp_var_raw (void_type_node, "NULL");
6016 -  var_nothing = new_var_info (nothing_tree, 0, "NULL", 0);
6017 -  insert_id_for_tree (nothing_tree, 0);
6018 +  var_nothing = new_var_info (nothing_tree, 0, "NULL");
6019 +  insert_vi_for_tree (nothing_tree, var_nothing);
6020    var_nothing->is_artificial_var = 1;
6021    var_nothing->offset = 0;
6022    var_nothing->size = ~0;
6023 @@ -4553,8 +4533,8 @@
6024    /* Create the ANYTHING variable, used to represent that a variable
6025       points to some unknown piece of memory.  */
6026    anything_tree = create_tmp_var_raw (void_type_node, "ANYTHING");
6027 -  var_anything = new_var_info (anything_tree, 1, "ANYTHING", 1); 
6028 -  insert_id_for_tree (anything_tree, 1);
6029 +  var_anything = new_var_info (anything_tree, 1, "ANYTHING"); 
6030 +  insert_vi_for_tree (anything_tree, var_anything);
6031    var_anything->is_artificial_var = 1;
6032    var_anything->size = ~0;
6033    var_anything->offset = 0;
6034 @@ -4573,7 +4553,6 @@
6035    rhs.type = ADDRESSOF;
6036    rhs.var = anything_id;
6037    rhs.offset = 0;
6038 -  var_anything->address_taken = true;
6039  
6040    /* This specifically does not use process_constraint because
6041       process_constraint ignores all anything = anything constraints, since all
6042 @@ -4583,14 +4562,14 @@
6043    /* Create the READONLY variable, used to represent that a variable
6044       points to readonly memory.  */
6045    readonly_tree = create_tmp_var_raw (void_type_node, "READONLY");
6046 -  var_readonly = new_var_info (readonly_tree, 2, "READONLY", 2);
6047 +  var_readonly = new_var_info (readonly_tree, 2, "READONLY");
6048    var_readonly->is_artificial_var = 1;
6049    var_readonly->offset = 0;
6050    var_readonly->size = ~0;
6051    var_readonly->fullsize = ~0;
6052    var_readonly->next = NULL;
6053    var_readonly->is_special_var = 1;
6054 -  insert_id_for_tree (readonly_tree, 2);
6055 +  insert_vi_for_tree (readonly_tree, var_readonly);
6056    readonly_id = 2;
6057    VEC_safe_push (varinfo_t, heap, varmap, var_readonly);
6058  
6059 @@ -4610,8 +4589,8 @@
6060    /* Create the INTEGER variable, used to represent that a variable points
6061       to an INTEGER.  */
6062    integer_tree = create_tmp_var_raw (void_type_node, "INTEGER");
6063 -  var_integer = new_var_info (integer_tree, 3, "INTEGER", 3);
6064 -  insert_id_for_tree (integer_tree, 3);
6065 +  var_integer = new_var_info (integer_tree, 3, "INTEGER");
6066 +  insert_vi_for_tree (integer_tree, var_integer);
6067    var_integer->is_artificial_var = 1;
6068    var_integer->size = ~0;
6069    var_integer->fullsize = ~0;
6070 @@ -4634,8 +4613,8 @@
6071    /* Create the ESCAPED_VARS variable used to represent variables that
6072       escape this function.  */
6073    escaped_vars_tree = create_tmp_var_raw (void_type_node, "ESCAPED_VARS");
6074 -  var_escaped_vars = new_var_info (escaped_vars_tree, 4, "ESCAPED_VARS", 4);
6075 -  insert_id_for_tree (escaped_vars_tree, 4);
6076 +  var_escaped_vars = new_var_info (escaped_vars_tree, 4, "ESCAPED_VARS");
6077 +  insert_vi_for_tree (escaped_vars_tree, var_escaped_vars);
6078    var_escaped_vars->is_artificial_var = 1;
6079    var_escaped_vars->size = ~0;
6080    var_escaped_vars->fullsize = ~0;
6081 @@ -4660,21 +4639,19 @@
6082  static void
6083  init_alias_vars (void)
6084  {
6085 -  bitmap_obstack_initialize (&ptabitmap_obstack);
6086 +  bitmap_obstack_initialize (&pta_obstack);
6087 +  bitmap_obstack_initialize (&oldpta_obstack);
6088    bitmap_obstack_initialize (&predbitmap_obstack);
6089  
6090 -  constraint_pool = create_alloc_pool ("Constraint pool", 
6091 +  constraint_pool = create_alloc_pool ("Constraint pool",
6092                                        sizeof (struct constraint), 30);
6093    variable_info_pool = create_alloc_pool ("Variable info pool",
6094                                           sizeof (struct variable_info), 30);
6095 -  constraint_edge_pool = create_alloc_pool ("Constraint edges",
6096 -                                           sizeof (struct constraint_edge), 30);
6097 -  
6098    constraints = VEC_alloc (constraint_t, heap, 8);
6099    varmap = VEC_alloc (varinfo_t, heap, 8);
6100 -  id_for_tree = htab_create (10, tree_id_hash, tree_id_eq, free);
6101 +  vi_for_tree = pointer_map_create ();
6102 +
6103    memset (&stats, 0, sizeof (stats));
6104 -
6105    init_base_vars ();
6106  }
6107  
6108 @@ -4777,6 +4754,43 @@
6109    VEC_free (ce_s, heap, rhsc);
6110  }
6111  
6112 +
6113 +/* Remove the REF and ADDRESS edges from GRAPH, as well as all the
6114 +   predecessor edges.  */
6115 +
6116 +static void
6117 +remove_preds_and_fake_succs (constraint_graph_t graph)
6118 +{
6119 +  unsigned int i;
6120 +
6121 +  /* Clear the implicit ref and address nodes from the successor
6122 +     lists.  */
6123 +  for (i = 0; i < FIRST_REF_NODE; i++)
6124 +    {
6125 +      if (graph->succs[i])
6126 +       bitmap_clear_range (graph->succs[i], FIRST_REF_NODE,
6127 +                           FIRST_REF_NODE * 2);
6128 +    }
6129 +
6130 +  /* Free the successor list for the non-ref nodes.  */
6131 +  for (i = FIRST_REF_NODE; i < graph->size; i++)
6132 +    {
6133 +      if (graph->succs[i])
6134 +       BITMAP_FREE (graph->succs[i]);
6135 +    }
6136 +
6137 +  /* Now reallocate the size of the successor list as, and blow away
6138 +     the predecessor bitmaps.  */
6139 +  graph->size = VEC_length (varinfo_t, varmap);
6140 +  graph->succs = xrealloc (graph->succs, graph->size * sizeof (bitmap));
6141 +
6142 +  free (graph->implicit_preds);
6143 +  graph->implicit_preds = NULL;
6144 +  free (graph->preds);
6145 +  graph->preds = NULL;
6146 +  bitmap_obstack_release (&predbitmap_obstack);
6147 +}
6148 +
6149  /* Create points-to sets for the current function.  See the comments
6150     at the start of the file for an algorithmic overview.  */
6151  
6152 @@ -4784,11 +4798,13 @@
6153  compute_points_to_sets (struct alias_info *ai)
6154  {
6155    basic_block bb;
6156 +  struct scc_info *si;
6157  
6158    timevar_push (TV_TREE_PTA);
6159  
6160    init_alias_vars ();
6161 -
6162 +  init_alias_heapvars ();
6163 +  
6164    intra_create_variable_infos ();
6165  
6166    /* Now walk all statements and derive aliases.  */
6167 @@ -4824,36 +4840,42 @@
6168         }
6169      }
6170  
6171 -  build_constraint_graph ();
6172  
6173    if (dump_file)
6174      {
6175        fprintf (dump_file, "Points-to analysis\n\nConstraints:\n\n");
6176        dump_constraints (dump_file);
6177      }
6178 -  
6179 +
6180    if (dump_file)
6181      fprintf (dump_file,
6182              "\nCollapsing static cycles and doing variable "
6183              "substitution:\n");
6184 -      
6185 -  find_and_collapse_graph_cycles (graph, false);
6186 -  perform_var_substitution (graph);
6187 -      
6188 +
6189 +  build_pred_graph ();
6190 +  si = perform_var_substitution (graph);
6191 +  move_complex_constraints (graph, si);
6192 +  free_var_substitution_info (si);
6193 +  
6194 +  build_succ_graph ();
6195 +  find_indirect_cycles (graph);
6196 +
6197 +  /* Implicit nodes and predecessors are no longer necessary at this
6198 +     point. */
6199 +  remove_preds_and_fake_succs (graph);
6200 +
6201    if (dump_file)
6202      fprintf (dump_file, "\nSolving graph:\n");
6203 -      
6204 +
6205    solve_graph (graph);
6206 -  
6207 +
6208    if (dump_file)
6209      dump_sa_points_to_info (dump_file);
6210 -  
6211    have_alias_info = true;
6212  
6213    timevar_pop (TV_TREE_PTA);
6214  }
6215  
6216 -
6217  /* Delete created points-to sets.  */
6218  
6219  void
6220 @@ -4861,33 +4883,27 @@
6221  {
6222    varinfo_t v;
6223    int i;
6224 -  
6225 -  htab_delete (id_for_tree);
6226 -  bitmap_obstack_release (&ptabitmap_obstack);
6227 -  bitmap_obstack_release (&predbitmap_obstack);
6228 +
6229 +  if (dump_file && (dump_flags & TDF_STATS))
6230 +    fprintf (dump_file, "Points to sets created:%d\n",
6231 +            stats.points_to_sets_created);
6232 +
6233 +  pointer_map_destroy (vi_for_tree);
6234 +  bitmap_obstack_release (&pta_obstack);
6235    VEC_free (constraint_t, heap, constraints);
6236 -  
6237 +
6238    for (i = 0; VEC_iterate (varinfo_t, varmap, i, v); i++)
6239 -    {
6240 -      /* Nonlocal vars may add more varinfos.  */
6241 -      if (i >= graph_size)
6242 -       break;
6243 +    VEC_free (constraint_t, heap, graph->complex[i]);
6244 +  free (graph->complex);
6245  
6246 -      VEC_free (constraint_edge_t, heap, graph->succs[i]);
6247 -      VEC_free (constraint_edge_t, heap, graph->preds[i]);
6248 -      VEC_free (constraint_t, heap, v->complex);
6249 -    }
6250 -  free (graph->zero_weight_preds);
6251 -  free (graph->zero_weight_succs);
6252 +  free (graph->rep);
6253    free (graph->succs);
6254 -  free (graph->preds);
6255 +  free (graph->indirect_cycles);
6256    free (graph);
6257  
6258    VEC_free (varinfo_t, heap, varmap);
6259    free_alloc_pool (variable_info_pool);
6260 -  free_alloc_pool (constraint_pool); 
6261 -  free_alloc_pool (constraint_edge_pool);
6262 -
6263 +  free_alloc_pool (constraint_pool);
6264    have_alias_info = false;
6265  }
6266  
6267 @@ -4905,6 +4921,7 @@
6268  static unsigned int
6269  ipa_pta_execute (void)
6270  {
6271 +#if 0
6272    struct cgraph_node *node;
6273    in_ipa_mode = 1;
6274    init_alias_heapvars ();
6275 @@ -4994,6 +5011,7 @@
6276    in_ipa_mode = 0;
6277    delete_alias_heapvars ();
6278    delete_points_to_sets ();
6279 +#endif
6280    return 0;
6281  }
6282    
6283 @@ -5018,8 +5036,9 @@
6284  void
6285  init_alias_heapvars (void)
6286  {
6287 -  heapvar_for_stmt = htab_create_ggc (11, tree_map_hash, tree_map_eq,
6288 -                                     NULL);
6289 +  if (!heapvar_for_stmt)
6290 +    heapvar_for_stmt = htab_create_ggc (11, tree_map_hash, tree_map_eq,
6291 +                                       NULL);
6292    nonlocal_all = NULL_TREE;
6293  }
6294  
6295 @@ -5028,7 +5047,7 @@
6296  {
6297    nonlocal_all = NULL_TREE;
6298    htab_delete (heapvar_for_stmt);
6299 +  heapvar_for_stmt = NULL;
6300  }
6301 -
6302    
6303  #include "gt-tree-ssa-structalias.h"
6304 Index: gcc/config/i386/i386.md
6305 ===================================================================
6306 --- gcc/config/i386/i386.md     (.../tags/gcc_4_2_0_release)    (wersja 125589)
6307 +++ gcc/config/i386/i386.md     (.../branches/gcc-4_2-branch)   (wersja 125589)
6308 @@ -4749,7 +4749,7 @@
6309  (define_insn "*addti3_1"
6310    [(set (match_operand:TI 0 "nonimmediate_operand" "=r,o")
6311         (plus:TI (match_operand:TI 1 "nonimmediate_operand" "%0,0")
6312 -                (match_operand:TI 2 "general_operand" "roiF,riF")))
6313 +                (match_operand:TI 2 "x86_64_general_operand" "roe,re")))
6314     (clobber (reg:CC FLAGS_REG))]
6315    "TARGET_64BIT && ix86_binary_operator_ok (PLUS, TImode, operands)"
6316    "#")
6317 @@ -4757,7 +4757,7 @@
6318  (define_split
6319    [(set (match_operand:TI 0 "nonimmediate_operand" "")
6320         (plus:TI (match_operand:TI 1 "nonimmediate_operand" "")
6321 -                (match_operand:TI 2 "general_operand" "")))
6322 +                (match_operand:TI 2 "x86_64_general_operand" "")))
6323     (clobber (reg:CC FLAGS_REG))]
6324    "TARGET_64BIT && reload_completed"
6325    [(parallel [(set (reg:CC FLAGS_REG) (unspec:CC [(match_dup 1) (match_dup 2)]
6326 @@ -6483,7 +6483,7 @@
6327  (define_insn "*subti3_1"
6328    [(set (match_operand:TI 0 "nonimmediate_operand" "=r,o")
6329         (minus:TI (match_operand:TI 1 "nonimmediate_operand" "0,0")
6330 -                 (match_operand:TI 2 "general_operand" "roiF,riF")))
6331 +                 (match_operand:TI 2 "x86_64_general_operand" "roe,re")))
6332     (clobber (reg:CC FLAGS_REG))]
6333    "TARGET_64BIT && ix86_binary_operator_ok (MINUS, TImode, operands)"
6334    "#")
6335 @@ -6491,7 +6491,7 @@
6336  (define_split
6337    [(set (match_operand:TI 0 "nonimmediate_operand" "")
6338         (minus:TI (match_operand:TI 1 "nonimmediate_operand" "")
6339 -                 (match_operand:TI 2 "general_operand" "")))
6340 +                 (match_operand:TI 2 "x86_64_general_operand" "")))
6341     (clobber (reg:CC FLAGS_REG))]
6342    "TARGET_64BIT && reload_completed"
6343    [(parallel [(set (reg:CC FLAGS_REG) (compare:CC (match_dup 1) (match_dup 2)))
6344 @@ -9326,7 +9326,7 @@
6345  
6346  (define_insn "*negti2_1"
6347    [(set (match_operand:TI 0 "nonimmediate_operand" "=ro")
6348 -       (neg:TI (match_operand:TI 1 "general_operand" "0")))
6349 +       (neg:TI (match_operand:TI 1 "nonimmediate_operand" "0")))
6350     (clobber (reg:CC FLAGS_REG))]
6351    "TARGET_64BIT
6352     && ix86_unary_operator_ok (NEG, TImode, operands)"
6353 @@ -9334,7 +9334,7 @@
6354  
6355  (define_split
6356    [(set (match_operand:TI 0 "nonimmediate_operand" "")
6357 -       (neg:TI (match_operand:TI 1 "general_operand" "")))
6358 +       (neg:TI (match_operand:TI 1 "nonimmediate_operand" "")))
6359     (clobber (reg:CC FLAGS_REG))]
6360    "TARGET_64BIT && reload_completed"
6361    [(parallel
6362 Index: gcc/config/i386/sse.md
6363 ===================================================================
6364 --- gcc/config/i386/sse.md      (.../tags/gcc_4_2_0_release)    (wersja 125589)
6365 +++ gcc/config/i386/sse.md      (.../branches/gcc-4_2-branch)   (wersja 125589)
6366 @@ -2055,11 +2055,11 @@
6367             (match_dup 1))
6368           (parallel [(const_int 0)
6369                      (const_int 2)])))]
6370 -  "TARGET_SSE3 && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
6371 +  "TARGET_SSE3 && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
6372    "@
6373     movddup\t{%1, %0|%0, %1}
6374     #"
6375 -  [(set_attr "type" "sselog,ssemov")
6376 +  [(set_attr "type" "sselog1,ssemov")
6377     (set_attr "mode" "V2DF")])
6378  
6379  (define_split
6380 @@ -3494,9 +3494,10 @@
6381    "TARGET_SSE2 && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
6382    "@
6383     movhps\t{%1, %0|%0, %1}
6384 -   psrldq\t{$4, %0|%0, 4}
6385 +   psrldq\t{$8, %0|%0, 8}
6386     movq\t{%H1, %0|%0, %H1}"
6387    [(set_attr "type" "ssemov,sseishft,ssemov")
6388 +   (set_attr "memory" "*,none,*")
6389     (set_attr "mode" "V2SF,TI,TI")])
6390  
6391  ;; Not sure this is ever used, but it doesn't hurt to have it. -aoliva
6392 Index: gcc/config/i386/i386.c
6393 ===================================================================
6394 --- gcc/config/i386/i386.c      (.../tags/gcc_4_2_0_release)    (wersja 125589)
6395 +++ gcc/config/i386/i386.c      (.../branches/gcc-4_2-branch)   (wersja 125589)
6396 @@ -15539,13 +15539,13 @@
6397    /* Access to the vec_extract patterns.  */
6398    ftype = build_function_type_list (double_type_node, V2DF_type_node,
6399                                     integer_type_node, NULL_TREE);
6400 -  def_builtin (MASK_SSE, "__builtin_ia32_vec_ext_v2df",
6401 +  def_builtin (MASK_SSE2, "__builtin_ia32_vec_ext_v2df",
6402                ftype, IX86_BUILTIN_VEC_EXT_V2DF);
6403  
6404    ftype = build_function_type_list (long_long_integer_type_node,
6405                                     V2DI_type_node, integer_type_node,
6406                                     NULL_TREE);
6407 -  def_builtin (MASK_SSE, "__builtin_ia32_vec_ext_v2di",
6408 +  def_builtin (MASK_SSE2, "__builtin_ia32_vec_ext_v2di",
6409                ftype, IX86_BUILTIN_VEC_EXT_V2DI);
6410  
6411    ftype = build_function_type_list (float_type_node, V4SF_type_node,
6412 @@ -15555,12 +15555,12 @@
6413  
6414    ftype = build_function_type_list (intSI_type_node, V4SI_type_node,
6415                                     integer_type_node, NULL_TREE);
6416 -  def_builtin (MASK_SSE, "__builtin_ia32_vec_ext_v4si",
6417 +  def_builtin (MASK_SSE2, "__builtin_ia32_vec_ext_v4si",
6418                ftype, IX86_BUILTIN_VEC_EXT_V4SI);
6419  
6420    ftype = build_function_type_list (intHI_type_node, V8HI_type_node,
6421                                     integer_type_node, NULL_TREE);
6422 -  def_builtin (MASK_SSE, "__builtin_ia32_vec_ext_v8hi",
6423 +  def_builtin (MASK_SSE2, "__builtin_ia32_vec_ext_v8hi",
6424                ftype, IX86_BUILTIN_VEC_EXT_V8HI);
6425  
6426    ftype = build_function_type_list (intHI_type_node, V4HI_type_node,
6427 @@ -15577,7 +15577,7 @@
6428    ftype = build_function_type_list (V8HI_type_node, V8HI_type_node,
6429                                     intHI_type_node,
6430                                     integer_type_node, NULL_TREE);
6431 -  def_builtin (MASK_SSE, "__builtin_ia32_vec_set_v8hi",
6432 +  def_builtin (MASK_SSE2, "__builtin_ia32_vec_set_v8hi",
6433                ftype, IX86_BUILTIN_VEC_SET_V8HI);
6434  
6435    ftype = build_function_type_list (V4HI_type_node, V4HI_type_node,
6436 Index: gcc/config/sh/sh.c
6437 ===================================================================
6438 --- gcc/config/sh/sh.c  (.../tags/gcc_4_2_0_release)    (wersja 125589)
6439 +++ gcc/config/sh/sh.c  (.../branches/gcc-4_2-branch)   (wersja 125589)
6440 @@ -5295,7 +5295,13 @@
6441               temp = scavenge_reg (&temps);
6442             }
6443           if (temp < 0 && live_regs_mask)
6444 -           temp = scavenge_reg (live_regs_mask);
6445 +           {
6446 +             HARD_REG_SET temps;
6447 +
6448 +             COPY_HARD_REG_SET (temps, *live_regs_mask);
6449 +             CLEAR_HARD_REG_BIT (temps, REGNO (reg));
6450 +             temp = scavenge_reg (&temps);
6451 +           }
6452           if (temp < 0)
6453             {
6454               rtx adj_reg, tmp_reg, mem;
6455 @@ -5344,6 +5350,9 @@
6456               emit_move_insn (adj_reg, mem);
6457               mem = gen_tmp_stack_mem (Pmode, gen_rtx_POST_INC (Pmode, reg));
6458               emit_move_insn (tmp_reg, mem);
6459 +             /* Tell flow the insns that pop r4/r5 aren't dead.  */
6460 +             emit_insn (gen_rtx_USE (VOIDmode, tmp_reg));
6461 +             emit_insn (gen_rtx_USE (VOIDmode, adj_reg));
6462               return;
6463             }
6464           const_reg = gen_rtx_REG (GET_MODE (reg), temp);
6465 @@ -8618,7 +8627,7 @@
6466        else if (TARGET_SH4
6467                && get_attr_type (insn) == TYPE_DYN_SHIFT
6468                && get_attr_any_int_load (dep_insn) == ANY_INT_LOAD_YES
6469 -              && reg_overlap_mentioned_p (SET_DEST (PATTERN (dep_insn)),
6470 +              && reg_overlap_mentioned_p (SET_DEST (single_set (dep_insn)),
6471                                            XEXP (SET_SRC (single_set (insn)),
6472                                                  1)))
6473         cost++;
6474 Index: gcc/config/sh/sh.md
6475 ===================================================================
6476 --- gcc/config/sh/sh.md (.../tags/gcc_4_2_0_release)    (wersja 125589)
6477 +++ gcc/config/sh/sh.md (.../branches/gcc-4_2-branch)   (wersja 125589)
6478 @@ -413,10 +413,12 @@
6479          (eq_attr "type" "jump")
6480          (cond [(eq_attr "med_branch_p" "yes")
6481                 (const_int 2)
6482 -               (and (eq (symbol_ref "GET_CODE (prev_nonnote_insn (insn))")
6483 -                         (symbol_ref "INSN"))
6484 -                     (eq (symbol_ref "INSN_CODE (prev_nonnote_insn (insn))")
6485 -                         (symbol_ref "code_for_indirect_jump_scratch")))
6486 +               (and (ne (symbol_ref "prev_nonnote_insn (insn)")
6487 +                        (const_int 0))
6488 +                    (and (eq (symbol_ref "GET_CODE (prev_nonnote_insn (insn))")
6489 +                             (symbol_ref "INSN"))
6490 +                         (eq (symbol_ref "INSN_CODE (prev_nonnote_insn (insn))")
6491 +                             (symbol_ref "code_for_indirect_jump_scratch"))))
6492                  (cond [(eq_attr "braf_branch_p" "yes")
6493                         (const_int 6)
6494                         (eq (symbol_ref "flag_pic") (const_int 0))
6495 @@ -750,54 +752,6 @@
6496     (set_attr "type" "arith3")])
6497  
6498  (define_insn "cmpeqsi_media"
6499 -  [(set (match_operand:DI 0 "register_operand" "=r")
6500 -       (eq:DI (match_operand:SI 1 "logical_operand" "%r")
6501 -              (match_operand:SI 2 "cmp_operand" "Nr")))]
6502 -  "TARGET_SHMEDIA"
6503 -  "cmpeq       %1, %N2, %0"
6504 -  [(set_attr "type" "cmp_media")])
6505 -
6506 -(define_insn "cmpeqdi_media"
6507 -  [(set (match_operand:DI 0 "register_operand" "=r")
6508 -       (eq:DI (match_operand:DI 1 "register_operand" "%r")
6509 -              (match_operand:DI 2 "cmp_operand" "Nr")))]
6510 -  "TARGET_SHMEDIA"
6511 -  "cmpeq       %1, %N2, %0"
6512 -  [(set_attr "type" "cmp_media")])
6513 -
6514 -(define_insn "cmpgtsi_media"
6515 -  [(set (match_operand:DI 0 "register_operand" "=r")
6516 -       (gt:DI (match_operand:SI 1 "cmp_operand" "Nr")
6517 -              (match_operand:SI 2 "cmp_operand" "rN")))]
6518 -  "TARGET_SHMEDIA"
6519 -  "cmpgt       %N1, %N2, %0"
6520 -  [(set_attr "type" "cmp_media")])
6521 -
6522 -(define_insn "cmpgtdi_media"
6523 -  [(set (match_operand:DI 0 "register_operand" "=r")
6524 -       (gt:DI (match_operand:DI 1 "arith_reg_or_0_operand" "Nr")
6525 -              (match_operand:DI 2 "arith_reg_or_0_operand" "rN")))]
6526 -  "TARGET_SHMEDIA"
6527 -  "cmpgt       %N1, %N2, %0"
6528 -  [(set_attr "type" "cmp_media")])
6529 -
6530 -(define_insn "cmpgtusi_media"
6531 -  [(set (match_operand:DI 0 "register_operand" "=r")
6532 -       (gtu:DI (match_operand:SI 1 "cmp_operand" "Nr")
6533 -               (match_operand:SI 2 "cmp_operand" "rN")))]
6534 -  "TARGET_SHMEDIA"
6535 -  "cmpgtu      %N1, %N2, %0"
6536 -  [(set_attr "type" "cmp_media")])
6537 -
6538 -(define_insn "cmpgtudi_media"
6539 -  [(set (match_operand:DI 0 "register_operand" "=r")
6540 -       (gtu:DI (match_operand:DI 1 "arith_reg_or_0_operand" "Nr")
6541 -               (match_operand:DI 2 "arith_reg_or_0_operand" "rN")))]
6542 -  "TARGET_SHMEDIA"
6543 -  "cmpgtu      %N1, %N2, %0"
6544 -  [(set_attr "type" "cmp_media")])
6545 -
6546 -(define_insn "cmpsieqsi_media"
6547    [(set (match_operand:SI 0 "register_operand" "=r")
6548         (eq:SI (match_operand:SI 1 "logical_operand" "%r")
6549                (match_operand:SI 2 "cmp_operand" "Nr")))]
6550 @@ -805,7 +759,7 @@
6551    "cmpeq       %1, %N2, %0"
6552    [(set_attr "type" "cmp_media")])
6553  
6554 -(define_insn "cmpsieqdi_media"
6555 +(define_insn "cmpeqdi_media"
6556    [(set (match_operand:SI 0 "register_operand" "=r")
6557         (eq:SI (match_operand:DI 1 "register_operand" "%r")
6558                (match_operand:DI 2 "cmp_operand" "Nr")))]
6559 @@ -813,7 +767,7 @@
6560    "cmpeq       %1, %N2, %0"
6561    [(set_attr "type" "cmp_media")])
6562  
6563 -(define_insn "cmpsigtsi_media"
6564 +(define_insn "cmpgtsi_media"
6565    [(set (match_operand:SI 0 "register_operand" "=r")
6566         (gt:SI (match_operand:SI 1 "cmp_operand" "Nr")
6567                (match_operand:SI 2 "cmp_operand" "rN")))]
6568 @@ -821,7 +775,7 @@
6569    "cmpgt       %N1, %N2, %0"
6570    [(set_attr "type" "cmp_media")])
6571  
6572 -(define_insn "cmpsigtdi_media"
6573 +(define_insn "cmpgtdi_media"
6574    [(set (match_operand:SI 0 "register_operand" "=r")
6575         (gt:SI (match_operand:DI 1 "arith_reg_or_0_operand" "Nr")
6576                (match_operand:DI 2 "arith_reg_or_0_operand" "rN")))]
6577 @@ -829,7 +783,7 @@
6578    "cmpgt       %N1, %N2, %0"
6579    [(set_attr "type" "cmp_media")])
6580  
6581 -(define_insn "cmpsigtusi_media"
6582 +(define_insn "cmpgtusi_media"
6583    [(set (match_operand:SI 0 "register_operand" "=r")
6584         (gtu:SI (match_operand:SI 1 "cmp_operand" "Nr")
6585                 (match_operand:SI 2 "cmp_operand" "rN")))]
6586 @@ -837,7 +791,7 @@
6587    "cmpgtu      %N1, %N2, %0"
6588    [(set_attr "type" "cmp_media")])
6589  
6590 -(define_insn "cmpsigtudi_media"
6591 +(define_insn "cmpgtudi_media"
6592    [(set (match_operand:SI 0 "register_operand" "=r")
6593         (gtu:SI (match_operand:DI 1 "arith_reg_or_0_operand" "Nr")
6594                 (match_operand:DI 2 "arith_reg_or_0_operand" "rN")))]
6595 @@ -846,13 +800,6 @@
6596    [(set_attr "type" "cmp_media")])
6597  
6598  ; These two patterns are for combine.
6599 -(define_insn "*cmpne0si_media"
6600 -  [(set (match_operand:DI 0 "register_operand" "=r")
6601 -       (ne:DI (match_operand:SI 1 "arith_reg_operand" "r") (const_int 0)))]
6602 -  "TARGET_SHMEDIA"
6603 -  "cmpgtu      %1,r63,%0"
6604 -  [(set_attr "type" "cmp_media")])
6605 -
6606  (define_insn "*cmpne0sisi_media"
6607    [(set (match_operand:SI 0 "register_operand" "=r")
6608         (ne:SI (match_operand:SI 1 "arith_reg_operand" "r") (const_int 0)))]
6609 @@ -1177,7 +1124,7 @@
6610  {
6611    emit_insn (gen_movsicc_false (operands[0], operands[1], operands[2],
6612                                 operands[3]));
6613 -  emit_insn (gen_cmpsigtusi_media (operands[5], operands[4], operands[0]));
6614 +  emit_insn (gen_cmpgtusi_media (operands[5], operands[4], operands[0]));
6615    emit_insn (gen_movsicc_false (operands[0], operands[5], operands[4],
6616                                 operands[0]));
6617    DONE;
6618 @@ -7200,7 +7147,7 @@
6619  }")
6620  
6621  (define_expand "bunordered"
6622 -  [(set (match_dup 1) (unordered:DI (match_dup 2) (match_dup 3)))
6623 +  [(set (match_dup 1) (unordered:SI (match_dup 2) (match_dup 3)))
6624     (set (pc)
6625         (if_then_else (ne (match_dup 1) (const_int 0))
6626                       (match_operand 0 "" "")
6627 @@ -7209,7 +7156,7 @@
6628    "
6629  {
6630    operands[0] = gen_rtx_LABEL_REF (Pmode, operands[0]);
6631 -  operands[1] = gen_reg_rtx (DImode);
6632 +  operands[1] = gen_reg_rtx (SImode);
6633    operands[2] = force_reg (GET_MODE (sh_compare_op0), sh_compare_op0);
6634    operands[3] = force_reg (GET_MODE (sh_compare_op1), sh_compare_op1);
6635  }")
6636 @@ -8397,6 +8344,20 @@
6637                                              operands[2],
6638                                              gen_rtx_REG (Pmode, PIC_REG)));
6639  
6640 +  /* When stack protector inserts codes after the result is set to
6641 +     R0, @(rX, r12) will cause a spill failure for R0.  Don't schedule
6642 +     insns to avoid combining (set A (plus rX r12)) and (set op0 (mem A))
6643 +     when rX is a GOT address for the guard symbol.  Ugly but doesn't
6644 +     matter because this is a rare situation.  */
6645 +  if (!TARGET_SHMEDIA
6646 +      && flag_stack_protect
6647 +      && GET_CODE (operands[1]) == CONST
6648 +      && GET_CODE (XEXP (operands[1], 0)) == UNSPEC
6649 +      && GET_CODE (XVECEXP (XEXP (operands[1], 0), 0, 0)) == SYMBOL_REF
6650 +      && strcmp (XSTR (XVECEXP (XEXP (operands[1], 0), 0, 0), 0),
6651 +                \"__stack_chk_guard\") == 0)
6652 +    emit_insn (gen_blockage ());
6653 +
6654    /* N.B. This is not constant for a GOTPLT relocation.  */
6655    mem = gen_rtx_MEM (Pmode, operands[3]);
6656    MEM_NOTRAP_P (mem) = 1;
6657 @@ -9112,6 +9073,8 @@
6658  {
6659    if (TARGET_SHMEDIA)
6660      {
6661 +      rtx reg;
6662 +
6663        sh_compare_op0 = force_reg (GET_MODE (sh_compare_op0), sh_compare_op0);
6664        if (sh_compare_op1 != const0_rtx)
6665         sh_compare_op1 = force_reg (GET_MODE (sh_compare_op1) == VOIDmode
6666 @@ -9126,26 +9089,26 @@
6667           switch (GET_MODE (sh_compare_op0))
6668             {
6669             case SImode:
6670 -             emit_insn (gen_cmpsieqsi_media (operands[0],
6671 +             emit_insn (gen_cmpeqsi_media (operands[0],
6672                                               sh_compare_op0, sh_compare_op1));
6673               break;
6674  
6675             case DImode:
6676 -             emit_insn (gen_cmpsieqdi_media (operands[0],
6677 +             emit_insn (gen_cmpeqdi_media (operands[0],
6678                                               sh_compare_op0, sh_compare_op1));
6679               break;
6680  
6681             case SFmode:
6682               if (! TARGET_SHMEDIA_FPU)
6683                 FAIL;
6684 -             emit_insn (gen_cmpsieqsf_media (operands[0],
6685 +             emit_insn (gen_cmpeqsf_media (operands[0],
6686                                               sh_compare_op0, sh_compare_op1));
6687               break;
6688  
6689             case DFmode:
6690               if (! TARGET_SHMEDIA_FPU)
6691                 FAIL;
6692 -             emit_insn (gen_cmpsieqdf_media (operands[0],
6693 +             emit_insn (gen_cmpeqdf_media (operands[0],
6694                                               sh_compare_op0, sh_compare_op1));
6695               break;
6696  
6697 @@ -9155,38 +9118,44 @@
6698           DONE;
6699         }
6700  
6701 -      if (GET_MODE (operands[0]) != DImode)
6702 -       operands[0] = gen_rtx_SUBREG (DImode, operands[0], 0);
6703 +      reg = operands[0];
6704 +      if (GET_MODE (operands[0]) != SImode)
6705 +       reg = no_new_pseudos ? gen_rtx_SUBREG (SImode, operands[0], 0)
6706 +                            : gen_reg_rtx (SImode);
6707  
6708        switch (GET_MODE (sh_compare_op0))
6709         {
6710         case SImode:
6711 -         emit_insn (gen_cmpeqsi_media (operands[0],
6712 +         emit_insn (gen_cmpeqsi_media (reg,
6713                                         sh_compare_op0, sh_compare_op1));
6714           break;
6715  
6716         case DImode:
6717 -         emit_insn (gen_cmpeqdi_media (operands[0],
6718 +         emit_insn (gen_cmpeqdi_media (reg,
6719                                         sh_compare_op0, sh_compare_op1));
6720           break;
6721  
6722         case SFmode:
6723           if (! TARGET_SHMEDIA_FPU)
6724             FAIL;
6725 -         emit_insn (gen_cmpeqsf_media (operands[0],
6726 +         emit_insn (gen_cmpeqsf_media (reg,
6727                                         sh_compare_op0, sh_compare_op1));
6728           break;
6729  
6730         case DFmode:
6731           if (! TARGET_SHMEDIA_FPU)
6732             FAIL;
6733 -         emit_insn (gen_cmpeqdf_media (operands[0],
6734 +         emit_insn (gen_cmpeqdf_media (reg,
6735                                         sh_compare_op0, sh_compare_op1));
6736           break;
6737  
6738         default:
6739           FAIL;
6740         }
6741 +
6742 +      if (GET_MODE (operands[0]) == DImode)
6743 +       emit_insn (gen_extendsidi2 (operands[0], reg));
6744 +
6745        DONE;
6746      }
6747    if (sh_expand_t_scc (EQ, operands[0]))
6748 @@ -9204,8 +9173,8 @@
6749  {
6750    if (TARGET_SHMEDIA)
6751      {
6752 -      if (GET_MODE (operands[0]) != DImode)
6753 -       operands[0] = gen_rtx_SUBREG (DImode, operands[0], 0);
6754 +      rtx reg;
6755 +
6756        sh_compare_op0 = force_reg (GET_MODE (sh_compare_op0), sh_compare_op0);
6757        if (sh_compare_op1 != const0_rtx)
6758         sh_compare_op1 = force_reg (GET_MODE (sh_compare_op1) == VOIDmode
6759 @@ -9213,35 +9182,44 @@
6760                                     : GET_MODE (sh_compare_op1),
6761                                     sh_compare_op1);
6762  
6763 +      reg = operands[0];
6764 +      if (GET_MODE (operands[0]) != SImode)
6765 +       reg = no_new_pseudos ? gen_rtx_SUBREG (SImode, operands[0], 0)
6766 +                            : gen_reg_rtx (SImode);
6767 +
6768        switch (GET_MODE (sh_compare_op0))
6769         {
6770         case SImode:
6771 -         emit_insn (gen_cmpgtsi_media (operands[0],
6772 +         emit_insn (gen_cmpgtsi_media (reg,
6773                                         sh_compare_op1, sh_compare_op0));
6774           break;
6775  
6776         case DImode:
6777 -         emit_insn (gen_cmpgtdi_media (operands[0],
6778 +         emit_insn (gen_cmpgtdi_media (reg,
6779                                         sh_compare_op1, sh_compare_op0));
6780           break;
6781  
6782         case SFmode:
6783           if (! TARGET_SHMEDIA_FPU)
6784             FAIL;
6785 -         emit_insn (gen_cmpgtsf_media (operands[0],
6786 +         emit_insn (gen_cmpgtsf_media (reg,
6787                                         sh_compare_op1, sh_compare_op0));
6788           break;
6789  
6790         case DFmode:
6791           if (! TARGET_SHMEDIA_FPU)
6792             FAIL;
6793 -         emit_insn (gen_cmpgtdf_media (operands[0],
6794 +         emit_insn (gen_cmpgtdf_media (reg,
6795                                         sh_compare_op1, sh_compare_op0));
6796           break;
6797  
6798         default:
6799           FAIL;
6800         }
6801 +
6802 +      if (GET_MODE (operands[0]) == DImode)
6803 +       emit_insn (gen_extendsidi2 (operands[0], reg));
6804 +
6805        DONE;
6806      }
6807    if (! currently_expanding_to_rtl)
6808 @@ -9258,8 +9236,8 @@
6809  
6810    if (TARGET_SHMEDIA)
6811      {
6812 -      if (GET_MODE (operands[0]) != DImode)
6813 -       operands[0] = gen_rtx_SUBREG (DImode, operands[0], 0);
6814 +      rtx reg;
6815 +
6816        sh_compare_op0 = force_reg (GET_MODE (sh_compare_op0), sh_compare_op0);
6817        if (sh_compare_op1 != const0_rtx)
6818         sh_compare_op1 = force_reg (GET_MODE (sh_compare_op1) == VOIDmode
6819 @@ -9267,45 +9245,54 @@
6820                                     : GET_MODE (sh_compare_op1),
6821                                     sh_compare_op1);
6822  
6823 +      reg = operands[0];
6824 +      if (GET_MODE (operands[0]) != SImode)
6825 +       reg = no_new_pseudos ? gen_rtx_SUBREG (SImode, operands[0], 0)
6826 +                            : gen_reg_rtx (SImode);
6827 +
6828        switch (GET_MODE (sh_compare_op0))
6829         {
6830         case SImode:
6831           {
6832 -           tmp = no_new_pseudos ? operands[0] : gen_reg_rtx (DImode);
6833 +           tmp = no_new_pseudos ? reg : gen_reg_rtx (SImode);
6834  
6835             emit_insn (gen_cmpgtsi_media (tmp,
6836                                           sh_compare_op0, sh_compare_op1));
6837 -           emit_insn (gen_cmpeqdi_media (operands[0], tmp, const0_rtx));
6838 +           emit_insn (gen_cmpeqdi_media (reg, tmp, const0_rtx));
6839             break;
6840           }
6841  
6842         case DImode:
6843           {
6844 -           tmp = no_new_pseudos ? operands[0] : gen_reg_rtx (DImode);
6845 +           tmp = no_new_pseudos ? reg : gen_reg_rtx (SImode);
6846  
6847             emit_insn (gen_cmpgtdi_media (tmp,
6848                                           sh_compare_op0, sh_compare_op1));
6849 -           emit_insn (gen_cmpeqdi_media (operands[0], tmp, const0_rtx));
6850 +           emit_insn (gen_cmpeqdi_media (reg, tmp, const0_rtx));
6851             break;
6852           }
6853  
6854         case SFmode:
6855           if (! TARGET_SHMEDIA_FPU)
6856             FAIL;
6857 -         emit_insn (gen_cmpgesf_media (operands[0],
6858 +         emit_insn (gen_cmpgesf_media (reg,
6859                                         sh_compare_op1, sh_compare_op0));
6860           break;
6861  
6862         case DFmode:
6863           if (! TARGET_SHMEDIA_FPU)
6864             FAIL;
6865 -         emit_insn (gen_cmpgedf_media (operands[0],
6866 +         emit_insn (gen_cmpgedf_media (reg,
6867                                         sh_compare_op1, sh_compare_op0));
6868           break;
6869  
6870         default:
6871           FAIL;
6872         }
6873 +
6874 +      if (GET_MODE (operands[0]) == DImode)
6875 +       emit_insn (gen_extendsidi2 (operands[0], reg));
6876 +
6877        DONE;
6878      }
6879  
6880 @@ -9323,8 +9310,12 @@
6881  {
6882    if (TARGET_SHMEDIA)
6883      {
6884 -      if (GET_MODE (operands[0]) != DImode)
6885 -       operands[0] = gen_rtx_SUBREG (DImode, operands[0], 0);
6886 +      rtx reg;
6887 +
6888 +      reg = operands[0];
6889 +      if (GET_MODE (operands[0]) != SImode)
6890 +       reg = no_new_pseudos ? gen_rtx_SUBREG (SImode, operands[0], 0)
6891 +                            : gen_reg_rtx (SImode);
6892        sh_compare_op0 = force_reg (GET_MODE (sh_compare_op0), sh_compare_op0);
6893        if (sh_compare_op1 != const0_rtx)
6894         sh_compare_op1 = force_reg (GET_MODE (sh_compare_op1) == VOIDmode
6895 @@ -9335,32 +9326,36 @@
6896        switch (GET_MODE (sh_compare_op0))
6897         {
6898         case SImode:
6899 -         emit_insn (gen_cmpgtsi_media (operands[0],
6900 +         emit_insn (gen_cmpgtsi_media (reg,
6901                                         sh_compare_op0, sh_compare_op1));
6902           break;
6903  
6904         case DImode:
6905 -         emit_insn (gen_cmpgtdi_media (operands[0],
6906 +         emit_insn (gen_cmpgtdi_media (reg,
6907                                         sh_compare_op0, sh_compare_op1));
6908           break;
6909  
6910         case SFmode:
6911           if (! TARGET_SHMEDIA_FPU)
6912             FAIL;
6913 -         emit_insn (gen_cmpgtsf_media (operands[0],
6914 +         emit_insn (gen_cmpgtsf_media (reg,
6915                                         sh_compare_op0, sh_compare_op1));
6916           break;
6917  
6918         case DFmode:
6919           if (! TARGET_SHMEDIA_FPU)
6920             FAIL;
6921 -         emit_insn (gen_cmpgtdf_media (operands[0],
6922 +         emit_insn (gen_cmpgtdf_media (reg,
6923                                         sh_compare_op0, sh_compare_op1));
6924           break;
6925  
6926         default:
6927           FAIL;
6928         }
6929 +
6930 +      if (GET_MODE (operands[0]) == DImode)
6931 +       emit_insn (gen_extendsidi2 (operands[0], reg));
6932 +
6933        DONE;
6934      }
6935    if (! currently_expanding_to_rtl)
6936 @@ -9376,12 +9371,15 @@
6937  {
6938    if (TARGET_SHMEDIA)
6939      {
6940 +      rtx reg;
6941        enum machine_mode mode = GET_MODE (sh_compare_op0);
6942  
6943        if ((mode) == VOIDmode)
6944         mode = GET_MODE (sh_compare_op1);
6945 -      if (GET_MODE (operands[0]) != DImode)
6946 -       operands[0] = gen_rtx_SUBREG (DImode, operands[0], 0);
6947 +      reg = operands[0];
6948 +      if (GET_MODE (operands[0]) != SImode)
6949 +       reg = no_new_pseudos ? gen_rtx_SUBREG (SImode, operands[0], 0)
6950 +                            : gen_reg_rtx (SImode);
6951        sh_compare_op0 = force_reg (mode, sh_compare_op0);
6952        if (sh_compare_op1 != const0_rtx)
6953         sh_compare_op1 = force_reg (mode, sh_compare_op1);
6954 @@ -9390,41 +9388,45 @@
6955         {
6956         case SImode:
6957           {
6958 -           rtx tmp = no_new_pseudos ? operands[0] : gen_reg_rtx (DImode);
6959 +           rtx tmp = no_new_pseudos ? reg : gen_reg_rtx (SImode);
6960  
6961             emit_insn (gen_cmpgtsi_media (tmp,
6962                                           sh_compare_op1, sh_compare_op0));
6963 -           emit_insn (gen_cmpeqdi_media (operands[0], tmp, const0_rtx));
6964 +           emit_insn (gen_cmpeqdi_media (reg, tmp, const0_rtx));
6965             break;
6966           }
6967  
6968         case DImode:
6969           {
6970 -           rtx tmp = no_new_pseudos ? operands[0] : gen_reg_rtx (DImode);
6971 +           rtx tmp = no_new_pseudos ? reg : gen_reg_rtx (SImode);
6972  
6973             emit_insn (gen_cmpgtdi_media (tmp,
6974                                           sh_compare_op1, sh_compare_op0));
6975 -           emit_insn (gen_cmpeqdi_media (operands[0], tmp, const0_rtx));
6976 +           emit_insn (gen_cmpeqdi_media (reg, tmp, const0_rtx));
6977             break;
6978           }
6979  
6980         case SFmode:
6981           if (! TARGET_SHMEDIA_FPU)
6982             FAIL;
6983 -         emit_insn (gen_cmpgesf_media (operands[0],
6984 +         emit_insn (gen_cmpgesf_media (reg,
6985                                         sh_compare_op0, sh_compare_op1));
6986           break;
6987  
6988         case DFmode:
6989           if (! TARGET_SHMEDIA_FPU)
6990             FAIL;
6991 -         emit_insn (gen_cmpgedf_media (operands[0],
6992 +         emit_insn (gen_cmpgedf_media (reg,
6993                                         sh_compare_op0, sh_compare_op1));
6994           break;
6995  
6996         default:
6997           FAIL;
6998         }
6999 +
7000 +      if (GET_MODE (operands[0]) == DImode)
7001 +       emit_insn (gen_extendsidi2 (operands[0], reg));
7002 +
7003        DONE;
7004      }
7005  
7006 @@ -9456,8 +9458,12 @@
7007  {
7008    if (TARGET_SHMEDIA)
7009      {
7010 -      if (GET_MODE (operands[0]) != DImode)
7011 -       operands[0] = gen_rtx_SUBREG (DImode, operands[0], 0);
7012 +      rtx reg;
7013 +
7014 +      reg = operands[0];
7015 +      if (GET_MODE (operands[0]) == DImode)
7016 +       reg = no_new_pseudos ? gen_rtx_SUBREG (SImode, operands[0], 0)
7017 +                            : gen_reg_rtx (SImode);
7018        sh_compare_op0 = force_reg (GET_MODE (sh_compare_op0), sh_compare_op0);
7019        if (sh_compare_op1 != const0_rtx)
7020         sh_compare_op1 = force_reg (GET_MODE (sh_compare_op1) == VOIDmode
7021 @@ -9465,8 +9471,11 @@
7022                                     : GET_MODE (sh_compare_op1),
7023                                     sh_compare_op1);
7024  
7025 -      emit_insn (gen_cmpgtudi_media (operands[0],
7026 +      emit_insn (gen_cmpgtudi_media (reg,
7027                                      sh_compare_op0, sh_compare_op1));
7028 +      if (GET_MODE (operands[0]) == DImode)
7029 +       emit_insn (gen_extendsidi2 (operands[0], reg));
7030 +
7031        DONE;
7032      }
7033    if (! currently_expanding_to_rtl)
7034 @@ -9482,8 +9491,12 @@
7035  {
7036    if (TARGET_SHMEDIA)
7037      {
7038 -      if (GET_MODE (operands[0]) != DImode)
7039 -       operands[0] = gen_rtx_SUBREG (DImode, operands[0], 0);
7040 +      rtx reg;
7041 +
7042 +      reg = operands[0];
7043 +      if (GET_MODE (operands[0]) == DImode)
7044 +       reg = no_new_pseudos ? gen_rtx_SUBREG (SImode, operands[0], 0)
7045 +                            : gen_reg_rtx (SImode);
7046        sh_compare_op0 = force_reg (GET_MODE (sh_compare_op0), sh_compare_op0);
7047        if (sh_compare_op1 != const0_rtx)
7048         sh_compare_op1 = force_reg (GET_MODE (sh_compare_op1) == VOIDmode
7049 @@ -9491,8 +9504,11 @@
7050                                     : GET_MODE (sh_compare_op1),
7051                                     sh_compare_op1);
7052  
7053 -      emit_insn (gen_cmpgtudi_media (operands[0],
7054 +      emit_insn (gen_cmpgtudi_media (reg,
7055                                      sh_compare_op1, sh_compare_op0));
7056 +      if (GET_MODE (operands[0]) == DImode)
7057 +       emit_insn (gen_extendsidi2 (operands[0], reg));
7058 +
7059        DONE;
7060      }
7061    if (! currently_expanding_to_rtl)
7062 @@ -9508,10 +9524,12 @@
7063  {
7064    if (TARGET_SHMEDIA)
7065      {
7066 -      rtx tmp;
7067 +      rtx tmp, reg;
7068  
7069 -      if (GET_MODE (operands[0]) != DImode)
7070 -       operands[0] = gen_rtx_SUBREG (DImode, operands[0], 0);
7071 +      reg = operands[0];
7072 +      if (GET_MODE (operands[0]) != SImode)
7073 +       reg = no_new_pseudos ? gen_rtx_SUBREG (SImode, operands[0], 0)
7074 +                            : gen_reg_rtx (SImode);
7075        sh_compare_op0 = force_reg (GET_MODE (sh_compare_op0), sh_compare_op0);
7076        if (sh_compare_op1 != const0_rtx)
7077         sh_compare_op1 = force_reg (GET_MODE (sh_compare_op1) == VOIDmode
7078 @@ -9519,10 +9537,12 @@
7079                                     : GET_MODE (sh_compare_op1),
7080                                     sh_compare_op1);
7081  
7082 -      tmp = no_new_pseudos ? operands[0] : gen_reg_rtx (DImode);
7083 +      tmp = no_new_pseudos ? reg : gen_reg_rtx (SImode);
7084  
7085        emit_insn (gen_cmpgtudi_media (tmp, sh_compare_op0, sh_compare_op1));
7086 -      emit_insn (gen_cmpeqdi_media (operands[0], tmp, const0_rtx));
7087 +      emit_insn (gen_cmpeqdi_media (reg, tmp, const0_rtx));
7088 +      if (GET_MODE (operands[0]) == DImode)
7089 +       emit_insn (gen_extendsidi2 (operands[0], reg));
7090  
7091        DONE;
7092      }
7093 @@ -9539,10 +9559,12 @@
7094  {
7095    if (TARGET_SHMEDIA)
7096      {
7097 -      rtx tmp;
7098 +      rtx tmp, reg;
7099  
7100 -      if (GET_MODE (operands[0]) != DImode)
7101 -       operands[0] = gen_rtx_SUBREG (DImode, operands[0], 0);
7102 +      reg = operands[0];
7103 +      if (GET_MODE (operands[0]) != SImode)
7104 +       reg = no_new_pseudos ? gen_rtx_SUBREG (SImode, operands[0], 0)
7105 +                            : gen_reg_rtx (SImode);
7106        sh_compare_op0 = force_reg (GET_MODE (sh_compare_op0), sh_compare_op0);
7107        if (sh_compare_op1 != const0_rtx)
7108         sh_compare_op1 = force_reg (GET_MODE (sh_compare_op1) == VOIDmode
7109 @@ -9550,10 +9572,12 @@
7110                                     : GET_MODE (sh_compare_op1),
7111                                     sh_compare_op1);
7112  
7113 -      tmp = no_new_pseudos ? operands[0] : gen_reg_rtx (DImode);
7114 +      tmp = no_new_pseudos ? operands[0] : gen_reg_rtx (SImode);
7115  
7116        emit_insn (gen_cmpgtudi_media (tmp, sh_compare_op1, sh_compare_op0));
7117 -      emit_insn (gen_cmpeqdi_media (operands[0], tmp, const0_rtx));
7118 +      emit_insn (gen_cmpeqdi_media (reg, tmp, const0_rtx));
7119 +      if (GET_MODE (operands[0]) == DImode)
7120 +       emit_insn (gen_extendsidi2 (operands[0], reg));
7121  
7122        DONE;
7123      }
7124 @@ -9584,11 +9608,12 @@
7125  {
7126    if (TARGET_SHMEDIA)
7127      {
7128 -      rtx tmp;
7129 +      rtx tmp, reg;
7130  
7131 -      if (GET_MODE (operands[0]) != DImode)
7132 -       operands[0] = gen_rtx_SUBREG (DImode, operands[0], 0);
7133 -
7134 +      reg = operands[0];
7135 +      if (GET_MODE (operands[0]) != SImode)
7136 +       reg = no_new_pseudos ? gen_rtx_SUBREG (SImode, operands[0], 0)
7137 +                            : gen_reg_rtx (SImode);
7138        if (! TARGET_SHMEDIA_FPU
7139           && GET_MODE (sh_compare_op0) != DImode
7140           && GET_MODE (sh_compare_op0) != SImode)
7141 @@ -9601,10 +9626,12 @@
7142                                     : GET_MODE (sh_compare_op1),
7143                                     sh_compare_op1);
7144  
7145 -      tmp = no_new_pseudos ? operands[0] : gen_reg_rtx (DImode);
7146 +      tmp = no_new_pseudos ? reg : gen_reg_rtx (SImode);
7147  
7148        emit_insn (gen_seq (tmp));
7149 -      emit_insn (gen_cmpeqdi_media (operands[0], tmp, const0_rtx));
7150 +      emit_insn (gen_cmpeqdi_media (reg, tmp, const0_rtx));
7151 +      if (GET_MODE (operands[0]) == DImode)
7152 +       emit_insn (gen_extendsidi2 (operands[0], reg));
7153  
7154        DONE;
7155      }
7156 @@ -9618,8 +9645,8 @@
7157  }")
7158  
7159  (define_expand "sunordered"
7160 -  [(set (match_operand:DI 0 "arith_reg_operand" "")
7161 -       (unordered:DI (match_dup 1) (match_dup 2)))]
7162 +  [(set (match_operand:SI 0 "arith_reg_operand" "")
7163 +       (unordered:SI (match_dup 1) (match_dup 2)))]
7164    "TARGET_SHMEDIA_FPU"
7165    "
7166  {
7167 @@ -10378,14 +10405,6 @@
7168     (set_attr "fp_mode" "single")])
7169  
7170  (define_insn "cmpeqsf_media"
7171 -  [(set (match_operand:DI 0 "register_operand" "=r")
7172 -       (eq:DI (match_operand:SF 1 "fp_arith_reg_operand" "f")
7173 -              (match_operand:SF 2 "fp_arith_reg_operand" "f")))]
7174 -  "TARGET_SHMEDIA_FPU"
7175 -  "fcmpeq.s    %1, %2, %0"
7176 -  [(set_attr "type" "fcmp_media")])
7177 -
7178 -(define_insn "cmpsieqsf_media"
7179    [(set (match_operand:SI 0 "register_operand" "=r")
7180         (eq:SI (match_operand:SF 1 "fp_arith_reg_operand" "f")
7181                (match_operand:SF 2 "fp_arith_reg_operand" "f")))]
7182 @@ -10394,24 +10413,24 @@
7183    [(set_attr "type" "fcmp_media")])
7184  
7185  (define_insn "cmpgtsf_media"
7186 -  [(set (match_operand:DI 0 "register_operand" "=r")
7187 -       (gt:DI (match_operand:SF 1 "fp_arith_reg_operand" "f")
7188 +  [(set (match_operand:SI 0 "register_operand" "=r")
7189 +       (gt:SI (match_operand:SF 1 "fp_arith_reg_operand" "f")
7190                (match_operand:SF 2 "fp_arith_reg_operand" "f")))]
7191    "TARGET_SHMEDIA_FPU"
7192    "fcmpgt.s    %1, %2, %0"
7193    [(set_attr "type" "fcmp_media")])
7194  
7195  (define_insn "cmpgesf_media"
7196 -  [(set (match_operand:DI 0 "register_operand" "=r")
7197 -       (ge:DI (match_operand:SF 1 "fp_arith_reg_operand" "f")
7198 +  [(set (match_operand:SI 0 "register_operand" "=r")
7199 +       (ge:SI (match_operand:SF 1 "fp_arith_reg_operand" "f")
7200                (match_operand:SF 2 "fp_arith_reg_operand" "f")))]
7201    "TARGET_SHMEDIA_FPU"
7202    "fcmpge.s    %1, %2, %0"
7203    [(set_attr "type" "fcmp_media")])
7204  
7205  (define_insn "cmpunsf_media"
7206 -  [(set (match_operand:DI 0 "register_operand" "=r")
7207 -       (unordered:DI (match_operand:SF 1 "fp_arith_reg_operand" "f")
7208 +  [(set (match_operand:SI 0 "register_operand" "=r")
7209 +       (unordered:SI (match_operand:SF 1 "fp_arith_reg_operand" "f")
7210                       (match_operand:SF 2 "fp_arith_reg_operand" "f")))]
7211    "TARGET_SHMEDIA_FPU"
7212    "fcmpun.s    %1, %2, %0"
7213 @@ -10884,14 +10903,6 @@
7214     (set_attr "fp_mode" "double")])
7215  
7216  (define_insn "cmpeqdf_media"
7217 -  [(set (match_operand:DI 0 "register_operand" "=r")
7218 -       (eq:DI (match_operand:DF 1 "fp_arith_reg_operand" "f")
7219 -              (match_operand:DF 2 "fp_arith_reg_operand" "f")))]
7220 -  "TARGET_SHMEDIA_FPU"
7221 -  "fcmpeq.d    %1,%2,%0"
7222 -  [(set_attr "type" "fcmp_media")])
7223 -
7224 -(define_insn "cmpsieqdf_media"
7225    [(set (match_operand:SI 0 "register_operand" "=r")
7226         (eq:SI (match_operand:DF 1 "fp_arith_reg_operand" "f")
7227                (match_operand:DF 2 "fp_arith_reg_operand" "f")))]
7228 @@ -10900,24 +10911,24 @@
7229    [(set_attr "type" "fcmp_media")])
7230  
7231  (define_insn "cmpgtdf_media"
7232 -  [(set (match_operand:DI 0 "register_operand" "=r")
7233 -       (gt:DI (match_operand:DF 1 "fp_arith_reg_operand" "f")
7234 +  [(set (match_operand:SI 0 "register_operand" "=r")
7235 +       (gt:SI (match_operand:DF 1 "fp_arith_reg_operand" "f")
7236                (match_operand:DF 2 "fp_arith_reg_operand" "f")))]
7237    "TARGET_SHMEDIA_FPU"
7238    "fcmpgt.d    %1,%2,%0"
7239    [(set_attr "type" "fcmp_media")])
7240  
7241  (define_insn "cmpgedf_media"
7242 -  [(set (match_operand:DI 0 "register_operand" "=r")
7243 -       (ge:DI (match_operand:DF 1 "fp_arith_reg_operand" "f")
7244 +  [(set (match_operand:SI 0 "register_operand" "=r")
7245 +       (ge:SI (match_operand:DF 1 "fp_arith_reg_operand" "f")
7246                (match_operand:DF 2 "fp_arith_reg_operand" "f")))]
7247    "TARGET_SHMEDIA_FPU"
7248    "fcmpge.d    %1,%2,%0"
7249    [(set_attr "type" "fcmp_media")])
7250  
7251  (define_insn "cmpundf_media"
7252 -  [(set (match_operand:DI 0 "register_operand" "=r")
7253 -       (unordered:DI (match_operand:DF 1 "fp_arith_reg_operand" "f")
7254 +  [(set (match_operand:SI 0 "register_operand" "=r")
7255 +       (unordered:SI (match_operand:DF 1 "fp_arith_reg_operand" "f")
7256                       (match_operand:DF 2 "fp_arith_reg_operand" "f")))]
7257    "TARGET_SHMEDIA_FPU"
7258    "fcmpun.d    %1,%2,%0"
7259 Index: gcc/config/score/predicates.md
7260 ===================================================================
7261 --- gcc/config/score/predicates.md      (.../tags/gcc_4_2_0_release)    (wersja 125589)
7262 +++ gcc/config/score/predicates.md      (.../branches/gcc-4_2-branch)   (wersja 125589)
7263 @@ -75,14 +75,3 @@
7264    return IMM_IN_RANGE (INTVAL (op), 15, 1);
7265  })
7266  
7267 -(define_predicate "const_pow2"
7268 -  (match_code "const_int")
7269 -{
7270 -  return IMM_IS_POW_OF_2 ((unsigned HOST_WIDE_INT) INTVAL (op), 0, 31);
7271 -})
7272 -
7273 -(define_predicate "const_npow2"
7274 -  (match_code "const_int")
7275 -{
7276 -  return IMM_IS_POW_OF_2 (~(unsigned HOST_WIDE_INT) INTVAL (op), 0, 31);
7277 -})
7278 Index: gcc/config/score/misc.md
7279 ===================================================================
7280 --- gcc/config/score/misc.md    (.../tags/gcc_4_2_0_release)    (wersja 125589)
7281 +++ gcc/config/score/misc.md    (.../branches/gcc-4_2-branch)   (wersja 125589)
7282 @@ -380,38 +380,3 @@
7283    [(set_attr "type" "arith")
7284     (set_attr "mode" "SI")])
7285  
7286 -(define_insn "bitclr_c"
7287 -  [(set (match_operand:SI 0 "register_operand" "=e,d")
7288 -        (and:SI (match_operand:SI 1 "register_operand" "0,d")
7289 -                (match_operand:SI 2 "const_npow2")))
7290 -   (clobber (reg:CC CC_REGNUM))]
7291 -  ""
7292 -  "@
7293 -   bitclr!    %0, %F2
7294 -   bitclr.c   %0, %1, %F2"
7295 -  [(set_attr "type" "arith")
7296 -   (set_attr "mode" "SI")])
7297 -
7298 -(define_insn "bitset_c"
7299 -  [(set (match_operand:SI 0 "register_operand" "=e,d")
7300 -        (ior:SI (match_operand:SI 1 "register_operand" "0,d")
7301 -                (match_operand:SI 2 "const_pow2")))
7302 -   (clobber (reg:CC CC_REGNUM))]
7303 -  ""
7304 -  "@
7305 -   bitset!    %0, %E2
7306 -   bitset.c   %0, %1, %E2"
7307 -  [(set_attr "type" "arith")
7308 -   (set_attr "mode" "SI")])
7309 -
7310 -(define_insn "bittgl_c"
7311 -  [(set (match_operand:SI 0 "register_operand" "=e,d")
7312 -        (xor:SI (match_operand:SI 1 "register_operand" "0,d")
7313 -                (match_operand:SI 2 "const_pow2")))
7314 -   (clobber (reg:CC CC_REGNUM))]
7315 -  ""
7316 -  "@
7317 -   bittgl!    %0, %E2
7318 -   bittgl.c   %0, %1, %E2"
7319 -  [(set_attr "type" "arith")
7320 -   (set_attr "mode" "SI")])
7321 Index: gcc/config/score/score.c
7322 ===================================================================
7323 --- gcc/config/score/score.c    (.../tags/gcc_4_2_0_release)    (wersja 125589)
7324 +++ gcc/config/score/score.c    (.../branches/gcc-4_2-branch)   (wersja 125589)
7325 @@ -1168,7 +1168,7 @@
7326      {
7327        gcc_assert (code == CONST_INT);
7328        fprintf (file, HOST_WIDE_INT_PRINT_HEX,
7329 -               (unsigned HOST_WIDE_INT) INTVAL (op) >> 16);
7330 +               (INTVAL (op) >> 16) & 0xffff);
7331      }
7332    else if (c == 'D')
7333      {
7334 @@ -1176,7 +1176,7 @@
7335          {
7336            rtx temp = gen_lowpart (SImode, op);
7337            gcc_assert (GET_MODE (op) == SFmode);
7338 -          fprintf (file, HOST_WIDE_INT_PRINT_HEX, INTVAL (temp));
7339 +          fprintf (file, HOST_WIDE_INT_PRINT_HEX, INTVAL (temp) & 0xffffffff);
7340          }
7341        else
7342          output_addr_const (file, op);
7343 Index: gcc/config/score/score.h
7344 ===================================================================
7345 --- gcc/config/score/score.h    (.../tags/gcc_4_2_0_release)    (wersja 125589)
7346 +++ gcc/config/score/score.h    (.../branches/gcc-4_2-branch)   (wersja 125589)
7347 @@ -785,6 +785,7 @@
7348     output anything and let undefined symbol become external. However
7349     the assembler uses length information on externals to allocate in
7350     data/sdata bss/sbss, thereby saving exec time.  */
7351 +#undef ASM_OUTPUT_EXTERNAL
7352  #define ASM_OUTPUT_EXTERNAL(STREAM, DECL, NAME) \
7353    score_output_external (STREAM, DECL, NAME)
7354  
7355 Index: gcc/config/pa/pa.md
7356 ===================================================================
7357 --- gcc/config/pa/pa.md (.../tags/gcc_4_2_0_release)    (wersja 125589)
7358 +++ gcc/config/pa/pa.md (.../branches/gcc-4_2-branch)   (wersja 125589)
7359 @@ -39,6 +39,9 @@
7360     (UNSPEC_TLSLDBASE   7)
7361     (UNSPEC_TLSIE       8)
7362     (UNSPEC_TLSLE       9)
7363 +   (UNSPEC_TLSGD_PIC   10)
7364 +   (UNSPEC_TLSLDM_PIC  11)
7365 +   (UNSPEC_TLSIE_PIC   12)
7366    ])
7367  
7368  ;; UNSPEC_VOLATILE:
7369 @@ -9890,33 +9893,55 @@
7370  (define_insn "tgd_load"
7371   [(set (match_operand:SI 0 "register_operand" "=r")
7372         (unspec:SI [(match_operand 1 "tgd_symbolic_operand" "")] UNSPEC_TLSGD))
7373 -  (clobber (reg:SI 1))]
7374 +  (clobber (reg:SI 1))
7375 +  (use (reg:SI 27))]
7376    ""
7377    "*
7378  {
7379 -  if (flag_pic)
7380 -    return \"addil LT'%1-$tls_gdidx$,%%r19\;ldo RT'%1-$tls_gdidx$(%%r1),%0\";
7381 -  else
7382 -    return \"addil LR'%1-$tls_gdidx$,%%r27\;ldo RR'%1-$tls_gdidx$(%%r1),%0\";
7383 +  return \"addil LR'%1-$tls_gdidx$,%%r27\;ldo RR'%1-$tls_gdidx$(%%r1),%0\";
7384  }"
7385    [(set_attr "type" "multi")
7386     (set_attr "length" "8")])
7387  
7388 +(define_insn "tgd_load_pic"
7389 + [(set (match_operand:SI 0 "register_operand" "=r")
7390 +       (unspec:SI [(match_operand 1 "tgd_symbolic_operand" "")] UNSPEC_TLSGD_PIC))
7391 +  (clobber (reg:SI 1))
7392 +  (use (reg:SI 19))]
7393 +  ""
7394 +  "*
7395 +{
7396 +  return \"addil LT'%1-$tls_gdidx$,%%r19\;ldo RT'%1-$tls_gdidx$(%%r1),%0\";
7397 +}"
7398 +  [(set_attr "type" "multi")
7399 +   (set_attr "length" "8")])
7400 +
7401  (define_insn "tld_load"
7402   [(set (match_operand:SI 0 "register_operand" "=r")
7403         (unspec:SI [(match_operand 1 "tld_symbolic_operand" "")] UNSPEC_TLSLDM))
7404 -  (clobber (reg:SI 1))]
7405 +  (clobber (reg:SI 1))
7406 +  (use (reg:SI 27))]
7407    ""
7408    "*
7409  {
7410 -  if (flag_pic)
7411 -    return \"addil LT'%1-$tls_ldidx$,%%r19\;ldo RT'%1-$tls_ldidx$(%%r1),%0\";
7412 -  else
7413 -    return \"addil LR'%1-$tls_ldidx$,%%r27\;ldo RR'%1-$tls_ldidx$(%%r1),%0\";
7414 +  return \"addil LR'%1-$tls_ldidx$,%%r27\;ldo RR'%1-$tls_ldidx$(%%r1),%0\";
7415  }"
7416    [(set_attr "type" "multi")
7417     (set_attr "length" "8")])
7418  
7419 +(define_insn "tld_load_pic"
7420 + [(set (match_operand:SI 0 "register_operand" "=r")
7421 +       (unspec:SI [(match_operand 1 "tld_symbolic_operand" "")] UNSPEC_TLSLDM_PIC))
7422 +  (clobber (reg:SI 1))
7423 +  (use (reg:SI 19))]
7424 +  ""
7425 +  "*
7426 +{
7427 +  return \"addil LT'%1-$tls_ldidx$,%%r19\;ldo RT'%1-$tls_ldidx$(%%r1),%0\";
7428 +}"
7429 +  [(set_attr "type" "multi")
7430 +   (set_attr "length" "8")])
7431 +
7432  (define_insn "tld_offset_load"
7433    [(set (match_operand:SI 0 "register_operand" "=r")
7434          (plus:SI (unspec:SI [(match_operand 1 "tld_symbolic_operand" "")] 
7435 @@ -9942,18 +9967,29 @@
7436  (define_insn "tie_load"
7437    [(set (match_operand:SI 0 "register_operand" "=r")
7438          (unspec:SI [(match_operand 1 "tie_symbolic_operand" "")] UNSPEC_TLSIE))
7439 -   (clobber (reg:SI 1))]
7440 +   (clobber (reg:SI 1))
7441 +   (use (reg:SI 27))]
7442    ""
7443    "*
7444  {
7445 -  if (flag_pic)
7446 -    return \"addil LT'%1-$tls_ieoff$,%%r19\;ldw RT'%1-$tls_ieoff$(%%r1),%0\";
7447 -  else
7448 -    return \"addil LR'%1-$tls_ieoff$,%%r27\;ldw RR'%1-$tls_ieoff$(%%r1),%0\";
7449 +  return \"addil LR'%1-$tls_ieoff$,%%r27\;ldw RR'%1-$tls_ieoff$(%%r1),%0\";
7450  }"
7451    [(set_attr "type" "multi")
7452     (set_attr "length" "8")])
7453  
7454 +(define_insn "tie_load_pic"
7455 +  [(set (match_operand:SI 0 "register_operand" "=r")
7456 +        (unspec:SI [(match_operand 1 "tie_symbolic_operand" "")] UNSPEC_TLSIE_PIC))
7457 +   (clobber (reg:SI 1))
7458 +   (use (reg:SI 19))]
7459 +  ""
7460 +  "*
7461 +{
7462 +  return \"addil LT'%1-$tls_ieoff$,%%r19\;ldw RT'%1-$tls_ieoff$(%%r1),%0\";
7463 +}"
7464 +  [(set_attr "type" "multi")
7465 +   (set_attr "length" "8")])
7466 +
7467  (define_insn "tle_load"
7468    [(set (match_operand:SI 0 "register_operand" "=r")
7469          (plus:SI (unspec:SI [(match_operand 1 "tle_symbolic_operand" "")] 
7470 Index: gcc/config/pa/pa.c
7471 ===================================================================
7472 --- gcc/config/pa/pa.c  (.../tags/gcc_4_2_0_release)    (wersja 125589)
7473 +++ gcc/config/pa/pa.c  (.../branches/gcc-4_2-branch)   (wersja 125589)
7474 @@ -726,7 +726,10 @@
7475      {
7476        case TLS_MODEL_GLOBAL_DYNAMIC:
7477         tmp = gen_reg_rtx (Pmode);
7478 -       emit_insn (gen_tgd_load (tmp, addr));
7479 +       if (flag_pic)
7480 +         emit_insn (gen_tgd_load_pic (tmp, addr));
7481 +       else
7482 +         emit_insn (gen_tgd_load (tmp, addr));
7483         ret = hppa_tls_call (tmp);
7484         break;
7485  
7486 @@ -734,7 +737,10 @@
7487         ret = gen_reg_rtx (Pmode);
7488         tmp = gen_reg_rtx (Pmode);
7489         start_sequence ();
7490 -       emit_insn (gen_tld_load (tmp, addr));
7491 +       if (flag_pic)
7492 +         emit_insn (gen_tld_load_pic (tmp, addr));
7493 +       else
7494 +         emit_insn (gen_tld_load (tmp, addr));
7495         t1 = hppa_tls_call (tmp);
7496         insn = get_insns ();
7497         end_sequence ();
7498 @@ -750,7 +756,10 @@
7499         tmp = gen_reg_rtx (Pmode);
7500         ret = gen_reg_rtx (Pmode);
7501         emit_insn (gen_tp_load (tp));
7502 -       emit_insn (gen_tie_load (tmp, addr));
7503 +       if (flag_pic)
7504 +         emit_insn (gen_tie_load_pic (tmp, addr));
7505 +       else
7506 +         emit_insn (gen_tie_load (tmp, addr));
7507         emit_move_insn (ret, gen_rtx_PLUS (Pmode, tp, tmp));
7508         break;
7509  
7510 Index: gcc/config/soft-fp/quad.h
7511 ===================================================================
7512 --- gcc/config/soft-fp/quad.h   (.../tags/gcc_4_2_0_release)    (wersja 125589)
7513 +++ gcc/config/soft-fp/quad.h   (.../branches/gcc-4_2-branch)   (wersja 125589)
7514 @@ -1,6 +1,6 @@
7515  /* Software floating-point emulation.
7516     Definitions for IEEE Quad Precision.
7517 -   Copyright (C) 1997,1998,1999,2006 Free Software Foundation, Inc.
7518 +   Copyright (C) 1997,1998,1999,2006,2007 Free Software Foundation, Inc.
7519     This file is part of the GNU C Library.
7520     Contributed by Richard Henderson (rth@cygnus.com),
7521                   Jakub Jelinek (jj@ultra.linux.cz),
7522 @@ -176,15 +176,15 @@
7523    } longs;
7524    struct {
7525  #if __BYTE_ORDER == __BIG_ENDIAN
7526 -    unsigned sign  : 1;
7527 -    unsigned exp   : _FP_EXPBITS_Q;
7528 -    unsigned long frac1 : _FP_FRACBITS_Q-(_FP_IMPLBIT_Q != 0)-_FP_W_TYPE_SIZE;
7529 -    unsigned long frac0 : _FP_W_TYPE_SIZE;
7530 +    unsigned sign    : 1;
7531 +    unsigned exp     : _FP_EXPBITS_Q;
7532 +    _FP_W_TYPE frac1 : _FP_FRACBITS_Q - (_FP_IMPLBIT_Q != 0) - _FP_W_TYPE_SIZE;
7533 +    _FP_W_TYPE frac0 : _FP_W_TYPE_SIZE;
7534  #else
7535 -    unsigned long frac0 : _FP_W_TYPE_SIZE;
7536 -    unsigned long frac1 : _FP_FRACBITS_Q-(_FP_IMPLBIT_Q != 0)-_FP_W_TYPE_SIZE;
7537 -    unsigned exp   : _FP_EXPBITS_Q;
7538 -    unsigned sign  : 1;
7539 +    _FP_W_TYPE frac0 : _FP_W_TYPE_SIZE;
7540 +    _FP_W_TYPE frac1 : _FP_FRACBITS_Q - (_FP_IMPLBIT_Q != 0) - _FP_W_TYPE_SIZE;
7541 +    unsigned exp     : _FP_EXPBITS_Q;
7542 +    unsigned sign    : 1;
7543  #endif
7544    } bits;
7545  };
7546 Index: gcc/config/soft-fp/floatunsidf.c
7547 ===================================================================
7548 --- gcc/config/soft-fp/floatunsidf.c    (.../tags/gcc_4_2_0_release)    (wersja 125589)
7549 +++ gcc/config/soft-fp/floatunsidf.c    (.../branches/gcc-4_2-branch)   (wersja 125589)
7550 @@ -1,6 +1,6 @@
7551  /* Software floating-point emulation.
7552     Convert a 32bit unsigned integer to IEEE double
7553 -   Copyright (C) 1997,1999, 2006 Free Software Foundation, Inc.
7554 +   Copyright (C) 1997, 1999, 2006, 2007 Free Software Foundation, Inc.
7555     This file is part of the GNU C Library.
7556     Contributed by Richard Henderson (rth@cygnus.com) and
7557                   Jakub Jelinek (jj@ultra.linux.cz).
7558 @@ -32,8 +32,7 @@
7559  #include "soft-fp.h"
7560  #include "double.h"
7561  
7562 -double
7563 -__floatunsidf(USItype i)
7564 +DFtype __floatunsidf(USItype i)
7565  {
7566    FP_DECL_EX;
7567    FP_DECL_D(A);
7568 Index: gcc/config/soft-fp/floatundidf.c
7569 ===================================================================
7570 --- gcc/config/soft-fp/floatundidf.c    (.../tags/gcc_4_2_0_release)    (wersja 125589)
7571 +++ gcc/config/soft-fp/floatundidf.c    (.../branches/gcc-4_2-branch)   (wersja 125589)
7572 @@ -1,6 +1,6 @@
7573  /* Software floating-point emulation.
7574     Convert a 64bit unsigned integer to IEEE double
7575 -   Copyright (C) 1997,1999, 2006 Free Software Foundation, Inc.
7576 +   Copyright (C) 1997, 1999, 2006, 2007 Free Software Foundation, Inc.
7577     This file is part of the GNU C Library.
7578     Contributed by Richard Henderson (rth@cygnus.com) and
7579                   Jakub Jelinek (jj@ultra.linux.cz).
7580 @@ -32,8 +32,7 @@
7581  #include "soft-fp.h"
7582  #include "double.h"
7583  
7584 -double
7585 -__floatundidf(UDItype i)
7586 +DFtype __floatundidf(UDItype i)
7587  {
7588    FP_DECL_EX;
7589    FP_DECL_D(A);
7590 Index: gcc/config/soft-fp/extended.h
7591 ===================================================================
7592 --- gcc/config/soft-fp/extended.h       (.../tags/gcc_4_2_0_release)    (wersja 125589)
7593 +++ gcc/config/soft-fp/extended.h       (.../branches/gcc-4_2-branch)   (wersja 125589)
7594 @@ -1,6 +1,6 @@
7595  /* Software floating-point emulation.
7596     Definitions for IEEE Extended Precision.
7597 -   Copyright (C) 1999,2006 Free Software Foundation, Inc.
7598 +   Copyright (C) 1999,2006,2007 Free Software Foundation, Inc.
7599     This file is part of the GNU C Library.
7600     Contributed by Jakub Jelinek (jj@ultra.linux.cz).
7601  
7602 @@ -94,12 +94,6 @@
7603      X##_f[1] = _flo.bits.frac1;                                \
7604      X##_e  = _flo.bits.exp;                            \
7605      X##_s  = _flo.bits.sign;                           \
7606 -    if (!X##_e && (X##_f[1] || X##_f[0])               \
7607 -        && !(X##_f[1] & _FP_IMPLBIT_E))                        \
7608 -      {                                                        \
7609 -        X##_e++;                                       \
7610 -        FP_SET_EXCEPTION(FP_EX_DENORM);                        \
7611 -      }                                                        \
7612    } while (0)
7613  
7614  #define FP_UNPACK_RAW_EP(X, val)                       \
7615 @@ -112,12 +106,6 @@
7616      X##_f[1] = _flo->bits.frac1;                       \
7617      X##_e  = _flo->bits.exp;                           \
7618      X##_s  = _flo->bits.sign;                          \
7619 -    if (!X##_e && (X##_f[1] || X##_f[0])               \
7620 -        && !(X##_f[1] & _FP_IMPLBIT_E))                        \
7621 -      {                                                        \
7622 -        X##_e++;                                       \
7623 -        FP_SET_EXCEPTION(FP_EX_DENORM);                        \
7624 -      }                                                        \
7625    } while (0)
7626  
7627  #define FP_PACK_RAW_E(val, X)                          \
7628 @@ -164,13 +152,13 @@
7629  
7630  #define FP_UNPACK_SEMIRAW_E(X,val)     \
7631    do {                                 \
7632 -    _FP_UNPACK_RAW_E(X,val);           \
7633 +    FP_UNPACK_RAW_E(X,val);            \
7634      _FP_UNPACK_SEMIRAW(E,4,X);         \
7635    } while (0)
7636  
7637  #define FP_UNPACK_SEMIRAW_EP(X,val)    \
7638    do {                                 \
7639 -    _FP_UNPACK_RAW_EP(X,val);          \
7640 +    FP_UNPACK_RAW_EP(X,val);           \
7641      _FP_UNPACK_SEMIRAW(E,4,X);         \
7642    } while (0)
7643  
7644 @@ -189,13 +177,13 @@
7645  #define FP_PACK_SEMIRAW_E(val,X)       \
7646    do {                                 \
7647      _FP_PACK_SEMIRAW(E,4,X);           \
7648 -    _FP_PACK_RAW_E(val,X);             \
7649 +    FP_PACK_RAW_E(val,X);              \
7650    } while (0)
7651  
7652  #define FP_PACK_SEMIRAW_EP(val,X)      \
7653    do {                                 \
7654      _FP_PACK_SEMIRAW(E,4,X);           \
7655 -    _FP_PACK_RAW_EP(val,X);            \
7656 +    FP_PACK_RAW_EP(val,X);             \
7657    } while (0)
7658  
7659  #define FP_ISSIGNAN_E(X)       _FP_ISSIGNAN(E,4,X)
7660 @@ -277,14 +265,14 @@
7661    XFtype flt;
7662    struct {
7663  #if __BYTE_ORDER == __BIG_ENDIAN
7664 -    unsigned long pad : (_FP_W_TYPE_SIZE - 1 - _FP_EXPBITS_E);
7665 -    unsigned sign  : 1;
7666 -    unsigned exp   : _FP_EXPBITS_E;
7667 -    unsigned long frac : _FP_W_TYPE_SIZE;
7668 +    _FP_W_TYPE pad  : (_FP_W_TYPE_SIZE - 1 - _FP_EXPBITS_E);
7669 +    unsigned sign   : 1;
7670 +    unsigned exp    : _FP_EXPBITS_E;
7671 +    _FP_W_TYPE frac : _FP_W_TYPE_SIZE;
7672  #else
7673 -    unsigned long frac : _FP_W_TYPE_SIZE;
7674 -    unsigned exp   : _FP_EXPBITS_E;
7675 -    unsigned sign  : 1;
7676 +    _FP_W_TYPE frac : _FP_W_TYPE_SIZE;
7677 +    unsigned exp    : _FP_EXPBITS_E;
7678 +    unsigned sign   : 1;
7679  #endif
7680    } bits;
7681  };
7682 @@ -299,11 +287,6 @@
7683      X##_f1 = 0;                                                        \
7684      X##_e = _flo.bits.exp;                                     \
7685      X##_s = _flo.bits.sign;                                    \
7686 -    if (!X##_e && X##_f0 && !(X##_f0 & _FP_IMPLBIT_E))         \
7687 -      {                                                                \
7688 -        X##_e++;                                               \
7689 -        FP_SET_EXCEPTION(FP_EX_DENORM);                                \
7690 -      }                                                                \
7691    } while (0)
7692  
7693  #define FP_UNPACK_RAW_EP(X, val)                               \
7694 @@ -315,11 +298,6 @@
7695      X##_f1 = 0;                                                        \
7696      X##_e = _flo->bits.exp;                                    \
7697      X##_s = _flo->bits.sign;                                   \
7698 -    if (!X##_e && X##_f0 && !(X##_f0 & _FP_IMPLBIT_E))         \
7699 -      {                                                                \
7700 -        X##_e++;                                               \
7701 -        FP_SET_EXCEPTION(FP_EX_DENORM);                                \
7702 -      }                                                                \
7703    } while (0)
7704  
7705  #define FP_PACK_RAW_E(val, X)                                  \
7706 @@ -365,13 +343,13 @@
7707  
7708  #define FP_UNPACK_SEMIRAW_E(X,val)     \
7709    do {                                 \
7710 -    _FP_UNPACK_RAW_E(X,val);           \
7711 +    FP_UNPACK_RAW_E(X,val);            \
7712      _FP_UNPACK_SEMIRAW(E,2,X);         \
7713    } while (0)
7714  
7715  #define FP_UNPACK_SEMIRAW_EP(X,val)    \
7716    do {                                 \
7717 -    _FP_UNPACK_RAW_EP(X,val);          \
7718 +    FP_UNPACK_RAW_EP(X,val);           \
7719      _FP_UNPACK_SEMIRAW(E,2,X);         \
7720    } while (0)
7721  
7722 @@ -390,13 +368,13 @@
7723  #define FP_PACK_SEMIRAW_E(val,X)       \
7724    do {                                 \
7725      _FP_PACK_SEMIRAW(E,2,X);           \
7726 -    _FP_PACK_RAW_E(val,X);             \
7727 +    FP_PACK_RAW_E(val,X);              \
7728    } while (0)
7729  
7730  #define FP_PACK_SEMIRAW_EP(val,X)      \
7731    do {                                 \
7732      _FP_PACK_SEMIRAW(E,2,X);           \
7733 -    _FP_PACK_RAW_EP(val,X);            \
7734 +    FP_PACK_RAW_EP(val,X);             \
7735    } while (0)
7736  
7737  #define FP_ISSIGNAN_E(X)       _FP_ISSIGNAN(E,2,X)
7738 Index: gcc/config/soft-fp/floatunsisf.c
7739 ===================================================================
7740 --- gcc/config/soft-fp/floatunsisf.c    (.../tags/gcc_4_2_0_release)    (wersja 125589)
7741 +++ gcc/config/soft-fp/floatunsisf.c    (.../branches/gcc-4_2-branch)   (wersja 125589)
7742 @@ -1,6 +1,6 @@
7743  /* Software floating-point emulation.
7744     Convert a 32bit unsigned integer to IEEE single
7745 -   Copyright (C) 1997,1999, 2006 Free Software Foundation, Inc.
7746 +   Copyright (C) 1997, 1999, 2006, 2007 Free Software Foundation, Inc.
7747     This file is part of the GNU C Library.
7748     Contributed by Richard Henderson (rth@cygnus.com) and
7749                   Jakub Jelinek (jj@ultra.linux.cz).
7750 @@ -32,8 +32,7 @@
7751  #include "soft-fp.h"
7752  #include "single.h"
7753  
7754 -float
7755 -__floatunsisf(USItype i)
7756 +SFtype __floatunsisf(USItype i)
7757  {
7758    FP_DECL_EX;
7759    FP_DECL_S(A);
7760 Index: gcc/config/soft-fp/op-common.h
7761 ===================================================================
7762 --- gcc/config/soft-fp/op-common.h      (.../tags/gcc_4_2_0_release)    (wersja 125589)
7763 +++ gcc/config/soft-fp/op-common.h      (.../branches/gcc-4_2-branch)   (wersja 125589)
7764 @@ -1153,7 +1153,8 @@
7765    if (_FP_FRACBITS_##dfs < _FP_FRACBITS_##sfs                           \
7766        || (_FP_EXPMAX_##dfs - _FP_EXPBIAS_##dfs                          \
7767           < _FP_EXPMAX_##sfs - _FP_EXPBIAS_##sfs)                        \
7768 -      || _FP_EXPBIAS_##dfs < _FP_EXPBIAS_##sfs + _FP_FRACBITS_##sfs - 1) \
7769 +      || (_FP_EXPBIAS_##dfs < _FP_EXPBIAS_##sfs + _FP_FRACBITS_##sfs - 1 \
7770 +         && _FP_EXPBIAS_##dfs != _FP_EXPBIAS_##sfs))                    \
7771      abort();                                                            \
7772    D##_s = S##_s;                                                        \
7773    _FP_FRAC_COPY_##dwc##_##swc(D, S);                                    \
7774 @@ -1168,6 +1169,14 @@
7775         {                                                                \
7776           if (_FP_FRAC_ZEROP_##swc(S))                                   \
7777             D##_e = 0;                                                   \
7778 +         else if (_FP_EXPBIAS_##dfs                                     \
7779 +                  < _FP_EXPBIAS_##sfs + _FP_FRACBITS_##sfs - 1)         \
7780 +           {                                                            \
7781 +             FP_SET_EXCEPTION(FP_EX_DENORM);                            \
7782 +             _FP_FRAC_SLL_##dwc(D, (_FP_FRACBITS_##dfs                  \
7783 +                                    - _FP_FRACBITS_##sfs));             \
7784 +             D##_e = 0;                                                 \
7785 +           }                                                            \
7786           else                                                           \
7787             {                                                            \
7788               int _lz;                                                   \
7789 @@ -1199,7 +1208,8 @@
7790  #define FP_TRUNC(dfs,sfs,dwc,swc,D,S)                                       \
7791  do {                                                                        \
7792    if (_FP_FRACBITS_##sfs < _FP_FRACBITS_##dfs                               \
7793 -      || _FP_EXPBIAS_##sfs < _FP_EXPBIAS_##dfs + _FP_FRACBITS_##dfs - 1)     \
7794 +      || (_FP_EXPBIAS_##sfs < _FP_EXPBIAS_##dfs + _FP_FRACBITS_##dfs - 1     \
7795 +         && _FP_EXPBIAS_##sfs != _FP_EXPBIAS_##dfs))                        \
7796      abort();                                                                \
7797    D##_s = S##_s;                                                            \
7798    if (_FP_EXP_NORMAL(sfs, swc, S))                                          \
7799 @@ -1211,8 +1221,11 @@
7800         {                                                                    \
7801           if (D##_e <= 0)                                                    \
7802             {                                                                \
7803 -             if (D##_e <= 1 - _FP_FRACBITS_##dfs)                           \
7804 -               _FP_FRAC_SET_##swc(S, _FP_ZEROFRAC_##swc);                   \
7805 +             if (D##_e < 1 - _FP_FRACBITS_##dfs)                            \
7806 +               {                                                            \
7807 +                 _FP_FRAC_SET_##swc(S, _FP_ZEROFRAC_##swc);                 \
7808 +                 _FP_FRAC_LOW_##swc(S) |= 1;                                \
7809 +               }                                                            \
7810               else                                                           \
7811                 {                                                            \
7812                   _FP_FRAC_HIGH_##sfs(S) |= _FP_IMPLBIT_SH_##sfs;            \
7813 @@ -1234,11 +1247,24 @@
7814        if (S##_e == 0)                                                       \
7815         {                                                                    \
7816           D##_e = 0;                                                         \
7817 -         _FP_FRAC_SET_##dwc(D, _FP_ZEROFRAC_##dwc);                         \
7818 -         if (!_FP_FRAC_ZEROP_##swc(S))                                      \
7819 +         if (_FP_FRAC_ZEROP_##swc(S))                                       \
7820 +           _FP_FRAC_SET_##dwc(D, _FP_ZEROFRAC_##dwc);                       \
7821 +         else                                                               \
7822             {                                                                \
7823               FP_SET_EXCEPTION(FP_EX_DENORM);                                \
7824 -             FP_SET_EXCEPTION(FP_EX_INEXACT);                               \
7825 +             if (_FP_EXPBIAS_##sfs                                          \
7826 +                 < _FP_EXPBIAS_##dfs + _FP_FRACBITS_##dfs - 1)              \
7827 +               {                                                            \
7828 +                 _FP_FRAC_SRS_##swc(S, (_FP_WFRACBITS_##sfs                 \
7829 +                                        - _FP_WFRACBITS_##dfs),             \
7830 +                                    _FP_WFRACBITS_##sfs);                   \
7831 +                 _FP_FRAC_COPY_##dwc##_##swc(D, S);                         \
7832 +               }                                                            \
7833 +             else                                                           \
7834 +               {                                                            \
7835 +                 _FP_FRAC_SET_##dwc(D, _FP_ZEROFRAC_##dwc);                 \
7836 +                 _FP_FRAC_LOW_##dwc(D) |= 1;                                \
7837 +               }                                                            \
7838             }                                                                \
7839         }                                                                    \
7840        else                                                                  \
7841 Index: gcc/config/soft-fp/floatundisf.c
7842 ===================================================================
7843 --- gcc/config/soft-fp/floatundisf.c    (.../tags/gcc_4_2_0_release)    (wersja 125589)
7844 +++ gcc/config/soft-fp/floatundisf.c    (.../branches/gcc-4_2-branch)   (wersja 125589)
7845 @@ -1,6 +1,6 @@
7846  /* Software floating-point emulation.
7847     Convert a 64bit unsigned integer to IEEE single
7848 -   Copyright (C) 1997,1999, 2006 Free Software Foundation, Inc.
7849 +   Copyright (C) 1997, 1999, 2006, 2007 Free Software Foundation, Inc.
7850     This file is part of the GNU C Library.
7851     Contributed by Richard Henderson (rth@cygnus.com) and
7852                   Jakub Jelinek (jj@ultra.linux.cz).
7853 @@ -32,8 +32,7 @@
7854  #include "soft-fp.h"
7855  #include "single.h"
7856  
7857 -float
7858 -__floatundisf(UDItype i)
7859 +SFtype __floatundisf(UDItype i)
7860  {
7861    FP_DECL_EX;
7862    FP_DECL_S(A);
7863 Index: gcc/config/soft-fp/op-2.h
7864 ===================================================================
7865 --- gcc/config/soft-fp/op-2.h   (.../tags/gcc_4_2_0_release)    (wersja 125589)
7866 +++ gcc/config/soft-fp/op-2.h   (.../branches/gcc-4_2-branch)   (wersja 125589)
7867 @@ -1,6 +1,6 @@
7868  /* Software floating-point emulation.
7869     Basic two-word fraction declaration and manipulation.
7870 -   Copyright (C) 1997,1998,1999,2006 Free Software Foundation, Inc.
7871 +   Copyright (C) 1997,1998,1999,2006,2007 Free Software Foundation, Inc.
7872     This file is part of the GNU C Library.
7873     Contributed by Richard Henderson (rth@cygnus.com),
7874                   Jakub Jelinek (jj@ultra.linux.cz),
7875 @@ -613,3 +613,5 @@
7876  #define _FP_FRAC_COPY_1_2(D, S)                (D##_f = S##_f0)
7877  
7878  #define _FP_FRAC_COPY_2_1(D, S)                ((D##_f0 = S##_f), (D##_f1 = 0))
7879 +
7880 +#define _FP_FRAC_COPY_2_2(D,S)         _FP_FRAC_COPY_2(D,S)
7881 Index: gcc/config/soft-fp/op-4.h
7882 ===================================================================
7883 --- gcc/config/soft-fp/op-4.h   (.../tags/gcc_4_2_0_release)    (wersja 125589)
7884 +++ gcc/config/soft-fp/op-4.h   (.../branches/gcc-4_2-branch)   (wersja 125589)
7885 @@ -1,6 +1,6 @@
7886  /* Software floating-point emulation.
7887     Basic four-word fraction declaration and manipulation.
7888 -   Copyright (C) 1997,1998,1999,2006 Free Software Foundation, Inc.
7889 +   Copyright (C) 1997,1998,1999,2006,2007 Free Software Foundation, Inc.
7890     This file is part of the GNU C Library.
7891     Contributed by Richard Henderson (rth@cygnus.com),
7892                   Jakub Jelinek (jj@ultra.linux.cz),
7893 @@ -684,3 +684,5 @@
7894    D##_f[1] = S##_f1;                           \
7895    D##_f[2] = D##_f[3] = 0;                     \
7896  } while (0)
7897 +
7898 +#define _FP_FRAC_COPY_4_4(D,S) _FP_FRAC_COPY_4(D,S)
7899 Index: gcc/config/soft-fp/double.h
7900 ===================================================================
7901 --- gcc/config/soft-fp/double.h (.../tags/gcc_4_2_0_release)    (wersja 125589)
7902 +++ gcc/config/soft-fp/double.h (.../branches/gcc-4_2-branch)   (wersja 125589)
7903 @@ -1,6 +1,6 @@
7904  /* Software floating-point emulation.
7905     Definitions for IEEE Double Precision
7906 -   Copyright (C) 1997,1998,1999,2006 Free Software Foundation, Inc.
7907 +   Copyright (C) 1997,1998,1999,2006,2007 Free Software Foundation, Inc.
7908     This file is part of the GNU C Library.
7909     Contributed by Richard Henderson (rth@cygnus.com),
7910                   Jakub Jelinek (jj@ultra.linux.cz),
7911 @@ -168,13 +168,13 @@
7912    DFtype flt;
7913    struct {
7914  #if __BYTE_ORDER == __BIG_ENDIAN
7915 -    unsigned sign : 1;
7916 -    unsigned exp  : _FP_EXPBITS_D;
7917 -    unsigned long frac : _FP_FRACBITS_D - (_FP_IMPLBIT_D != 0);
7918 +    unsigned sign   : 1;
7919 +    unsigned exp    : _FP_EXPBITS_D;
7920 +    _FP_W_TYPE frac : _FP_FRACBITS_D - (_FP_IMPLBIT_D != 0);
7921  #else
7922 -    unsigned long frac : _FP_FRACBITS_D - (_FP_IMPLBIT_D != 0);
7923 -    unsigned exp  : _FP_EXPBITS_D;
7924 -    unsigned sign : 1;
7925 +    _FP_W_TYPE frac : _FP_FRACBITS_D - (_FP_IMPLBIT_D != 0);
7926 +    unsigned exp    : _FP_EXPBITS_D;
7927 +    unsigned sign   : 1;
7928  #endif
7929    } bits __attribute__((packed));
7930  };
7931 Index: libstdc++-v3/configure
7932 ===================================================================
7933 --- libstdc++-v3/configure      (.../tags/gcc_4_2_0_release)    (wersja 125589)
7934 +++ libstdc++-v3/configure      (.../branches/gcc-4_2-branch)   (wersja 125589)
7935 @@ -5764,8 +5764,6 @@
7936  
7937  
7938  
7939 -  echo "$as_me:$LINENO: checking for C locale to use" >&5
7940 -echo $ECHO_N "checking for C locale to use... $ECHO_C" >&6
7941     # Check whether --enable-clocale or --disable-clocale was given.
7942  if test "${enable_clocale+set}" = set; then
7943    enableval="$enable_clocale"
7944 @@ -5782,32 +5780,53 @@
7945  fi;
7946  
7947  
7948 -  # If they didn't use this option switch, or if they specified --enable
7949 -  # with no specific model, we'll have to look for one.  If they
7950 -  # specified --disable (???), do likewise.
7951 +  # Deal with gettext issues.  Default to not using it (=no) until we detect
7952 +  # support for it later.  Let the user turn it off via --e/d, but let that
7953 +  # default to on for easier handling.
7954 +  USE_NLS=no
7955 +  # Check whether --enable-nls or --disable-nls was given.
7956 +if test "${enable_nls+set}" = set; then
7957 +  enableval="$enable_nls"
7958 +
7959 +else
7960 +  enable_nls=yes
7961 +fi;
7962 +
7963 +  # Either a known packaage, or "auto"
7964    if test $enable_clocale = no || test $enable_clocale = yes; then
7965       enable_clocale=auto
7966    fi
7967 -
7968 -  # Either a known package, or "auto"
7969    enable_clocale_flag=$enable_clocale
7970  
7971 -  # Probe for locale support if no specific model is specified.
7972 +  # Probe for locale model to use if none specified.
7973    # Default to "generic".
7974    if test $enable_clocale_flag = auto; then
7975      case ${target_os} in
7976        linux* | gnu* | kfreebsd*-gnu | knetbsd*-gnu)
7977 -        cat >conftest.$ac_ext <<_ACEOF
7978 +        enable_clocale_flag=gnu
7979 +        ;;
7980 +      darwin* | freebsd*)
7981 +        enable_clocale_flag=darwin
7982 +       ;;
7983 +      *)
7984 +        enable_clocale_flag=generic
7985 +        ;;
7986 +    esac
7987 +  fi
7988 +
7989 +  # Sanity check model, and test for special functionality.
7990 +  if test $enable_clocale_flag = gnu; then
7991 +    cat >conftest.$ac_ext <<_ACEOF
7992  /* confdefs.h.  */
7993  _ACEOF
7994  cat confdefs.h >>conftest.$ac_ext
7995  cat >>conftest.$ac_ext <<_ACEOF
7996  /* end confdefs.h.  */
7997  
7998 -        #include <features.h>
7999 -        #if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2)
8000 -          _GLIBCXX_ok
8001 -        #endif
8002 +    #include <features.h>
8003 +    #if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2)
8004 +      _GLIBCXX_ok
8005 +    #endif
8006  
8007  _ACEOF
8008  if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
8009 @@ -5819,9 +5838,8 @@
8010  rm -f conftest*
8011  
8012  
8013 -        # Test for bugs early in glibc-2.2.x series
8014 -          if test $enable_clocale_flag = gnu; then
8015 -          if test "$cross_compiling" = yes; then
8016 +    # Test for bugs early in glibc-2.2.x series
8017 +    if test "$cross_compiling" = yes; then
8018    enable_clocale_flag=generic
8019  else
8020    cat >conftest.$ac_ext <<_ACEOF
8021 @@ -5831,28 +5849,28 @@
8022  cat >>conftest.$ac_ext <<_ACEOF
8023  /* end confdefs.h.  */
8024  
8025 -          #define _GNU_SOURCE 1
8026 -          #include <locale.h>
8027 -          #include <string.h>
8028 -          #if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2)
8029 -          extern __typeof(newlocale) __newlocale;
8030 -          extern __typeof(duplocale) __duplocale;
8031 -          extern __typeof(strcoll_l) __strcoll_l;
8032 -          #endif
8033 -          int main()
8034 -          {
8035 -              const char __one[] = "Äuglein Augmen";
8036 -              const char __two[] = "Äuglein";
8037 -              int i;
8038 -              int j;
8039 -              __locale_t        loc;
8040 -               __locale_t        loc_dup;
8041 -              loc = __newlocale(1 << LC_ALL, "de_DE", 0);
8042 -              loc_dup = __duplocale(loc);
8043 -              i = __strcoll_l(__one, __two, loc);
8044 -              j = __strcoll_l(__one, __two, loc_dup);
8045 -              return 0;
8046 -          }
8047 +    #define _GNU_SOURCE 1
8048 +    #include <locale.h>
8049 +    #include <string.h>
8050 +    #if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2)
8051 +    extern __typeof(newlocale) __newlocale;
8052 +    extern __typeof(duplocale) __duplocale;
8053 +    extern __typeof(strcoll_l) __strcoll_l;
8054 +    #endif
8055 +    int main()
8056 +    {
8057 +        const char __one[] = "Äuglein Augmen";
8058 +        const char __two[] = "Äuglein";
8059 +        int i;
8060 +        int j;
8061 +        __locale_t        loc;
8062 +        __locale_t        loc_dup;
8063 +        loc = __newlocale(1 << LC_ALL, "de_DE", 0);
8064 +        loc_dup = __duplocale(loc);
8065 +        i = __strcoll_l(__one, __two, loc);
8066 +        j = __strcoll_l(__one, __two, loc_dup);
8067 +        return 0;
8068 +    }
8069  
8070  _ACEOF
8071  rm -f conftest$ac_exeext
8072 @@ -5877,32 +5895,176 @@
8073  fi
8074  rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
8075  fi
8076 -          fi
8077  
8078 -        # ... at some point put __strxfrm_l tests in as well.
8079 -        ;;
8080 -      darwin* | freebsd*)
8081 -        enable_clocale_flag=darwin
8082 -       ;;
8083 -      *)
8084 -        enable_clocale_flag=generic
8085 -        ;;
8086 -    esac
8087 +    # Set it to scream when it hurts.
8088 +    ac_save_CFLAGS="$CFLAGS"
8089 +    CFLAGS="-Wimplicit-function-declaration -Werror"
8090 +
8091 +    # Use strxfrm_l if available.
8092 +    cat >conftest.$ac_ext <<_ACEOF
8093 +/* confdefs.h.  */
8094 +_ACEOF
8095 +cat confdefs.h >>conftest.$ac_ext
8096 +cat >>conftest.$ac_ext <<_ACEOF
8097 +/* end confdefs.h.  */
8098 +#define _GNU_SOURCE 1
8099 +                   #include <string.h>
8100 +                   #include <locale.h>
8101 +int
8102 +main ()
8103 +{
8104 +char s[128]; __locale_t loc; strxfrm_l(s, "C", 5, loc);
8105 +  ;
8106 +  return 0;
8107 +}
8108 +_ACEOF
8109 +rm -f conftest.$ac_objext
8110 +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
8111 +  (eval $ac_compile) 2>conftest.er1
8112 +  ac_status=$?
8113 +  grep -v '^ *+' conftest.er1 >conftest.err
8114 +  rm -f conftest.er1
8115 +  cat conftest.err >&5
8116 +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
8117 +  (exit $ac_status); } &&
8118 +        { ac_try='test -z "$ac_c_werror_flag"
8119 +                        || test ! -s conftest.err'
8120 +  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
8121 +  (eval $ac_try) 2>&5
8122 +  ac_status=$?
8123 +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
8124 +  (exit $ac_status); }; } &&
8125 +        { ac_try='test -s conftest.$ac_objext'
8126 +  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
8127 +  (eval $ac_try) 2>&5
8128 +  ac_status=$?
8129 +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
8130 +  (exit $ac_status); }; }; then
8131 +
8132 +cat >>confdefs.h <<\_ACEOF
8133 +#define HAVE_STRXFRM_L 1
8134 +_ACEOF
8135 +
8136 +else
8137 +  echo "$as_me: failed program was:" >&5
8138 +sed 's/^/| /' conftest.$ac_ext >&5
8139 +
8140 +fi
8141 +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
8142 +
8143 +    # Use strerror_l if available.
8144 +    cat >conftest.$ac_ext <<_ACEOF
8145 +/* confdefs.h.  */
8146 +_ACEOF
8147 +cat confdefs.h >>conftest.$ac_ext
8148 +cat >>conftest.$ac_ext <<_ACEOF
8149 +/* end confdefs.h.  */
8150 +#define _GNU_SOURCE 1
8151 +                   #include <string.h>
8152 +                   #include <locale.h>
8153 +int
8154 +main ()
8155 +{
8156 +__locale_t loc; strerror_l(5, loc);
8157 +  ;
8158 +  return 0;
8159 +}
8160 +_ACEOF
8161 +rm -f conftest.$ac_objext
8162 +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
8163 +  (eval $ac_compile) 2>conftest.er1
8164 +  ac_status=$?
8165 +  grep -v '^ *+' conftest.er1 >conftest.err
8166 +  rm -f conftest.er1
8167 +  cat conftest.err >&5
8168 +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
8169 +  (exit $ac_status); } &&
8170 +        { ac_try='test -z "$ac_c_werror_flag"
8171 +                        || test ! -s conftest.err'
8172 +  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
8173 +  (eval $ac_try) 2>&5
8174 +  ac_status=$?
8175 +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
8176 +  (exit $ac_status); }; } &&
8177 +        { ac_try='test -s conftest.$ac_objext'
8178 +  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
8179 +  (eval $ac_try) 2>&5
8180 +  ac_status=$?
8181 +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
8182 +  (exit $ac_status); }; }; then
8183 +
8184 +cat >>confdefs.h <<\_ACEOF
8185 +#define HAVE_STRERROR_L 1
8186 +_ACEOF
8187 +
8188 +else
8189 +  echo "$as_me: failed program was:" >&5
8190 +sed 's/^/| /' conftest.$ac_ext >&5
8191 +
8192 +fi
8193 +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
8194 +
8195 +    CFLAGS="$ac_save_CFLAGS"
8196    fi
8197  
8198 -  # Deal with gettext issues.  Default to not using it (=no) until we detect
8199 -  # support for it later.  Let the user turn it off via --e/d, but let that
8200 -  # default to on for easier handling.
8201 -  USE_NLS=no
8202 -  # Check whether --enable-nls or --disable-nls was given.
8203 -if test "${enable_nls+set}" = set; then
8204 -  enableval="$enable_nls"
8205 +  # Perhaps use strerror_r if available, and strerror_l isn't.
8206 +  ac_save_CFLAGS="$CFLAGS"
8207 +  CFLAGS="-Wimplicit-function-declaration -Werror"
8208 +  cat >conftest.$ac_ext <<_ACEOF
8209 +/* confdefs.h.  */
8210 +_ACEOF
8211 +cat confdefs.h >>conftest.$ac_ext
8212 +cat >>conftest.$ac_ext <<_ACEOF
8213 +/* end confdefs.h.  */
8214 +#define _GNU_SOURCE 1
8215 +                 #include <string.h>
8216 +                 #include <locale.h>
8217 +int
8218 +main ()
8219 +{
8220 +char s[128]; strerror_r(5, s, 128);
8221 +  ;
8222 +  return 0;
8223 +}
8224 +_ACEOF
8225 +rm -f conftest.$ac_objext
8226 +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
8227 +  (eval $ac_compile) 2>conftest.er1
8228 +  ac_status=$?
8229 +  grep -v '^ *+' conftest.er1 >conftest.err
8230 +  rm -f conftest.er1
8231 +  cat conftest.err >&5
8232 +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
8233 +  (exit $ac_status); } &&
8234 +        { ac_try='test -z "$ac_c_werror_flag"
8235 +                        || test ! -s conftest.err'
8236 +  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
8237 +  (eval $ac_try) 2>&5
8238 +  ac_status=$?
8239 +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
8240 +  (exit $ac_status); }; } &&
8241 +        { ac_try='test -s conftest.$ac_objext'
8242 +  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
8243 +  (eval $ac_try) 2>&5
8244 +  ac_status=$?
8245 +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
8246 +  (exit $ac_status); }; }; then
8247  
8248 +cat >>confdefs.h <<\_ACEOF
8249 +#define HAVE_STRERROR_R 1
8250 +_ACEOF
8251 +
8252  else
8253 -  enable_nls=yes
8254 -fi;
8255 +  echo "$as_me: failed program was:" >&5
8256 +sed 's/^/| /' conftest.$ac_ext >&5
8257  
8258 +fi
8259 +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
8260 +  CFLAGS="$ac_save_CFLAGS"
8261 +
8262    # Set configure bits for specified locale package
8263 +  echo "$as_me:$LINENO: checking for C locale to use" >&5
8264 +echo $ECHO_N "checking for C locale to use... $ECHO_C" >&6
8265    case ${enable_clocale_flag} in
8266      generic)
8267        echo "$as_me:$LINENO: result: generic" >&5
8268 @@ -8015,7 +8177,7 @@
8269  
8270    # Fake what AC_TRY_COMPILE does.  XXX Look at redoing this new-style.
8271      cat > conftest.$ac_ext << EOF
8272 -#line 8018 "configure"
8273 +#line 8180 "configure"
8274  int main()
8275  {
8276    // NB: _Atomic_word not necessarily int.
8277 @@ -8395,11 +8557,9 @@
8278      # NB: This flag only works reliably after 2.16.1. Configure tests
8279      # for this are difficult, so hard wire a value that should work.
8280  
8281 -    # All these tests are for C++, but run with the "C" compiler driver.
8282 -    # Need to do this so that g++ won't try to link in libstdc++/libsupc++.
8283      ac_test_CFLAGS="${CFLAGS+set}"
8284      ac_save_CFLAGS="$CFLAGS"
8285 -    CFLAGS='-x c++ -Wl,--gc-sections'
8286 +    CFLAGS='-Wl,--gc-sections'
8287  
8288      # Check for -Wl,--gc-sections
8289      echo "$as_me:$LINENO: checking for ld that supports -Wl,--gc-sections" >&5
8290 @@ -54307,11 +54467,9 @@
8291      # NB: This flag only works reliably after 2.16.1. Configure tests
8292      # for this are difficult, so hard wire a value that should work.
8293  
8294 -    # All these tests are for C++, but run with the "C" compiler driver.
8295 -    # Need to do this so that g++ won't try to link in libstdc++/libsupc++.
8296      ac_test_CFLAGS="${CFLAGS+set}"
8297      ac_save_CFLAGS="$CFLAGS"
8298 -    CFLAGS='-x c++ -Wl,--gc-sections'
8299 +    CFLAGS='-Wl,--gc-sections'
8300  
8301      # Check for -Wl,--gc-sections
8302      echo "$as_me:$LINENO: checking for ld that supports -Wl,--gc-sections" >&5
8303 @@ -75669,11 +75827,9 @@
8304      # NB: This flag only works reliably after 2.16.1. Configure tests
8305      # for this are difficult, so hard wire a value that should work.
8306  
8307 -    # All these tests are for C++, but run with the "C" compiler driver.
8308 -    # Need to do this so that g++ won't try to link in libstdc++/libsupc++.
8309      ac_test_CFLAGS="${CFLAGS+set}"
8310      ac_save_CFLAGS="$CFLAGS"
8311 -    CFLAGS='-x c++ -Wl,--gc-sections'
8312 +    CFLAGS='-Wl,--gc-sections'
8313  
8314      # Check for -Wl,--gc-sections
8315      echo "$as_me:$LINENO: checking for ld that supports -Wl,--gc-sections" >&5
8316 @@ -77194,11 +77350,9 @@
8317      # NB: This flag only works reliably after 2.16.1. Configure tests
8318      # for this are difficult, so hard wire a value that should work.
8319  
8320 -    # All these tests are for C++, but run with the "C" compiler driver.
8321 -    # Need to do this so that g++ won't try to link in libstdc++/libsupc++.
8322      ac_test_CFLAGS="${CFLAGS+set}"
8323      ac_save_CFLAGS="$CFLAGS"
8324 -    CFLAGS='-x c++ -Wl,--gc-sections'
8325 +    CFLAGS='-Wl,--gc-sections'
8326  
8327      # Check for -Wl,--gc-sections
8328      echo "$as_me:$LINENO: checking for ld that supports -Wl,--gc-sections" >&5
8329 @@ -78687,11 +78841,9 @@
8330      # NB: This flag only works reliably after 2.16.1. Configure tests
8331      # for this are difficult, so hard wire a value that should work.
8332  
8333 -    # All these tests are for C++, but run with the "C" compiler driver.
8334 -    # Need to do this so that g++ won't try to link in libstdc++/libsupc++.
8335      ac_test_CFLAGS="${CFLAGS+set}"
8336      ac_save_CFLAGS="$CFLAGS"
8337 -    CFLAGS='-x c++ -Wl,--gc-sections'
8338 +    CFLAGS='-Wl,--gc-sections'
8339  
8340      # Check for -Wl,--gc-sections
8341      echo "$as_me:$LINENO: checking for ld that supports -Wl,--gc-sections" >&5
8342 @@ -100579,11 +100731,9 @@
8343      # NB: This flag only works reliably after 2.16.1. Configure tests
8344      # for this are difficult, so hard wire a value that should work.
8345  
8346 -    # All these tests are for C++, but run with the "C" compiler driver.
8347 -    # Need to do this so that g++ won't try to link in libstdc++/libsupc++.
8348      ac_test_CFLAGS="${CFLAGS+set}"
8349      ac_save_CFLAGS="$CFLAGS"
8350 -    CFLAGS='-x c++ -Wl,--gc-sections'
8351 +    CFLAGS='-Wl,--gc-sections'
8352  
8353      # Check for -Wl,--gc-sections
8354      echo "$as_me:$LINENO: checking for ld that supports -Wl,--gc-sections" >&5
8355 @@ -101426,11 +101576,9 @@
8356      # NB: This flag only works reliably after 2.16.1. Configure tests
8357      # for this are difficult, so hard wire a value that should work.
8358  
8359 -    # All these tests are for C++, but run with the "C" compiler driver.
8360 -    # Need to do this so that g++ won't try to link in libstdc++/libsupc++.
8361      ac_test_CFLAGS="${CFLAGS+set}"
8362      ac_save_CFLAGS="$CFLAGS"
8363 -    CFLAGS='-x c++ -Wl,--gc-sections'
8364 +    CFLAGS='-Wl,--gc-sections'
8365  
8366      # Check for -Wl,--gc-sections
8367      echo "$as_me:$LINENO: checking for ld that supports -Wl,--gc-sections" >&5
8368 @@ -102829,11 +102977,9 @@
8369      # NB: This flag only works reliably after 2.16.1. Configure tests
8370      # for this are difficult, so hard wire a value that should work.
8371  
8372 -    # All these tests are for C++, but run with the "C" compiler driver.
8373 -    # Need to do this so that g++ won't try to link in libstdc++/libsupc++.
8374      ac_test_CFLAGS="${CFLAGS+set}"
8375      ac_save_CFLAGS="$CFLAGS"
8376 -    CFLAGS='-x c++ -Wl,--gc-sections'
8377 +    CFLAGS='-Wl,--gc-sections'
8378  
8379      # Check for -Wl,--gc-sections
8380      echo "$as_me:$LINENO: checking for ld that supports -Wl,--gc-sections" >&5
8381 @@ -104624,11 +104770,9 @@
8382      # NB: This flag only works reliably after 2.16.1. Configure tests
8383      # for this are difficult, so hard wire a value that should work.
8384  
8385 -    # All these tests are for C++, but run with the "C" compiler driver.
8386 -    # Need to do this so that g++ won't try to link in libstdc++/libsupc++.
8387      ac_test_CFLAGS="${CFLAGS+set}"
8388      ac_save_CFLAGS="$CFLAGS"
8389 -    CFLAGS='-x c++ -Wl,--gc-sections'
8390 +    CFLAGS='-Wl,--gc-sections'
8391  
8392      # Check for -Wl,--gc-sections
8393      echo "$as_me:$LINENO: checking for ld that supports -Wl,--gc-sections" >&5
8394 @@ -105869,11 +106013,9 @@
8395      # NB: This flag only works reliably after 2.16.1. Configure tests
8396      # for this are difficult, so hard wire a value that should work.
8397  
8398 -    # All these tests are for C++, but run with the "C" compiler driver.
8399 -    # Need to do this so that g++ won't try to link in libstdc++/libsupc++.
8400      ac_test_CFLAGS="${CFLAGS+set}"
8401      ac_save_CFLAGS="$CFLAGS"
8402 -    CFLAGS='-x c++ -Wl,--gc-sections'
8403 +    CFLAGS='-Wl,--gc-sections'
8404  
8405      # Check for -Wl,--gc-sections
8406      echo "$as_me:$LINENO: checking for ld that supports -Wl,--gc-sections" >&5
8407 @@ -106898,11 +107040,9 @@
8408      # NB: This flag only works reliably after 2.16.1. Configure tests
8409      # for this are difficult, so hard wire a value that should work.
8410  
8411 -    # All these tests are for C++, but run with the "C" compiler driver.
8412 -    # Need to do this so that g++ won't try to link in libstdc++/libsupc++.
8413      ac_test_CFLAGS="${CFLAGS+set}"
8414      ac_save_CFLAGS="$CFLAGS"
8415 -    CFLAGS='-x c++ -Wl,--gc-sections'
8416 +    CFLAGS='-Wl,--gc-sections'
8417  
8418      # Check for -Wl,--gc-sections
8419      echo "$as_me:$LINENO: checking for ld that supports -Wl,--gc-sections" >&5
8420 Index: libstdc++-v3/include/bits/ostream.tcc
8421 ===================================================================
8422 --- libstdc++-v3/include/bits/ostream.tcc       (.../tags/gcc_4_2_0_release)    (wersja 125589)
8423 +++ libstdc++-v3/include/bits/ostream.tcc       (.../branches/gcc-4_2-branch)   (wersja 125589)
8424 @@ -334,7 +334,6 @@
8425    extern template ostream& operator<<(ostream&, const char*);
8426    extern template ostream& operator<<(ostream&, const unsigned char*);
8427    extern template ostream& operator<<(ostream&, const signed char*);
8428 -  extern template ostream& __ostream_insert(ostream&, const char*, streamsize);
8429  
8430    extern template ostream& ostream::_M_insert(long);
8431    extern template ostream& ostream::_M_insert(unsigned long);
8432 @@ -356,8 +355,6 @@
8433    extern template wostream& operator<<(wostream&, char);
8434    extern template wostream& operator<<(wostream&, const wchar_t*);
8435    extern template wostream& operator<<(wostream&, const char*);
8436 -  extern template wostream& __ostream_insert(wostream&, const wchar_t*,
8437 -                                            streamsize);
8438  
8439    extern template wostream& wostream::_M_insert(long);
8440    extern template wostream& wostream::_M_insert(unsigned long);
8441 Index: libstdc++-v3/include/bits/ostream_insert.h
8442 ===================================================================
8443 --- libstdc++-v3/include/bits/ostream_insert.h  (.../tags/gcc_4_2_0_release)    (wersja 125589)
8444 +++ libstdc++-v3/include/bits/ostream_insert.h  (.../branches/gcc-4_2-branch)   (wersja 125589)
8445 @@ -109,6 +109,18 @@
8446        return __out;
8447      }
8448  
8449 +  // Inhibit implicit instantiations for required instantiations,
8450 +  // which are defined via explicit instantiations elsewhere.
8451 +  // NB:  This syntax is a GNU extension.
8452 +#if _GLIBCXX_EXTERN_TEMPLATE
8453 +  extern template ostream& __ostream_insert(ostream&, const char*, streamsize);
8454 +
8455 +#ifdef _GLIBCXX_USE_WCHAR_T
8456 +  extern template wostream& __ostream_insert(wostream&, const wchar_t*,
8457 +                                            streamsize);
8458 +#endif
8459 +#endif
8460 +
8461  _GLIBCXX_END_NAMESPACE
8462  
8463  #endif /* _OSTREAM_INSERT_H */
8464 Index: libstdc++-v3/include/std/std_fstream.h
8465 ===================================================================
8466 --- libstdc++-v3/include/std/std_fstream.h      (.../tags/gcc_4_2_0_release)    (wersja 125589)
8467 +++ libstdc++-v3/include/std/std_fstream.h      (.../branches/gcc-4_2-branch)   (wersja 125589)
8468 @@ -1,6 +1,7 @@
8469  // File based streams -*- C++ -*-
8470  
8471 -// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
8472 +// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
8473 +// 2006, 2007
8474  // Free Software Foundation, Inc.
8475  //
8476  // This file is part of the GNU ISO C++ Library.  This library is free
8477 @@ -257,9 +258,30 @@
8478         *  Otherwise it tries to open the file named @a s using the flags
8479         *  given in @a mode.
8480         *
8481 -       *  [Table 92 gives the relation between openmode combinations and the
8482 -       *  equivalent fopen() flags, but the table has not been copied yet.]
8483 -      */
8484 +       *  Table 92, adapted here, gives the relation between openmode
8485 +       *  combinations and the equivalent fopen() flags.
8486 +       *  (NB: lines in|out|app and binary|in|out|app per DR 596)
8487 +       *  +---------------------------------------------------------+
8488 +       *  | ios_base Flag combination            stdio equivalent   |
8489 +       *  |binary  in  out  trunc  app                              |
8490 +       *  +---------------------------------------------------------+
8491 +       *  |             +                        "w"                |
8492 +       *  |             +           +            "a"                |
8493 +       *  |             +     +                  "w"                |
8494 +       *  |         +                            "r"                |
8495 +       *  |         +   +                        "r+"               |
8496 +       *  |         +   +     +                  "w+"               |
8497 +       *  |         +   +           +            "a+"               |
8498 +       *  +---------------------------------------------------------+
8499 +       *  |   +         +                        "wb"               |
8500 +       *  |   +         +           +            "ab"               |
8501 +       *  |   +         +     +                  "wb"               |
8502 +       *  |   +     +                            "rb"               |
8503 +       *  |   +     +   +                        "r+b"              |
8504 +       *  |   +     +   +     +                  "w+b"              |
8505 +       *  |   +     +   +           +            "a+b"              |
8506 +       *  +---------------------------------------------------------+
8507 +       */
8508        __filebuf_type*
8509        open(const char* __s, ios_base::openmode __mode);
8510  
8511 Index: libstdc++-v3/ChangeLog
8512 ===================================================================
8513 --- libstdc++-v3/ChangeLog      (.../tags/gcc_4_2_0_release)    (wersja 125589)
8514 +++ libstdc++-v3/ChangeLog      (.../branches/gcc-4_2-branch)   (wersja 125589)
8515 @@ -1,3 +1,39 @@
8516 +2007-06-08  Paolo Carlini  <pcarlini@suse.de>
8517 +
8518 +       * docs/html/install.html: Adjust consistently with libstdc++/31717.
8519 +
8520 +2007-06-08  Francesco Palagi  <palagi@arcetri.astro.it>
8521 +
8522 +       * include/std/std_fstream.h: Add Table 92 in comment.
8523 +
8524 +2007-06-06  Benjamin Kosnik  <bkoz@redhat.com>
8525 +           Frank Mori Hess  <frank.hess@nist.gov>
8526 +       
8527 +       * docs/html/debug.html: Correct link.
8528 +
8529 +2007-05-28  Benjamin Kosnik  <bkoz@redhat.com>
8530 +
8531 +       PR libstdc++/31717 
8532 +       * acinclude.m4 (GLIBCXX_ENABLE_CLOCALE): Re-organize. Sanity check
8533 +       gnu locale model requests to make sure it will work for the requested
8534 +       target. Add checks for strxfrm_l, strerror_l when in gnu locale,
8535 +       and strerror_r everywhere.
8536 +       * aclocal.m4: Regenerated.
8537 +       * configure: Regenerated.
8538 +       * config.h.in: Regenerated.
8539 +
8540 +2007-05-24  Paolo Carlini  <pcarlini@suse.de>
8541 +
8542 +       * include/bits/ostream.tcc: Do not inhibit implicit instantiation
8543 +       of __ostream_insert here...
8544 +       * include/bits/ostream_insert.h: ... do it here.
8545 +
8546 +2007-05-21  Paolo Carlini  <pcarlini@suse.de>
8547 +
8548 +       PR libstdc++/31621
8549 +       * acinclude.m4 ([GLIBCXX_CHECK_LINKER_FEATURES]): Use the C compiler.
8550 +       * configure: Regenerate.
8551 +
8552  2007-05-13  Release Manager
8553  
8554         * GCC 4.2.0 released.
8555 Index: libstdc++-v3/docs/html/debug.html
8556 ===================================================================
8557 --- libstdc++-v3/docs/html/debug.html   (.../tags/gcc_4_2_0_release)    (wersja 125589)
8558 +++ libstdc++-v3/docs/html/debug.html   (.../branches/gcc-4_2-branch)   (wersja 125589)
8559 @@ -420,7 +420,7 @@
8560  
8561  
8562  <h3 class="left"><a name="verbterm">Tracking uncaught exceptions</a></h3>
8563 -<p>The <a href="19_diagnostics/howto.html#4">verbose termination handler</a>
8564 +<p>The <a href="18_support/howto.html#4">verbose termination handler</a>
8565     gives information about uncaught exceptions which are killing the
8566     program.  It is described in the linked-to page.
8567  </p>
8568 Index: libstdc++-v3/docs/html/install.html
8569 ===================================================================
8570 --- libstdc++-v3/docs/html/install.html (.../tags/gcc_4_2_0_release)    (wersja 125589)
8571 +++ libstdc++-v3/docs/html/install.html (.../branches/gcc-4_2-branch)   (wersja 125589)
8572 @@ -80,8 +80,9 @@
8573        information must be installed.
8574  
8575        <p>
8576 -      The configure option --enable-clocale can be used force a
8577 -      particular behavior.
8578 +      Note that those sanity checks are also perfomed when an explicit
8579 +      --enable-clocale=gnu configure option is used:  this behavior is
8580 +      new in gcc 4.2.1 and defends against misconfigurations.
8581        </p>
8582  
8583        <p>
8584 Index: libstdc++-v3/config.h.in
8585 ===================================================================
8586 --- libstdc++-v3/config.h.in    (.../tags/gcc_4_2_0_release)    (wersja 125589)
8587 +++ libstdc++-v3/config.h.in    (.../branches/gcc-4_2-branch)   (wersja 125589)
8588 @@ -298,6 +298,12 @@
8589  /* Define to 1 if you have the <stdlib.h> header file. */
8590  #undef HAVE_STDLIB_H
8591  
8592 +/* Define if strerror_l is available in <string.h>. */
8593 +#undef HAVE_STRERROR_L
8594 +
8595 +/* Define if strerror_r is available in <string.h>. */
8596 +#undef HAVE_STRERROR_R
8597 +
8598  /* Define to 1 if you have the <strings.h> header file. */
8599  #undef HAVE_STRINGS_H
8600  
8601 @@ -310,6 +316,9 @@
8602  /* Define to 1 if you have the `strtold' function. */
8603  #undef HAVE_STRTOLD
8604  
8605 +/* Define if strxfrm_l is available in <string.h>. */
8606 +#undef HAVE_STRXFRM_L
8607 +
8608  /* Define to 1 if you have the <sys/filio.h> header file. */
8609  #undef HAVE_SYS_FILIO_H
8610  
8611 Index: libstdc++-v3/acinclude.m4
8612 ===================================================================
8613 --- libstdc++-v3/acinclude.m4   (.../tags/gcc_4_2_0_release)    (wersja 125589)
8614 +++ libstdc++-v3/acinclude.m4   (.../branches/gcc-4_2-branch)   (wersja 125589)
8615 @@ -251,11 +251,9 @@
8616      # NB: This flag only works reliably after 2.16.1. Configure tests
8617      # for this are difficult, so hard wire a value that should work.
8618  
8619 -    # All these tests are for C++, but run with the "C" compiler driver.
8620 -    # Need to do this so that g++ won't try to link in libstdc++/libsupc++.
8621      ac_test_CFLAGS="${CFLAGS+set}"
8622      ac_save_CFLAGS="$CFLAGS"
8623 -    CFLAGS='-x c++ -Wl,--gc-sections'
8624 +    CFLAGS='-Wl,--gc-sections'
8625  
8626      # Check for -Wl,--gc-sections
8627      AC_MSG_CHECKING([for ld that supports -Wl,--gc-sections])
8628 @@ -1334,64 +1332,31 @@
8629  dnl Default is generic.
8630  dnl
8631  AC_DEFUN([GLIBCXX_ENABLE_CLOCALE], [
8632 -  AC_MSG_CHECKING([for C locale to use])
8633    GLIBCXX_ENABLE(clocale,auto,[@<:@=MODEL@:>@],
8634      [use MODEL for target locale package],
8635      [permit generic|gnu|ieee_1003.1-2001|yes|no|auto])
8636 +
8637 +  # Deal with gettext issues.  Default to not using it (=no) until we detect
8638 +  # support for it later.  Let the user turn it off via --e/d, but let that
8639 +  # default to on for easier handling.
8640 +  USE_NLS=no
8641 +  AC_ARG_ENABLE(nls,
8642 +    AC_HELP_STRING([--enable-nls],[use Native Language Support (default)]),
8643 +    [],
8644 +    [enable_nls=yes])
8645    
8646 -  # If they didn't use this option switch, or if they specified --enable
8647 -  # with no specific model, we'll have to look for one.  If they
8648 -  # specified --disable (???), do likewise.
8649 +  # Either a known packaage, or "auto"
8650    if test $enable_clocale = no || test $enable_clocale = yes; then
8651       enable_clocale=auto
8652    fi
8653 -
8654 -  # Either a known package, or "auto"
8655    enable_clocale_flag=$enable_clocale
8656  
8657 -  # Probe for locale support if no specific model is specified.
8658 +  # Probe for locale model to use if none specified.
8659    # Default to "generic".
8660    if test $enable_clocale_flag = auto; then
8661      case ${target_os} in
8662        linux* | gnu* | kfreebsd*-gnu | knetbsd*-gnu)
8663 -        AC_EGREP_CPP([_GLIBCXX_ok], [
8664 -        #include <features.h>
8665 -        #if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2)
8666 -          _GLIBCXX_ok
8667 -        #endif
8668 -        ], enable_clocale_flag=gnu, enable_clocale_flag=generic)
8669 -
8670 -        # Test for bugs early in glibc-2.2.x series
8671 -          if test $enable_clocale_flag = gnu; then
8672 -          AC_TRY_RUN([
8673 -          #define _GNU_SOURCE 1
8674 -          #include <locale.h>
8675 -          #include <string.h>
8676 -          #if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2)
8677 -          extern __typeof(newlocale) __newlocale;
8678 -          extern __typeof(duplocale) __duplocale;
8679 -          extern __typeof(strcoll_l) __strcoll_l;
8680 -          #endif
8681 -          int main()
8682 -          {
8683 -              const char __one[] = "Äuglein Augmen";
8684 -              const char __two[] = "Äuglein";
8685 -              int i;
8686 -              int j;
8687 -              __locale_t        loc;
8688 -               __locale_t        loc_dup;
8689 -              loc = __newlocale(1 << LC_ALL, "de_DE", 0);
8690 -              loc_dup = __duplocale(loc);
8691 -              i = __strcoll_l(__one, __two, loc);
8692 -              j = __strcoll_l(__one, __two, loc_dup);
8693 -              return 0;
8694 -          }
8695 -          ],
8696 -          [enable_clocale_flag=gnu],[enable_clocale_flag=generic],
8697 -          [enable_clocale_flag=generic])
8698 -          fi
8699 -
8700 -        # ... at some point put __strxfrm_l tests in as well.
8701 +        enable_clocale_flag=gnu        
8702          ;;
8703        darwin* | freebsd*)
8704          enable_clocale_flag=darwin
8705 @@ -1402,16 +1367,79 @@
8706      esac
8707    fi
8708  
8709 -  # Deal with gettext issues.  Default to not using it (=no) until we detect
8710 -  # support for it later.  Let the user turn it off via --e/d, but let that
8711 -  # default to on for easier handling.
8712 -  USE_NLS=no
8713 -  AC_ARG_ENABLE(nls,
8714 -    AC_HELP_STRING([--enable-nls],[use Native Language Support (default)]),
8715 -    [],
8716 -    [enable_nls=yes])
8717 +  # Sanity check model, and test for special functionality.
8718 +  if test $enable_clocale_flag = gnu; then
8719 +    AC_EGREP_CPP([_GLIBCXX_ok], [
8720 +    #include <features.h>
8721 +    #if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2)
8722 +      _GLIBCXX_ok
8723 +    #endif
8724 +    ], enable_clocale_flag=gnu, enable_clocale_flag=generic)
8725  
8726 +    # Test for bugs early in glibc-2.2.x series
8727 +    AC_TRY_RUN([
8728 +    #define _GNU_SOURCE 1
8729 +    #include <locale.h>
8730 +    #include <string.h>
8731 +    #if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2)
8732 +    extern __typeof(newlocale) __newlocale;
8733 +    extern __typeof(duplocale) __duplocale;
8734 +    extern __typeof(strcoll_l) __strcoll_l;
8735 +    #endif
8736 +    int main()
8737 +    {
8738 +        const char __one[] = "Äuglein Augmen";
8739 +        const char __two[] = "Äuglein";
8740 +        int i;
8741 +        int j;
8742 +        __locale_t        loc;
8743 +        __locale_t        loc_dup;
8744 +        loc = __newlocale(1 << LC_ALL, "de_DE", 0);
8745 +        loc_dup = __duplocale(loc);
8746 +        i = __strcoll_l(__one, __two, loc);
8747 +        j = __strcoll_l(__one, __two, loc_dup);
8748 +        return 0;
8749 +    }
8750 +    ],
8751 +    [enable_clocale_flag=gnu],[enable_clocale_flag=generic],
8752 +    [enable_clocale_flag=generic])
8753 +
8754 +    # Set it to scream when it hurts.
8755 +    ac_save_CFLAGS="$CFLAGS"   
8756 +    CFLAGS="-Wimplicit-function-declaration -Werror"
8757 +
8758 +    # Use strxfrm_l if available.
8759 +    AC_TRY_COMPILE([#define _GNU_SOURCE 1
8760 +                   #include <string.h>
8761 +                   #include <locale.h>],
8762 +                   [char s[128]; __locale_t loc; strxfrm_l(s, "C", 5, loc);], 
8763 +                    AC_DEFINE(HAVE_STRXFRM_L, 1, 
8764 +                    [Define if strxfrm_l is available in <string.h>.]),)
8765 +    
8766 +    # Use strerror_l if available.
8767 +    AC_TRY_COMPILE([#define _GNU_SOURCE 1
8768 +                   #include <string.h>
8769 +                   #include <locale.h>],
8770 +                   [__locale_t loc; strerror_l(5, loc);], 
8771 +                    AC_DEFINE(HAVE_STRERROR_L, 1, 
8772 +                    [Define if strerror_l is available in <string.h>.]),)
8773 +
8774 +    CFLAGS="$ac_save_CFLAGS"
8775 +  fi
8776 +
8777 +  # Perhaps use strerror_r if available, and strerror_l isn't.
8778 +  ac_save_CFLAGS="$CFLAGS"     
8779 +  CFLAGS="-Wimplicit-function-declaration -Werror"
8780 +  AC_TRY_COMPILE([#define _GNU_SOURCE 1
8781 +                 #include <string.h>
8782 +                 #include <locale.h>],
8783 +                 [char s[128]; strerror_r(5, s, 128);], 
8784 +                  AC_DEFINE(HAVE_STRERROR_R, 1, 
8785 +                  [Define if strerror_r is available in <string.h>.]),)
8786 +  CFLAGS="$ac_save_CFLAGS"
8787 +
8788    # Set configure bits for specified locale package
8789 +  AC_MSG_CHECKING([for C locale to use])
8790    case ${enable_clocale_flag} in
8791      generic)
8792        AC_MSG_RESULT(generic)
8793 Index: libgfortran/runtime/environ.c
8794 ===================================================================
8795 --- libgfortran/runtime/environ.c       (.../tags/gcc_4_2_0_release)    (wersja 125589)
8796 +++ libgfortran/runtime/environ.c       (.../branches/gcc-4_2-branch)   (wersja 125589)
8797 @@ -861,14 +861,13 @@
8798  static int
8799  do_parse (void)
8800  {
8801 -  int tok, def;
8802 +  int tok;
8803    int unit1;
8804    int continue_ulist;
8805    char *start;
8806  
8807    unit_count = 0;
8808  
8809 -  def = 0;
8810    start = p;
8811  
8812    /* Parse the string.  First, let's look for a default.  */
8813 @@ -923,6 +922,7 @@
8814        break;
8815  
8816      case END:
8817 +      def = endian;
8818        goto end;
8819        break;
8820  
8821 @@ -939,6 +939,18 @@
8822        tok = next_token ();
8823        switch (tok)
8824         {
8825 +       case NATIVE:
8826 +         if (next_token () != ':')
8827 +           goto error;
8828 +         endian = CONVERT_NATIVE;
8829 +         break;
8830 +
8831 +       case SWAP:
8832 +         if (next_token () != ':')
8833 +           goto error;
8834 +         endian = CONVERT_SWAP;
8835 +         break;
8836 +
8837         case LITTLE:
8838           if (next_token () != ':')
8839             goto error;
8840 Index: libgfortran/intrinsics/reshape_generic.c
8841 ===================================================================
8842 --- libgfortran/intrinsics/reshape_generic.c    (.../tags/gcc_4_2_0_release)    (wersja 125589)
8843 +++ libgfortran/intrinsics/reshape_generic.c    (.../branches/gcc-4_2-branch)   (wersja 125589)
8844 @@ -266,7 +266,7 @@
8845            else
8846              {
8847                scount[n]++;
8848 -              sptr += sstride[n] * size;
8849 +              src += sstride[n] * size;
8850              }
8851          }
8852      }
8853 Index: libgfortran/intrinsics/ishftc.c
8854 ===================================================================
8855 --- libgfortran/intrinsics/ishftc.c     (.../tags/gcc_4_2_0_release)    (wersja 125589)
8856 +++ libgfortran/intrinsics/ishftc.c     (.../branches/gcc-4_2-branch)   (wersja 125589)
8857 @@ -36,8 +36,7 @@
8858  GFC_INTEGER_4
8859  ishftc4 (GFC_INTEGER_4 i, GFC_INTEGER_4 shift, GFC_INTEGER_4 size)
8860  {
8861 -  GFC_INTEGER_4 mask;
8862 -  GFC_UINTEGER_4 bits;
8863 +  GFC_UINTEGER_4 mask, bits;
8864  
8865    if (shift < 0)
8866      shift = shift + size;
8867 @@ -45,9 +44,14 @@
8868    if (shift == 0 || shift == size)
8869      return i;
8870  
8871 -  mask = (~(GFC_INTEGER_4)0) << size;
8872 -  bits = i & ~mask;
8873 -  return (i & mask) | (bits >> (size - shift)) | ((i << shift) & ~mask);
8874 +  /* In C, the result of the shift operator is undefined if the right operand
8875 +     is greater than or equal to the number of bits in the left operand. So we
8876 +     have to special case it for fortran.  */
8877 +  mask = ~((size == 32) ? 0 : (~0 << size));
8878 +
8879 +  bits = i & mask;
8880 +  
8881 +  return (i & ~mask) | ((bits << shift) & mask) | (bits >> (size - shift));
8882  }
8883  
8884  extern GFC_INTEGER_8 ishftc8 (GFC_INTEGER_8, GFC_INTEGER_4, GFC_INTEGER_4);
8885 @@ -56,8 +60,7 @@
8886  GFC_INTEGER_8
8887  ishftc8 (GFC_INTEGER_8 i, GFC_INTEGER_4 shift, GFC_INTEGER_4 size)
8888  {
8889 -  GFC_INTEGER_8 mask;
8890 -  GFC_UINTEGER_8 bits;
8891 +  GFC_UINTEGER_8 mask, bits;
8892  
8893    if (shift < 0)
8894      shift = shift + size;
8895 @@ -65,9 +68,14 @@
8896    if (shift == 0 || shift == size)
8897      return i;
8898  
8899 -  mask = (~(GFC_INTEGER_8)0) << size;
8900 -  bits = i & ~mask;
8901 -  return (i & mask) | (bits >> (size - shift)) | ((i << shift) & ~mask);
8902 +  /* In C, the result of the shift operator is undefined if the right operand
8903 +     is greater than or equal to the number of bits in the left operand. So we
8904 +     have to special case it for fortran.  */
8905 +  mask = ~((size == 64) ? 0 : (~0 << size));
8906 +
8907 +  bits = i & mask;
8908 +  
8909 +  return (i & ~mask) | ((bits << shift) & mask) | (bits >> (size - shift));
8910  }
8911  
8912  #ifdef HAVE_GFC_INTEGER_16
8913 @@ -77,8 +85,7 @@
8914  GFC_INTEGER_16
8915  ishftc16 (GFC_INTEGER_16 i, GFC_INTEGER_4 shift, GFC_INTEGER_4 size)
8916  {
8917 -  GFC_INTEGER_16 mask;
8918 -  GFC_UINTEGER_16 bits;
8919 +  GFC_UINTEGER_16 mask, bits;
8920  
8921    if (shift < 0)
8922      shift = shift + size;
8923 @@ -86,8 +93,13 @@
8924    if (shift == 0 || shift == size)
8925      return i;
8926  
8927 -  mask = (~(GFC_INTEGER_16)0) << size;
8928 -  bits = i & ~mask;
8929 -  return (i & mask) | (bits >> (size - shift)) | ((i << shift) & ~mask);
8930 +  /* In C, the result of the shift operator is undefined if the right operand
8931 +     is greater than or equal to the number of bits in the left operand. So we
8932 +     have to special case it for fortran.  */
8933 +  mask = ~((size == 128) ? 0 : (~0 << size));
8934 +
8935 +  bits = i & mask;
8936 +  
8937 +  return (i & ~mask) | ((bits << shift) & mask) | (bits >> (size - shift));
8938  }
8939  #endif
8940 Index: libgfortran/ChangeLog
8941 ===================================================================
8942 --- libgfortran/ChangeLog       (.../tags/gcc_4_2_0_release)    (wersja 125589)
8943 +++ libgfortran/ChangeLog       (.../branches/gcc-4_2-branch)   (wersja 125589)
8944 @@ -1,3 +1,53 @@
8945 +2007-05-23  Jerry DeLisle  <jvdelisle@gcc.gnu.org>
8946 +
8947 +       PR libfortran/31964
8948 +       Backport from trunk.
8949 +       * intrinsics/ishftc.c (ishftc4, ishftc8, ishftc16): Fix mask to handle
8950 +       shift of bit-size number of bits.
8951 +
8952 +2007-05-23  Tobias Burnus <burnus@net-b.de>
8953 +
8954 +       PR fortran/31917
8955 +       Backport from trunk.
8956 +       * runtime/environ.c (mark_range): Fix setting default convert unit.
8957 +
8958 +2007-05-22  Jerry DeLisle  <jvdelisle@gcc.gnu.org>
8959 +
8960 +       PR libfortran/31051
8961 +       Backport from trunk.
8962 +       * io/transfer.c (formatted_transfer_scalar): Adjust position for pending
8963 +       spaces when in writing mode.  Clean up some formatting.
8964 +       
8965 +2007-05-22  Tobias Burnus  <burnus@net-b.de>
8966 +
8967 +       PR libfortran/31915
8968 +       Backport from trunk.
8969 +       * io/transfer.c (unformatted_read): Use proper size for real(10).
8970 +         (unformatted_write): Ditto.
8971 +
8972 +2007-05-20  Jerry DeLisle  <jvdelisle@gcc.gnu.org>
8973 +
8974 +       PR libfortran/31395
8975 +       Backport from 4.3.
8976 +       * io/format.c (parse_format_list): Fix parsing. Regression against g77.
8977 +
8978 +2007-05-20  Thomas Koenig  <tkoenig@gcc.gnu.org>
8979 +
8980 +       PR fortran/31618
8981 +       Backport from trunk.
8982 +       * io/transfer.c (read_block_direct):  Instead of calling us_read,
8983 +       set dtp->u.p.current_unit->current_record = 0 so that pre_position
8984 +       will read the record marker.
8985 +       (data_transfer_init):  For different error conditions, call
8986 +       generate_error, then return.
8987 +
8988 +2007-05-20  Thomas Koenig  <tkoenig@gcc.gnu.org>
8989 +
8990 +       PR libfortran/31196
8991 +       Backport from trunk.
8992 +       * intrinsics/reshape_generic.c (reshape_internal):  Increment
8993 +       correct variable.
8994 +
8995  2007-05-13  Release Manager
8996  
8997         * GCC 4.2.0 released.
8998 Index: libgfortran/io/transfer.c
8999 ===================================================================
9000 --- libgfortran/io/transfer.c   (.../tags/gcc_4_2_0_release)    (wersja 125589)
9001 +++ libgfortran/io/transfer.c   (.../branches/gcc-4_2-branch)   (wersja 125589)
9002 @@ -493,11 +493,11 @@
9003             }
9004           else
9005             {
9006 -             /* Let's make sure the file position is correctly set for the
9007 -                next read statement.  */
9008 +             /* Let's make sure the file position is correctly pre-positioned
9009 +                for the next read statement.  */
9010  
9011 +             dtp->u.p.current_unit->current_record = 0;
9012               next_record_r_unf (dtp, 0);
9013 -             us_read (dtp, 0);
9014               generate_error (&dtp->common, ERROR_SHORT_RECORD, NULL);
9015               return;
9016             }
9017 @@ -722,7 +722,11 @@
9018          of the padding.  If we hit a short record, then sz is
9019          adjusted accordingly, making later reads no-ops.  */
9020        
9021 -      sz = kind;
9022 +      if (type == BT_REAL || type == BT_COMPLEX)
9023 +       sz = size_from_real_kind (kind);
9024 +      else
9025 +       sz = kind;
9026 +
9027        for (i=0; i<nelems; i++)
9028         {
9029           read_block_direct (dtp, buffer, &sz);
9030 @@ -767,7 +771,11 @@
9031          read kind bytes.  We don't care about the contents
9032          of the padding.  */
9033  
9034 -      sz = kind;
9035 +      if (type == BT_REAL || type == BT_COMPLEX)
9036 +       sz = size_from_real_kind (kind);
9037 +      else
9038 +       sz = kind;
9039 +
9040        for (i=0; i<nelems; i++)
9041         {
9042           reverse_memcpy(buffer, p, size);
9043 @@ -1144,7 +1152,7 @@
9044         /* Format codes that don't transfer data.  */
9045         case FMT_X:
9046         case FMT_TR:
9047 -         consume_data_flag = 0 ;
9048 +         consume_data_flag = 0;
9049  
9050           pos = bytes_used + f->u.n + dtp->u.p.skips;
9051           dtp->u.p.skips = f->u.n + dtp->u.p.skips;
9052 @@ -1160,6 +1168,7 @@
9053               write_x (dtp, dtp->u.p.skips, dtp->u.p.pending_spaces);
9054               dtp->u.p.skips = dtp->u.p.pending_spaces = 0;
9055             }
9056 +
9057           if (dtp->u.p.mode == READING)
9058             read_x (dtp, f->u.n);
9059  
9060 @@ -1167,6 +1176,8 @@
9061  
9062         case FMT_TL:
9063         case FMT_T:
9064 +         consume_data_flag = 0;
9065 +
9066           if (f->format == FMT_TL)
9067             {
9068  
9069 @@ -1185,8 +1196,10 @@
9070             }
9071           else /* FMT_T */
9072             {
9073 -             consume_data_flag = 0;
9074 -             pos = f->u.n - 1;
9075 +             if (dtp->u.p.mode == READING)
9076 +               pos = f->u.n - 1;
9077 +             else
9078 +               pos = f->u.n - dtp->u.p.pending_spaces - 1;
9079             }
9080  
9081           /* Standard 10.6.1.1: excessive left tabbing is reset to the
9082 @@ -1753,16 +1766,19 @@
9083    /* Check the action.  */
9084  
9085    if (read_flag && dtp->u.p.current_unit->flags.action == ACTION_WRITE)
9086 -    generate_error (&dtp->common, ERROR_BAD_ACTION,
9087 -                   "Cannot read from file opened for WRITE");
9088 +    {
9089 +      generate_error (&dtp->common, ERROR_BAD_ACTION,
9090 +                     "Cannot read from file opened for WRITE");
9091 +      return;
9092 +    }
9093  
9094    if (!read_flag && dtp->u.p.current_unit->flags.action == ACTION_READ)
9095 -    generate_error (&dtp->common, ERROR_BAD_ACTION,
9096 -                   "Cannot write to file opened for READ");
9097 +    {
9098 +      generate_error (&dtp->common, ERROR_BAD_ACTION,
9099 +                     "Cannot write to file opened for READ");
9100 +      return;
9101 +    }
9102  
9103 -  if ((dtp->common.flags & IOPARM_LIBRETURN_MASK) != IOPARM_LIBRETURN_OK)
9104 -    return;
9105 -
9106    dtp->u.p.first_item = 1;
9107  
9108    /* Check the format.  */
9109 @@ -1770,14 +1786,14 @@
9110    if ((cf & IOPARM_DT_HAS_FORMAT) != 0)
9111      parse_format (dtp);
9112  
9113 -  if ((dtp->common.flags & IOPARM_LIBRETURN_MASK) != IOPARM_LIBRETURN_OK)
9114 -    return;
9115 -
9116    if (dtp->u.p.current_unit->flags.form == FORM_UNFORMATTED
9117        && (cf & (IOPARM_DT_HAS_FORMAT | IOPARM_DT_LIST_FORMAT))
9118          != 0)
9119 -    generate_error (&dtp->common, ERROR_OPTION_CONFLICT,
9120 -                   "Format present for UNFORMATTED data transfer");
9121 +    {
9122 +      generate_error (&dtp->common, ERROR_OPTION_CONFLICT,
9123 +                     "Format present for UNFORMATTED data transfer");
9124 +      return;
9125 +    }
9126  
9127    if ((cf & IOPARM_DT_HAS_NAMELIST_NAME) != 0 && dtp->u.p.ionml != NULL)
9128       {
9129 @@ -1787,13 +1803,19 @@
9130       }
9131    else if (dtp->u.p.current_unit->flags.form == FORM_FORMATTED &&
9132            !(cf & (IOPARM_DT_HAS_FORMAT | IOPARM_DT_LIST_FORMAT)))
9133 -    generate_error (&dtp->common, ERROR_OPTION_CONFLICT,
9134 -                   "Missing format for FORMATTED data transfer");
9135 +    {
9136 +      generate_error (&dtp->common, ERROR_OPTION_CONFLICT,
9137 +                     "Missing format for FORMATTED data transfer");
9138 +    }
9139  
9140    if (is_internal_unit (dtp)
9141        && dtp->u.p.current_unit->flags.form == FORM_UNFORMATTED)
9142 -    generate_error (&dtp->common, ERROR_OPTION_CONFLICT,
9143 -                   "Internal file cannot be accessed by UNFORMATTED data transfer");
9144 +    {
9145 +      generate_error (&dtp->common, ERROR_OPTION_CONFLICT,
9146 +                     "Internal file cannot be accessed by UNFORMATTED "
9147 +                     "data transfer");
9148 +      return;
9149 +    }
9150  
9151    /* Check the record or position number.  */
9152  
9153 @@ -1823,49 +1845,71 @@
9154    if (dtp->u.p.advance_status != ADVANCE_UNSPECIFIED)
9155      {
9156        if (dtp->u.p.current_unit->flags.access == ACCESS_DIRECT)
9157 -       generate_error (&dtp->common, ERROR_OPTION_CONFLICT,
9158 -                       "ADVANCE specification conflicts with sequential access");
9159 +       {
9160 +         generate_error (&dtp->common, ERROR_OPTION_CONFLICT,
9161 +                         "ADVANCE specification conflicts with sequential access");
9162 +         return;
9163 +       }
9164  
9165        if (is_internal_unit (dtp))
9166 -       generate_error (&dtp->common, ERROR_OPTION_CONFLICT,
9167 -                       "ADVANCE specification conflicts with internal file");
9168 +       {
9169 +         generate_error (&dtp->common, ERROR_OPTION_CONFLICT,
9170 +                         "ADVANCE specification conflicts with internal file");
9171 +         return;
9172 +       }
9173  
9174        if ((cf & (IOPARM_DT_HAS_FORMAT | IOPARM_DT_LIST_FORMAT))
9175           != IOPARM_DT_HAS_FORMAT)
9176 -       generate_error (&dtp->common, ERROR_OPTION_CONFLICT,
9177 -                       "ADVANCE specification requires an explicit format");
9178 +       {
9179 +         generate_error (&dtp->common, ERROR_OPTION_CONFLICT,
9180 +                         "ADVANCE specification requires an explicit format");
9181 +         return;
9182 +       }
9183      }
9184  
9185    if (read_flag)
9186      {
9187        if ((cf & IOPARM_EOR) != 0 && dtp->u.p.advance_status != ADVANCE_NO)
9188 -       generate_error (&dtp->common, ERROR_MISSING_OPTION,
9189 -                       "EOR specification requires an ADVANCE specification of NO");
9190 +       {
9191 +         generate_error (&dtp->common, ERROR_MISSING_OPTION,
9192 +                         "EOR specification requires an ADVANCE specification "
9193 +                         "of NO");
9194 +         return;
9195 +       }
9196  
9197        if ((cf & IOPARM_DT_HAS_SIZE) != 0 && dtp->u.p.advance_status != ADVANCE_NO)
9198 -       generate_error (&dtp->common, ERROR_MISSING_OPTION,
9199 -                       "SIZE specification requires an ADVANCE specification of NO");
9200 -
9201 +       {
9202 +         generate_error (&dtp->common, ERROR_MISSING_OPTION,
9203 +                         "SIZE specification requires an ADVANCE specification of NO");
9204 +         return;
9205 +       }
9206      }
9207    else
9208      {                          /* Write constraints.  */
9209        if ((cf & IOPARM_END) != 0)
9210 -       generate_error (&dtp->common, ERROR_OPTION_CONFLICT,
9211 -                       "END specification cannot appear in a write statement");
9212 +       {
9213 +         generate_error (&dtp->common, ERROR_OPTION_CONFLICT,
9214 +                         "END specification cannot appear in a write statement");
9215 +         return;
9216 +       }
9217  
9218        if ((cf & IOPARM_EOR) != 0)
9219 -       generate_error (&dtp->common, ERROR_OPTION_CONFLICT,
9220 -                       "EOR specification cannot appear in a write statement");
9221 +       {
9222 +         generate_error (&dtp->common, ERROR_OPTION_CONFLICT,
9223 +                         "EOR specification cannot appear in a write statement");
9224 +         return;
9225 +       }
9226  
9227        if ((cf & IOPARM_DT_HAS_SIZE) != 0)
9228 -       generate_error (&dtp->common, ERROR_OPTION_CONFLICT,
9229 -                       "SIZE specification cannot appear in a write statement");
9230 +       {
9231 +         generate_error (&dtp->common, ERROR_OPTION_CONFLICT,
9232 +                         "SIZE specification cannot appear in a write statement");
9233 +         return;
9234 +       }
9235      }
9236  
9237    if (dtp->u.p.advance_status == ADVANCE_UNSPECIFIED)
9238      dtp->u.p.advance_status = ADVANCE_YES;
9239 -  if ((dtp->common.flags & IOPARM_LIBRETURN_MASK) != IOPARM_LIBRETURN_OK)
9240 -    return;
9241  
9242    /* Sanity checks on the record number.  */
9243    if ((cf & IOPARM_DT_HAS_REC) != 0)
9244 Index: libgfortran/io/format.c
9245 ===================================================================
9246 --- libgfortran/io/format.c     (.../tags/gcc_4_2_0_release)    (wersja 125589)
9247 +++ libgfortran/io/format.c     (.../branches/gcc-4_2-branch)   (wersja 125589)
9248 @@ -860,10 +860,11 @@
9249      case FMT_SLASH:
9250        get_fnode (fmt, &head, &tail, FMT_SLASH);
9251        tail->repeat = 1;
9252 +      goto optional_comma;
9253  
9254 -      /* Fall Through */
9255 -
9256      case FMT_COLON:
9257 +      get_fnode (fmt, &head, &tail, FMT_COLON);
9258 +      tail->repeat = 1;
9259        goto optional_comma;
9260  
9261      case FMT_END:
9262 Index: boehm-gc/darwin_stop_world.c
9263 ===================================================================
9264 --- boehm-gc/darwin_stop_world.c        (.../tags/gcc_4_2_0_release)    (wersja 125589)
9265 +++ boehm-gc/darwin_stop_world.c        (.../branches/gcc-4_2-branch)   (wersja 125589)
9266 @@ -10,7 +10,7 @@
9267     be allocated, is called the red zone. This area as shown in Figure 3-2 may
9268     be used for any purpose as long as a new stack frame does not need to be
9269     added to the stack."
9270 -   
9271 +
9272     Page 50: "If a leaf procedure's red zone usage would exceed 224 bytes, then
9273     it must set up a stack frame just like routines that call other routines."
9274  */
9275 @@ -20,48 +20,6 @@
9276  # define PPC_RED_ZONE_SIZE 320
9277  #endif
9278  
9279 -/* Try to work out the right way to access thread state structure members.
9280 -   The structure has changed its definition in different Darwin versions.  */
9281 -#if defined(__ppc__)
9282 -# define THREAD_STATE ppc_thread_state_t
9283 -# if defined (HAS_PPC_THREAD_STATE_R0)
9284 -#  define THREAD_FLD(x) x
9285 -# elif defined (HAS_PPC_THREAD_STATE___R0)
9286 -#  define THREAD_FLD(x) __ ## x
9287 -# else
9288 -#  error can not work out how to access fields of ppc_thread_state_t
9289 -# endif
9290 -#elif defined(__ppc64__)
9291 -# define THREAD_STATE ppc_thread_state64_t
9292 -# if defined (HAS_PPC_THREAD_STATE64_R0)
9293 -#  define THREAD_FLD(x) x
9294 -# elif defined (HAS_PPC_THREAD_STATE64___R0)
9295 -#  define THREAD_FLD(x) __ ## x
9296 -# else
9297 -#  error can not work out how to access fields of ppc_thread_state64_t
9298 -# endif
9299 -#elif defined(__i386__)
9300 -# define THREAD_STATE i386_thread_state_t
9301 -# if defined (HAS_I386_THREAD_STATE_EAX)
9302 -#  define THREAD_FLD(x) x
9303 -# elif defined (HAS_I386_THREAD_STATE___EAX)
9304 -#  define THREAD_FLD(x) __ ## x
9305 -# else
9306 -#  error can not work out how to access fields of i386_thread_state_t
9307 -# endif
9308 -#elif defined(__x86_64__)
9309 -# define THREAD_STATE i386_thread_state_t
9310 -# if defined (HAS_I386_THREAD_STATE_EAX)
9311 -#  define THREAD_FLD(x) x
9312 -# elif defined (HAS_I386_THREAD_STATE___EAX)
9313 -#  define THREAD_FLD(x) __ ## x
9314 -# else
9315 -#  error can not work out how to access fields of i386_thread_state_t
9316 -# endif
9317 -#else
9318 -# error unknown architecture
9319 -#endif
9320 -
9321  typedef struct StackFrame {
9322    unsigned long        savedSP;
9323    unsigned long        savedCR;
9324 @@ -115,8 +73,8 @@
9325    GC_thread p;
9326    pthread_t me;
9327    ptr_t lo, hi;
9328 -  THREAD_STATE state;
9329 -  mach_msg_type_number_t thread_state_count = MACHINE_THREAD_STATE_COUNT;
9330 +  GC_THREAD_STATE_T state;
9331 +  mach_msg_type_number_t thread_state_count = GC_MACH_THREAD_STATE_COUNT;
9332    
9333    me = pthread_self();
9334    if (!GC_thr_initialized) GC_thr_init();
9335 @@ -128,11 +86,8 @@
9336         lo = GC_approx_sp();
9337        } else {
9338         /* Get the thread state (registers, etc) */
9339 -       r = thread_get_state(
9340 -                            p->stop_info.mach_thread,
9341 -                            MACHINE_THREAD_STATE,
9342 -                            (natural_t*)&state,
9343 -                            &thread_state_count);
9344 +       r = thread_get_state(p->stop_info.mach_thread, GC_MACH_THREAD_STATE,
9345 +                            (natural_t*)&state, &thread_state_count);
9346         if(r != KERN_SUCCESS) ABORT("thread_get_state failed");
9347  
9348  #if defined(I386)
9349 @@ -144,7 +99,33 @@
9350         GC_push_one(state . THREAD_FLD (edx)); 
9351         GC_push_one(state . THREAD_FLD (edi)); 
9352         GC_push_one(state . THREAD_FLD (esi)); 
9353 -       GC_push_one(state . THREAD_FLD (ebp)); 
9354 +       GC_push_one(state . THREAD_FLD (ebp));
9355 +
9356 +#elif defined(X86_64)
9357 +       lo = (void*)state . THREAD_FLD (rsp);
9358 +
9359 +       GC_push_one(state . THREAD_FLD (rax));
9360 +       GC_push_one(state . THREAD_FLD (rbx));
9361 +       GC_push_one(state . THREAD_FLD (rcx));
9362 +       GC_push_one(state . THREAD_FLD (rdx));
9363 +       GC_push_one(state . THREAD_FLD (rdi));
9364 +       GC_push_one(state . THREAD_FLD (rsi));
9365 +       GC_push_one(state . THREAD_FLD (rbp));
9366 +       GC_push_one(state . THREAD_FLD (rsp));
9367 +       GC_push_one(state . THREAD_FLD (r8));
9368 +       GC_push_one(state . THREAD_FLD (r9));
9369 +       GC_push_one(state . THREAD_FLD (r10));
9370 +       GC_push_one(state . THREAD_FLD (r11));
9371 +       GC_push_one(state . THREAD_FLD (r12));
9372 +       GC_push_one(state . THREAD_FLD (r13));
9373 +       GC_push_one(state . THREAD_FLD (r14));
9374 +       GC_push_one(state . THREAD_FLD (r15));
9375 +       GC_push_one(state . THREAD_FLD (rip));
9376 +       GC_push_one(state . THREAD_FLD (rflags));
9377 +       GC_push_one(state . THREAD_FLD (cs));
9378 +       GC_push_one(state . THREAD_FLD (fs));
9379 +       GC_push_one(state . THREAD_FLD (gs));
9380 +
9381  #elif defined(POWERPC)
9382         lo = (void*)(state . THREAD_FLD (r1) - PPC_RED_ZONE_SIZE);
9383          
9384 @@ -221,9 +202,9 @@
9385         hi = (ptr_t)FindTopOfStack(0);
9386        } else {
9387  #     if defined(__ppc__) || defined(__ppc64__)
9388 -       THREAD_STATE info;
9389 +       GC_THREAD_STATE_T info;
9390         mach_msg_type_number_t outCount = THREAD_STATE_MAX;
9391 -       r = thread_get_state(thread, MACHINE_THREAD_STATE,
9392 +       r = thread_get_state(thread, GC_MACH_THREAD_STATE,
9393                              (natural_t *)&info, &outCount);
9394         if(r != KERN_SUCCESS) ABORT("task_get_state failed");
9395  
9396 @@ -264,10 +245,10 @@
9397  #      else
9398         /* FIXME: Remove after testing: */
9399         WARN("This is completely untested and likely will not work\n", 0);
9400 -       THREAD_STATE info;
9401 +       GC_THREAD_STATE_T info;
9402         mach_msg_type_number_t outCount = THREAD_STATE_MAX;
9403 -       r = thread_get_state(thread, MACHINE_THREAD_STATE,
9404 -                            (natural_t *)&info, &outCount);
9405 +       r = thread_get_state(thread, GC_MACH_THREAD_STATE, (natural_t *)&info,
9406 +                            &outCount);
9407         if(r != KERN_SUCCESS) ABORT("task_get_state failed");
9408  
9409         lo = (void*)info . THREAD_FLD (esp);
9410 Index: boehm-gc/Makefile.in
9411 ===================================================================
9412 --- boehm-gc/Makefile.in        (.../tags/gcc_4_2_0_release)    (wersja 125589)
9413 +++ boehm-gc/Makefile.in        (.../branches/gcc-4_2-branch)   (wersja 125589)
9414 @@ -224,6 +224,7 @@
9415  build_vendor = @build_vendor@
9416  datadir = @datadir@
9417  exec_prefix = @exec_prefix@
9418 +extra_ldflags_libgc = @extra_ldflags_libgc@
9419  host = @host@
9420  host_alias = @host_alias@
9421  host_cpu = @host_cpu@
9422 @@ -280,7 +281,7 @@
9423  # linuxthread semaphore functions get linked:
9424  libgcjgc_la_LIBADD = @addobjs@ $(THREADLIBS) $(UNWINDLIBS)
9425  libgcjgc_la_DEPENDENCIES = @addobjs@
9426 -libgcjgc_la_LDFLAGS = -version-info 1:2:0 -rpath $(toolexeclibdir)
9427 +libgcjgc_la_LDFLAGS = $(extra_ldflags_libgc) -version-info 1:2:0 -rpath $(toolexeclibdir)
9428  libgcjgc_convenience_la_LIBADD = @addobjs@
9429  libgcjgc_convenience_la_DEPENDENCIES = @addobjs@
9430  AM_CXXFLAGS = @GC_CFLAGS@
9431 Index: boehm-gc/configure.ac
9432 ===================================================================
9433 --- boehm-gc/configure.ac       (.../tags/gcc_4_2_0_release)    (wersja 125589)
9434 +++ boehm-gc/configure.ac       (.../branches/gcc-4_2-branch)   (wersja 125589)
9435 @@ -248,33 +248,46 @@
9436  case "$host" in
9437    powerpc*-*-darwin*)
9438      AC_CHECK_MEMBER(ppc_thread_state_t.r0,
9439 -      AC_DEFINE(HAS_PPC_THREAD_STATE_R0,,[ppc_thread_state_t has field r0]),,
9440 +      AC_DEFINE(HAS_PPC_THREAD_STATE_R0,1,
9441 +       [ppc_thread_state_t has field r0]),,
9442        [#include <mach/thread_status.h>])
9443      AC_CHECK_MEMBER(ppc_thread_state_t.__r0,
9444 -      AC_DEFINE(HAS_PPC_THREAD_STATE___R0,,dnl
9445 -        [ppc_thread_state_t has field __r0]),,
9446 +      AC_DEFINE(HAS_PPC_THREAD_STATE___R0,1,dnl
9447 +       [ppc_thread_state_t has field __r0]),,
9448        [#include <mach/thread_status.h>])
9449      AC_CHECK_MEMBER(ppc_thread_state64_t.r0,
9450 -      AC_DEFINE(HAS_PPC_THREAD_STATE64_R0,,dnl
9451 -        [ppc_thread_state64_t has field r0]),,
9452 +      AC_DEFINE(HAS_PPC_THREAD_STATE64_R0,1,dnl
9453 +       [ppc_thread_state64_t has field r0]),,
9454        [#include <mach/thread_status.h>])
9455      AC_CHECK_MEMBER(ppc_thread_state64_t.__r0,
9456 -      AC_DEFINE(HAS_PPC_THREAD_STATE64___R0,,dnl
9457 -        [ppc_thread_state64_t has field __r0]),,
9458 +      AC_DEFINE(HAS_PPC_THREAD_STATE64___R0,1,dnl
9459 +       [ppc_thread_state64_t has field __r0]),,
9460        [#include <mach/thread_status.h>])
9461      ;;
9462    i?86*-*-darwin*)
9463 -    AC_CHECK_MEMBER(i386_thread_state_t.eax,
9464 -      AC_DEFINE(HAS_I386_THREAD_STATE_EAX,,dnl
9465 -        [i386_thread_state_t has field eax]),,
9466 +    AC_CHECK_MEMBER(x86_thread_state32_t.eax,
9467 +      AC_DEFINE(HAS_X86_THREAD_STATE32_EAX,1,dnl
9468 +       [x86_thread_state32_t has field eax]),,
9469        [#include <sys/cdefs.h>
9470 -#include <mach/thread_status.h>])
9471 -    AC_CHECK_MEMBER(i386_thread_state_t.__eax,
9472 -      AC_DEFINE(HAS_I386_THREAD_STATE___EAX,,dnl
9473 -        [i386_thread_state_t has field __eax]),,
9474 +      #include <mach/thread_status.h>])
9475 +    AC_CHECK_MEMBER(x86_thread_state32_t.__eax,
9476 +      AC_DEFINE(HAS_X86_THREAD_STATE32___EAX,1,dnl
9477 +       [x86_thread_state32_t has field __eax]),,
9478        [#include <sys/cdefs.h>
9479 -#include <mach/thread_status.h>])
9480 +      #include <mach/thread_status.h>])
9481      ;;
9482 +  x86_64-*-darwin*)
9483 +    AC_CHECK_MEMBER(x86_thread_state64_t.rax,
9484 +      AC_DEFINE(HAS_X86_THREAD_STATE64_RAX,1,dnl
9485 +       [x86_thread_state64_t has field rax]),,
9486 +      [#include <sys/cdefs.h>
9487 +      #include <mach/thread_status.h>])
9488 +    AC_CHECK_MEMBER(x86_thread_state64_t.__rax,
9489 +      AC_DEFINE(HAS_X86_THREAD_STATE64___RAX,1,dnl
9490 +       [x86_thread_state64_t has field __rax]),,
9491 +      [#include <sys/cdefs.h>
9492 +      #include <mach/thread_status.h>])
9493 +     ;;
9494    *) ;;
9495  esac
9496  
9497 @@ -287,6 +300,14 @@
9498      ;;
9499  esac
9500  
9501 +# extra LD Flags which are required for targets
9502 +case "${host}" in
9503 +  *-*-darwin*)
9504 +    extra_ldflags_libgc=-Wl,-single_module
9505 +    ;;
9506 +esac
9507 +AC_SUBST(extra_ldflags_libgc)
9508 +
9509  AC_SUBST(EXTRA_TEST_LIBS)
9510  
9511  target_all=libgcjgc.la
9512 Index: boehm-gc/include/Makefile.in
9513 ===================================================================
9514 --- boehm-gc/include/Makefile.in        (.../tags/gcc_4_2_0_release)    (wersja 125589)
9515 +++ boehm-gc/include/Makefile.in        (.../branches/gcc-4_2-branch)   (wersja 125589)
9516 @@ -149,6 +149,7 @@
9517  build_vendor = @build_vendor@
9518  datadir = @datadir@
9519  exec_prefix = @exec_prefix@
9520 +extra_ldflags_libgc = @extra_ldflags_libgc@
9521  host = @host@
9522  host_alias = @host_alias@
9523  host_cpu = @host_cpu@
9524 Index: boehm-gc/include/gc_config.h.in
9525 ===================================================================
9526 --- boehm-gc/include/gc_config.h.in     (.../tags/gcc_4_2_0_release)    (wersja 125589)
9527 +++ boehm-gc/include/gc_config.h.in     (.../branches/gcc-4_2-branch)   (wersja 125589)
9528 @@ -54,12 +54,6 @@
9529  /* support for win32 threads */
9530  #undef GC_WIN32_THREADS
9531  
9532 -/* i386_thread_state_t has field eax */
9533 -#undef HAS_I386_THREAD_STATE_EAX
9534 -
9535 -/* i386_thread_state_t has field __eax */
9536 -#undef HAS_I386_THREAD_STATE___EAX
9537 -
9538  /* ppc_thread_state64_t has field r0 */
9539  #undef HAS_PPC_THREAD_STATE64_R0
9540  
9541 @@ -72,6 +66,18 @@
9542  /* ppc_thread_state_t has field __r0 */
9543  #undef HAS_PPC_THREAD_STATE___R0
9544  
9545 +/* x86_thread_state32_t has field eax */
9546 +#undef HAS_X86_THREAD_STATE32_EAX
9547 +
9548 +/* x86_thread_state32_t has field __eax */
9549 +#undef HAS_X86_THREAD_STATE32___EAX
9550 +
9551 +/* x86_thread_state64_t has field rax */
9552 +#undef HAS_X86_THREAD_STATE64_RAX
9553 +
9554 +/* x86_thread_state64_t has field __rax */
9555 +#undef HAS_X86_THREAD_STATE64___RAX
9556 +
9557  /* Define to 1 if you have the <inttypes.h> header file. */
9558  #undef HAVE_INTTYPES_H
9559  
9560 Index: boehm-gc/include/private/gc_priv.h
9561 ===================================================================
9562 --- boehm-gc/include/private/gc_priv.h  (.../tags/gcc_4_2_0_release)    (wersja 125589)
9563 +++ boehm-gc/include/private/gc_priv.h  (.../branches/gcc-4_2-branch)   (wersja 125589)
9564 @@ -286,6 +286,53 @@
9565  #endif
9566  
9567  
9568 +#if defined(DARWIN)
9569 +#      if defined(POWERPC)
9570 +#              if CPP_WORDSZ == 32
9571 +#                define GC_THREAD_STATE_T ppc_thread_state_t
9572 +#                define GC_MACH_THREAD_STATE PPC_THREAD_STATE
9573 +#                define GC_MACH_THREAD_STATE_COUNT PPC_THREAD_STATE_COUNT
9574 +#                define GC_MACH_HEADER mach_header
9575 +#                define GC_MACH_SECTION section
9576 +#              else
9577 +#                define GC_THREAD_STATE_T ppc_thread_state64_t
9578 +#                define GC_MACH_THREAD_STATE PPC_THREAD_STATE64
9579 +#                define GC_MACH_THREAD_STATE_COUNT PPC_THREAD_STATE64_COUNT
9580 +#                define GC_MACH_HEADER mach_header_64
9581 +#                define GC_MACH_SECTION section_64
9582 +#              endif
9583 +#      elif defined(I386) || defined(X86_64)
9584 +#              if CPP_WORDSZ == 32
9585 +#                define GC_THREAD_STATE_T x86_thread_state32_t
9586 +#                define GC_MACH_THREAD_STATE x86_THREAD_STATE32
9587 +#                define GC_MACH_THREAD_STATE_COUNT x86_THREAD_STATE32_COUNT
9588 +#                define GC_MACH_HEADER mach_header
9589 +#                define GC_MACH_SECTION section
9590 +#              else
9591 +#                define GC_THREAD_STATE_T x86_thread_state64_t
9592 +#                define GC_MACH_THREAD_STATE x86_THREAD_STATE64
9593 +#                define GC_MACH_THREAD_STATE_COUNT x86_THREAD_STATE64_COUNT
9594 +#                define GC_MACH_HEADER mach_header_64
9595 +#                define GC_MACH_SECTION section_64
9596 +#              endif
9597 +#      else
9598 +#              error define GC_THREAD_STATE_T
9599 +#              define GC_MACH_THREAD_STATE MACHINE_THREAD_STATE
9600 +#              define GC_MACH_THREAD_STATE_COUNT MACHINE_THREAD_STATE_COUNT
9601 +#      endif
9602 +/* Try to work out the right way to access thread state structure members.
9603 +   The structure has changed its definition in different Darwin versions.
9604 +   This now defaults to the (older) names without __, thus hopefully,
9605 +   not breaking any existing Makefile.direct builds.  */
9606 +#      if defined (HAS_PPC_THREAD_STATE___R0) \
9607 +        || defined (HAS_PPC_THREAD_STATE64___R0) \
9608 +        || defined (HAS_X86_THREAD_STATE32___EAX) \
9609 +        || defined (HAS_X86_THREAD_STATE64___RAX)
9610 +#        define THREAD_FLD(x) __ ## x
9611 +#      else
9612 +#        define THREAD_FLD(x) x
9613 +#      endif
9614 +#endif
9615  /*********************************/
9616  /*                               */
9617  /* OS interface routines        */
9618 @@ -468,6 +515,53 @@
9619  #   define GETENV(name) 0
9620  #endif
9621  
9622 +#if defined(DARWIN)
9623 +#      if defined(POWERPC)
9624 +#              if CPP_WORDSZ == 32
9625 +#                define GC_THREAD_STATE_T ppc_thread_state_t
9626 +#                define GC_MACH_THREAD_STATE PPC_THREAD_STATE
9627 +#                define GC_MACH_THREAD_STATE_COUNT PPC_THREAD_STATE_COUNT
9628 +#                define GC_MACH_HEADER mach_header
9629 +#                define GC_MACH_SECTION section
9630 +#              else
9631 +#                define GC_THREAD_STATE_T ppc_thread_state64_t
9632 +#                define GC_MACH_THREAD_STATE PPC_THREAD_STATE64
9633 +#                define GC_MACH_THREAD_STATE_COUNT PPC_THREAD_STATE64_COUNT
9634 +#                define GC_MACH_HEADER mach_header_64
9635 +#                define GC_MACH_SECTION section_64
9636 +#              endif
9637 +#      elif defined(I386) || defined(X86_64)
9638 +#              if CPP_WORDSZ == 32
9639 +#                define GC_THREAD_STATE_T x86_thread_state32_t
9640 +#                define GC_MACH_THREAD_STATE x86_THREAD_STATE32
9641 +#                define GC_MACH_THREAD_STATE_COUNT x86_THREAD_STATE32_COUNT
9642 +#                define GC_MACH_HEADER mach_header
9643 +#                define GC_MACH_SECTION section
9644 +#              else
9645 +#                define GC_THREAD_STATE_T x86_thread_state64_t
9646 +#                define GC_MACH_THREAD_STATE x86_THREAD_STATE64
9647 +#                define GC_MACH_THREAD_STATE_COUNT x86_THREAD_STATE64_COUNT
9648 +#                define GC_MACH_HEADER mach_header_64
9649 +#                define GC_MACH_SECTION section_64
9650 +#              endif
9651 +#      else
9652 +#              error define GC_THREAD_STATE_T
9653 +#              define GC_MACH_THREAD_STATE MACHINE_THREAD_STATE
9654 +#              define GC_MACH_THREAD_STATE_COUNT MACHINE_THREAD_STATE_COUNT
9655 +#      endif
9656 +/* Try to work out the right way to access thread state structure members.
9657 +   The structure has changed its definition in different Darwin versions.
9658 +   This now defaults to the (older) names without __, thus hopefully,
9659 +   not breaking any existing Makefile.direct builds.  */
9660 +#      if defined (HAS_PPC_THREAD_STATE___R0) \
9661 +        || defined (HAS_PPC_THREAD_STATE64___R0) \
9662 +        || defined (HAS_X86_THREAD_STATE32___EAX) \
9663 +        || defined (HAS_X86_THREAD_STATE64___RAX)
9664 +#        define THREAD_FLD(x) __ ## x
9665 +#      else
9666 +#        define THREAD_FLD(x) x
9667 +#      endif
9668 +#endif
9669  /*********************************/
9670  /*                               */
9671  /* Word-size-dependent defines   */
9672 Index: boehm-gc/include/private/gcconfig.h
9673 ===================================================================
9674 --- boehm-gc/include/private/gcconfig.h (.../tags/gcc_4_2_0_release)    (wersja 125589)
9675 +++ boehm-gc/include/private/gcconfig.h (.../branches/gcc-4_2-branch)   (wersja 125589)
9676 @@ -302,7 +302,10 @@
9677  #   if defined(__ppc__)  || defined(__ppc64__)
9678  #    define POWERPC
9679  #    define mach_type_known
9680 -#   elif defined(__i386__) || defined(__x86_64)
9681 +#   elif defined(__x86_64__)
9682 +#    define X86_64
9683 +#    define mach_type_known
9684 +#   elif defined(__i386__)
9685  #    define I386
9686  #    define mach_type_known
9687  #   endif
9688 @@ -791,26 +794,29 @@
9689  #     define DATAEND (_end)
9690  #   endif
9691  #   ifdef DARWIN
9692 -#     if defined(__ppc64__) || defined(__x86_64)
9693 +#     define OS_TYPE "DARWIN"
9694 +#     define DYNAMIC_LOADING
9695 +#     if defined(__ppc64__)
9696  #       define ALIGNMENT 8
9697  #       define CPP_WORDSZ 64
9698 +#       define STACKBOTTOM ((ptr_t) 0x7fff5fc00000)
9699 +#       define CACHE_LINE_SIZE 64
9700 +#       ifndef HBLKSIZE
9701 +#         define HBLKSIZE 4096
9702 +#       endif
9703  #     else
9704  #       define ALIGNMENT 4
9705 +#       define STACKBOTTOM ((ptr_t) 0xc0000000)
9706  #     endif
9707 -#     define OS_TYPE "DARWIN"
9708 -#     define DYNAMIC_LOADING
9709        /* XXX: see get_end(3), get_etext() and get_end() should not be used.
9710 -         These aren't used when dyld support is enabled (it is by default) */
9711 +        These aren't used when dyld support is enabled (it is by default) */
9712  #     define DATASTART ((ptr_t) get_etext())
9713  #     define DATAEND   ((ptr_t) get_end())
9714 -#     define STACKBOTTOM ((ptr_t) 0xc0000000)
9715  #     define USE_MMAP
9716  #     define USE_MMAP_ANON
9717  #     define USE_ASM_PUSH_REGS
9718 -      /* This is potentially buggy. It needs more testing. See the comments in
9719 -         os_dep.c.  It relies on threads to track writes. */
9720  #     ifdef GC_DARWIN_THREADS
9721 -/* #       define MPROTECT_VDB -- diabled for now.  May work for some apps. */
9722 +#       define MPROTECT_VDB
9723  #     endif
9724  #     include <unistd.h>
9725  #     define GETPAGESIZE() getpagesize()
9726 @@ -822,7 +828,7 @@
9727           __asm__ __volatile__ ("dcbtst 0,%0" : : "r" ((const void *) (x)))
9728  #     endif
9729        /* There seems to be some issues with trylock hanging on darwin. This
9730 -         should be looked into some more */
9731 +        should be looked into some more */
9732  #     define NO_PTHREAD_TRYLOCK
9733  #   endif
9734  #   ifdef FREEBSD
9735 @@ -1317,23 +1323,21 @@
9736  #     define DARWIN_DONT_PARSE_STACK
9737  #     define DYNAMIC_LOADING
9738        /* XXX: see get_end(3), get_etext() and get_end() should not be used.
9739 -        These aren't used when dyld support is enabled (it is by default) */
9740 +        These aren't used when dyld support is enabled (it is by default) */
9741  #     define DATASTART ((ptr_t) get_etext())
9742  #     define DATAEND   ((ptr_t) get_end())
9743  #     define STACKBOTTOM ((ptr_t) 0xc0000000)
9744  #     define USE_MMAP
9745  #     define USE_MMAP_ANON
9746  #     define USE_ASM_PUSH_REGS
9747 -      /* This is potentially buggy. It needs more testing. See the comments in
9748 -        os_dep.c.  It relies on threads to track writes. */
9749  #     ifdef GC_DARWIN_THREADS
9750 -/* #       define MPROTECT_VDB -- disabled for now.  May work for some apps. */
9751 +#       define MPROTECT_VDB
9752  #     endif
9753  #     include <unistd.h>
9754  #     define GETPAGESIZE() getpagesize()
9755        /* There seems to be some issues with trylock hanging on darwin. This
9756 -         should be looked into some more */
9757 -#      define NO_PTHREAD_TRYLOCK
9758 +        should be looked into some more */
9759 +#     define NO_PTHREAD_TRYLOCK
9760  #   endif /* DARWIN */
9761  # endif
9762  
9763 @@ -1986,6 +1990,26 @@
9764  #          define PREFETCH_FOR_WRITE(x) __builtin_prefetch((x), 1)
9765  #      endif
9766  #   endif
9767 +#   ifdef DARWIN
9768 +#     define OS_TYPE "DARWIN"
9769 +#     define DARWIN_DONT_PARSE_STACK
9770 +#     define DYNAMIC_LOADING
9771 +      /* XXX: see get_end(3), get_etext() and get_end() should not be used.
9772 +        These aren't used when dyld support is enabled (it is by default) */
9773 +#     define DATASTART ((ptr_t) get_etext())
9774 +#     define DATAEND   ((ptr_t) get_end())
9775 +#     define STACKBOTTOM ((ptr_t) 0x7fff5fc00000)
9776 +#     define USE_MMAP
9777 +#     define USE_MMAP_ANON
9778 +#     ifdef GC_DARWIN_THREADS
9779 +#       define MPROTECT_VDB
9780 +#     endif
9781 +#     include <unistd.h>
9782 +#     define GETPAGESIZE() getpagesize()
9783 +      /* There seems to be some issues with trylock hanging on darwin. This
9784 +        should be looked into some more */
9785 +#     define NO_PTHREAD_TRYLOCK
9786 +#   endif
9787  #   ifdef FREEBSD
9788  #      define OS_TYPE "FREEBSD"
9789  #      ifndef GC_FREEBSD_THREADS
9790 Index: boehm-gc/ChangeLog
9791 ===================================================================
9792 --- boehm-gc/ChangeLog  (.../tags/gcc_4_2_0_release)    (wersja 125589)
9793 +++ boehm-gc/ChangeLog  (.../branches/gcc-4_2-branch)   (wersja 125589)
9794 @@ -1,3 +1,67 @@
9795 +2007-05-22  Andreas Tobler  <a.tobler@schweiz.org>
9796 +
9797 +       * Backport r124870 from main.
9798 +
9799 +       2007-05-20  Andreas Tobler  <a.tobler@schweiz.org>
9800 +
9801 +       * configure.ac: Introduce extra_ldflags_libgc. Use it for Darwin.
9802 +       * configure: Regenerate.
9803 +       * Makefile.am (libgc_la_LDFLAGS): Use extra_ldflags_libgc.
9804 +       * Makefile.in: Regenerate.
9805 +       * include/Makefile.in: Regenerate.
9806 +       * include/private/gcconfig.h: Enable MPROTECT_VDB for all Darwin
9807 +       targets. Remove comments. Prepare ppc64 support for Darwin.
9808 +
9809 +2007-05-19  Andreas Tobler  <a.tobler@schweiz.org>
9810 +
9811 +       * Backport r120684, 120801, 120853, 120874 and 120977 from main.
9812 +
9813 +       2007-01-19  Andreas Tobler  <a.tobler@schweiz.org>
9814 +
9815 +       * os_dep.c (defined(MPROTECT_VDB) && defined(DARWIN)): Moved recently
9816 +       added defines to include/private/gc_priv.h
9817 +       * darwin_stop_world.c: Removed the above defines.
9818 +       (catch_exception_raise): Added THREAD_FLD in exc_state for POWERPC too.
9819 +       * include/private/gc_priv.h: Moved definitions from darwin_stop_world.c
9820 +       and os_dep.c to here. Fixed THREAD definition fixes for ppc64.
9821 +
9822 +       2007-01-17  Mike Stump  <mrs@apple.com>
9823 +
9824 +       * os_dep.c: Fix i686-apple-darwin9 builds.
9825 +
9826 +       2007-01-17  Andreas Tobler  <a.tobler@schweiz.org>
9827 +
9828 +       * include/gc_config.h.in: Regenerate.
9829 +
9830 +       2007-01-15  Andreas Tobler  <a.tobler@schweiz.org>
9831 +
9832 +       * os_dep.c (defined(MPROTECT_VDB) && defined(DARWIN)): Adjust mail
9833 +       reference.
9834 +       (catch_exception_raise): Fix typo in the I386 exc_state.
9835 +
9836 +       2007-01-11  Andreas Tobler  <a.tobler@schweiz.org>
9837 +
9838 +       * configure.ac: Replaced HAS_I386_THREAD_STATE_* with
9839 +       HAS_X86_THREAD_STATE32_* and HAS_X86_THREAD_STATE64_* respectively.
9840 +       * configure: Regenerated.
9841 +       * include/private/gcconfig.h (DARWIN): Added X86_64 define for Darwin.
9842 +       Added base definitions for the X86_64 Darwin port.
9843 +       * include/private/gc_priv.h: Added definitions for Darwin MACH thread
9844 +       operations. Moved existing THREAD_STATE info from darwin_stop_world.c.
9845 +       * darwin_stop_world.c: Removed THREAD_STATE info. Added
9846 +       HAS_X86_THREAD_STATE64___RAX. And replaced HAS_I386_THREAD_STATE___EAX
9847 +       with HAS_X86_THREAD_STATE32___EAX.
9848 +       (GC_push_all_stacks): Use GC_MACH_THREAD_STATE_COUNT. Add code for
9849 +       X86_64 Darwin.
9850 +       * dyn_load.c (GC_dyld_name_for_hdr): Use GC_MACH_HEADER.
9851 +       (GC_dyld_image_add): Use GC_MACH_HEADER and GC_MACH_SECTION.
9852 +       Distinguish between getsectbynamefromheader_64 and
9853 +       getsectbynamefromheader.
9854 +       (GC_dyld_image_remove): Likewise.
9855 +       * os_dep.c (GC_dirty_init): Use GC_MACH_THREAD_STATE.
9856 +       (catch_exception_raise): Introduce exception information for I386 and
9857 +       X86_64 Darwin. Add X86_64 for exc_state.faultvaddr.
9858 +
9859  2007-05-13  Release Manager
9860  
9861         * GCC 4.2.0 released.
9862 Index: boehm-gc/configure
9863 ===================================================================
9864 --- boehm-gc/configure  (.../tags/gcc_4_2_0_release)    (wersja 125589)
9865 +++ boehm-gc/configure  (.../branches/gcc-4_2-branch)   (wersja 125589)
9866 @@ -309,7 +309,7 @@
9867  # include <unistd.h>
9868  #endif"
9869  
9870 -ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS multi_basedir build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os target_noncanonical mkinstalldirs INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar CC ac_ct_CC EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE CXX ac_ct_CXX CXXDEPMODE am__fastdepCXX_TRUE am__fastdepCXX_FALSE CFLAGS CXXFLAGS CCAS CCASFLAGS AS ac_ct_AS AR ac_ct_AR RANLIB ac_ct_RANLIB MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT GC_CFLAGS LN_S LIBTOOL CXXCPP CPPFLAGS THREADLIBS POWERPC_DARWIN_TRUE POWERPC_DARWIN_FALSE EXTRA_TEST_LIBS target_all CPLUSPLUS_TRUE CPLUSPLUS_FALSE AM_CPPFLAGS addobjs addincludes addlibs addtests CPP EGREP MY_CFLAGS toolexecdir toolexeclibdir LIBOBJS LTLIBOBJS'
9871 +ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS multi_basedir build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os target_noncanonical mkinstalldirs INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar CC ac_ct_CC EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE CXX ac_ct_CXX CXXDEPMODE am__fastdepCXX_TRUE am__fastdepCXX_FALSE CFLAGS CXXFLAGS CCAS CCASFLAGS AS ac_ct_AS AR ac_ct_AR RANLIB ac_ct_RANLIB MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT GC_CFLAGS LN_S LIBTOOL CXXCPP CPPFLAGS THREADLIBS POWERPC_DARWIN_TRUE POWERPC_DARWIN_FALSE extra_ldflags_libgc EXTRA_TEST_LIBS target_all CPLUSPLUS_TRUE CPLUSPLUS_FALSE AM_CPPFLAGS addobjs addincludes addlibs addtests CPP EGREP MY_CFLAGS toolexecdir toolexeclibdir LIBOBJS LTLIBOBJS'
9872  ac_subst_files=''
9873  
9874  # Initialize some variables set by options.
9875 @@ -5741,7 +5741,7 @@
9876  if test $ac_cv_member_ppc_thread_state_t_r0 = yes; then
9877  
9878  cat >>confdefs.h <<\_ACEOF
9879 -#define HAS_PPC_THREAD_STATE_R0
9880 +#define HAS_PPC_THREAD_STATE_R0 1
9881  _ACEOF
9882  
9883  fi
9884 @@ -5852,7 +5852,7 @@
9885  if test $ac_cv_member_ppc_thread_state_t___r0 = yes; then
9886  
9887  cat >>confdefs.h <<\_ACEOF
9888 -#define HAS_PPC_THREAD_STATE___R0
9889 +#define HAS_PPC_THREAD_STATE___R0 1
9890  _ACEOF
9891  
9892  fi
9893 @@ -5963,7 +5963,7 @@
9894  if test $ac_cv_member_ppc_thread_state64_t_r0 = yes; then
9895  
9896  cat >>confdefs.h <<\_ACEOF
9897 -#define HAS_PPC_THREAD_STATE64_R0
9898 +#define HAS_PPC_THREAD_STATE64_R0 1
9899  _ACEOF
9900  
9901  fi
9902 @@ -6074,16 +6074,16 @@
9903  if test $ac_cv_member_ppc_thread_state64_t___r0 = yes; then
9904  
9905  cat >>confdefs.h <<\_ACEOF
9906 -#define HAS_PPC_THREAD_STATE64___R0
9907 +#define HAS_PPC_THREAD_STATE64___R0 1
9908  _ACEOF
9909  
9910  fi
9911  
9912      ;;
9913    i?86*-*-darwin*)
9914 -    echo "$as_me:$LINENO: checking for i386_thread_state_t.eax" >&5
9915 -echo $ECHO_N "checking for i386_thread_state_t.eax... $ECHO_C" >&6
9916 -if test "${ac_cv_member_i386_thread_state_t_eax+set}" = set; then
9917 +    echo "$as_me:$LINENO: checking for x86_thread_state32_t.eax" >&5
9918 +echo $ECHO_N "checking for x86_thread_state32_t.eax... $ECHO_C" >&6
9919 +if test "${ac_cv_member_x86_thread_state32_t_eax+set}" = set; then
9920    echo $ECHO_N "(cached) $ECHO_C" >&6
9921  else
9922    cat >conftest.$ac_ext <<_ACEOF
9923 @@ -6093,12 +6093,12 @@
9924  cat >>conftest.$ac_ext <<_ACEOF
9925  /* end confdefs.h.  */
9926  #include <sys/cdefs.h>
9927 -#include <mach/thread_status.h>
9928 +      #include <mach/thread_status.h>
9929  
9930  int
9931  main ()
9932  {
9933 -static i386_thread_state_t ac_aggr;
9934 +static x86_thread_state32_t ac_aggr;
9935  if (ac_aggr.eax)
9936  return 0;
9937    ;
9938 @@ -6127,7 +6127,7 @@
9939    ac_status=$?
9940    echo "$as_me:$LINENO: \$? = $ac_status" >&5
9941    (exit $ac_status); }; }; then
9942 -  ac_cv_member_i386_thread_state_t_eax=yes
9943 +  ac_cv_member_x86_thread_state32_t_eax=yes
9944  else
9945    echo "$as_me: failed program was:" >&5
9946  sed 's/^/| /' conftest.$ac_ext >&5
9947 @@ -6139,12 +6139,12 @@
9948  cat >>conftest.$ac_ext <<_ACEOF
9949  /* end confdefs.h.  */
9950  #include <sys/cdefs.h>
9951 -#include <mach/thread_status.h>
9952 +      #include <mach/thread_status.h>
9953  
9954  int
9955  main ()
9956  {
9957 -static i386_thread_state_t ac_aggr;
9958 +static x86_thread_state32_t ac_aggr;
9959  if (sizeof ac_aggr.eax)
9960  return 0;
9961    ;
9962 @@ -6173,30 +6173,30 @@
9963    ac_status=$?
9964    echo "$as_me:$LINENO: \$? = $ac_status" >&5
9965    (exit $ac_status); }; }; then
9966 -  ac_cv_member_i386_thread_state_t_eax=yes
9967 +  ac_cv_member_x86_thread_state32_t_eax=yes
9968  else
9969    echo "$as_me: failed program was:" >&5
9970  sed 's/^/| /' conftest.$ac_ext >&5
9971  
9972 -ac_cv_member_i386_thread_state_t_eax=no
9973 +ac_cv_member_x86_thread_state32_t_eax=no
9974  fi
9975  rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
9976  fi
9977  rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
9978  fi
9979 -echo "$as_me:$LINENO: result: $ac_cv_member_i386_thread_state_t_eax" >&5
9980 -echo "${ECHO_T}$ac_cv_member_i386_thread_state_t_eax" >&6
9981 -if test $ac_cv_member_i386_thread_state_t_eax = yes; then
9982 +echo "$as_me:$LINENO: result: $ac_cv_member_x86_thread_state32_t_eax" >&5
9983 +echo "${ECHO_T}$ac_cv_member_x86_thread_state32_t_eax" >&6
9984 +if test $ac_cv_member_x86_thread_state32_t_eax = yes; then
9985  
9986  cat >>confdefs.h <<\_ACEOF
9987 -#define HAS_I386_THREAD_STATE_EAX
9988 +#define HAS_X86_THREAD_STATE32_EAX 1
9989  _ACEOF
9990  
9991  fi
9992  
9993 -    echo "$as_me:$LINENO: checking for i386_thread_state_t.__eax" >&5
9994 -echo $ECHO_N "checking for i386_thread_state_t.__eax... $ECHO_C" >&6
9995 -if test "${ac_cv_member_i386_thread_state_t___eax+set}" = set; then
9996 +    echo "$as_me:$LINENO: checking for x86_thread_state32_t.__eax" >&5
9997 +echo $ECHO_N "checking for x86_thread_state32_t.__eax... $ECHO_C" >&6
9998 +if test "${ac_cv_member_x86_thread_state32_t___eax+set}" = set; then
9999    echo $ECHO_N "(cached) $ECHO_C" >&6
10000  else
10001    cat >conftest.$ac_ext <<_ACEOF
10002 @@ -6206,12 +6206,12 @@
10003  cat >>conftest.$ac_ext <<_ACEOF
10004  /* end confdefs.h.  */
10005  #include <sys/cdefs.h>
10006 -#include <mach/thread_status.h>
10007 +      #include <mach/thread_status.h>
10008  
10009  int
10010  main ()
10011  {
10012 -static i386_thread_state_t ac_aggr;
10013 +static x86_thread_state32_t ac_aggr;
10014  if (ac_aggr.__eax)
10015  return 0;
10016    ;
10017 @@ -6240,7 +6240,7 @@
10018    ac_status=$?
10019    echo "$as_me:$LINENO: \$? = $ac_status" >&5
10020    (exit $ac_status); }; }; then
10021 -  ac_cv_member_i386_thread_state_t___eax=yes
10022 +  ac_cv_member_x86_thread_state32_t___eax=yes
10023  else
10024    echo "$as_me: failed program was:" >&5
10025  sed 's/^/| /' conftest.$ac_ext >&5
10026 @@ -6252,12 +6252,12 @@
10027  cat >>conftest.$ac_ext <<_ACEOF
10028  /* end confdefs.h.  */
10029  #include <sys/cdefs.h>
10030 -#include <mach/thread_status.h>
10031 +      #include <mach/thread_status.h>
10032  
10033  int
10034  main ()
10035  {
10036 -static i386_thread_state_t ac_aggr;
10037 +static x86_thread_state32_t ac_aggr;
10038  if (sizeof ac_aggr.__eax)
10039  return 0;
10040    ;
10041 @@ -6286,28 +6286,256 @@
10042    ac_status=$?
10043    echo "$as_me:$LINENO: \$? = $ac_status" >&5
10044    (exit $ac_status); }; }; then
10045 -  ac_cv_member_i386_thread_state_t___eax=yes
10046 +  ac_cv_member_x86_thread_state32_t___eax=yes
10047  else
10048    echo "$as_me: failed program was:" >&5
10049  sed 's/^/| /' conftest.$ac_ext >&5
10050  
10051 -ac_cv_member_i386_thread_state_t___eax=no
10052 +ac_cv_member_x86_thread_state32_t___eax=no
10053  fi
10054  rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
10055  fi
10056  rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
10057  fi
10058 -echo "$as_me:$LINENO: result: $ac_cv_member_i386_thread_state_t___eax" >&5
10059 -echo "${ECHO_T}$ac_cv_member_i386_thread_state_t___eax" >&6
10060 -if test $ac_cv_member_i386_thread_state_t___eax = yes; then
10061 +echo "$as_me:$LINENO: result: $ac_cv_member_x86_thread_state32_t___eax" >&5
10062 +echo "${ECHO_T}$ac_cv_member_x86_thread_state32_t___eax" >&6
10063 +if test $ac_cv_member_x86_thread_state32_t___eax = yes; then
10064  
10065  cat >>confdefs.h <<\_ACEOF
10066 -#define HAS_I386_THREAD_STATE___EAX
10067 +#define HAS_X86_THREAD_STATE32___EAX 1
10068  _ACEOF
10069  
10070  fi
10071  
10072      ;;
10073 +  x86_64-*-darwin*)
10074 +    echo "$as_me:$LINENO: checking for x86_thread_state64_t.rax" >&5
10075 +echo $ECHO_N "checking for x86_thread_state64_t.rax... $ECHO_C" >&6
10076 +if test "${ac_cv_member_x86_thread_state64_t_rax+set}" = set; then
10077 +  echo $ECHO_N "(cached) $ECHO_C" >&6
10078 +else
10079 +  cat >conftest.$ac_ext <<_ACEOF
10080 +/* confdefs.h.  */
10081 +_ACEOF
10082 +cat confdefs.h >>conftest.$ac_ext
10083 +cat >>conftest.$ac_ext <<_ACEOF
10084 +/* end confdefs.h.  */
10085 +#include <sys/cdefs.h>
10086 +      #include <mach/thread_status.h>
10087 +
10088 +int
10089 +main ()
10090 +{
10091 +static x86_thread_state64_t ac_aggr;
10092 +if (ac_aggr.rax)
10093 +return 0;
10094 +  ;
10095 +  return 0;
10096 +}
10097 +_ACEOF
10098 +rm -f conftest.$ac_objext
10099 +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
10100 +  (eval $ac_compile) 2>conftest.er1
10101 +  ac_status=$?
10102 +  grep -v '^ *+' conftest.er1 >conftest.err
10103 +  rm -f conftest.er1
10104 +  cat conftest.err >&5
10105 +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
10106 +  (exit $ac_status); } &&
10107 +        { ac_try='test -z "$ac_c_werror_flag"
10108 +                        || test ! -s conftest.err'
10109 +  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
10110 +  (eval $ac_try) 2>&5
10111 +  ac_status=$?
10112 +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
10113 +  (exit $ac_status); }; } &&
10114 +        { ac_try='test -s conftest.$ac_objext'
10115 +  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
10116 +  (eval $ac_try) 2>&5
10117 +  ac_status=$?
10118 +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
10119 +  (exit $ac_status); }; }; then
10120 +  ac_cv_member_x86_thread_state64_t_rax=yes
10121 +else
10122 +  echo "$as_me: failed program was:" >&5
10123 +sed 's/^/| /' conftest.$ac_ext >&5
10124 +
10125 +cat >conftest.$ac_ext <<_ACEOF
10126 +/* confdefs.h.  */
10127 +_ACEOF
10128 +cat confdefs.h >>conftest.$ac_ext
10129 +cat >>conftest.$ac_ext <<_ACEOF
10130 +/* end confdefs.h.  */
10131 +#include <sys/cdefs.h>
10132 +      #include <mach/thread_status.h>
10133 +
10134 +int
10135 +main ()
10136 +{
10137 +static x86_thread_state64_t ac_aggr;
10138 +if (sizeof ac_aggr.rax)
10139 +return 0;
10140 +  ;
10141 +  return 0;
10142 +}
10143 +_ACEOF
10144 +rm -f conftest.$ac_objext
10145 +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
10146 +  (eval $ac_compile) 2>conftest.er1
10147 +  ac_status=$?
10148 +  grep -v '^ *+' conftest.er1 >conftest.err
10149 +  rm -f conftest.er1
10150 +  cat conftest.err >&5
10151 +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
10152 +  (exit $ac_status); } &&
10153 +        { ac_try='test -z "$ac_c_werror_flag"
10154 +                        || test ! -s conftest.err'
10155 +  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
10156 +  (eval $ac_try) 2>&5
10157 +  ac_status=$?
10158 +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
10159 +  (exit $ac_status); }; } &&
10160 +        { ac_try='test -s conftest.$ac_objext'
10161 +  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
10162 +  (eval $ac_try) 2>&5
10163 +  ac_status=$?
10164 +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
10165 +  (exit $ac_status); }; }; then
10166 +  ac_cv_member_x86_thread_state64_t_rax=yes
10167 +else
10168 +  echo "$as_me: failed program was:" >&5
10169 +sed 's/^/| /' conftest.$ac_ext >&5
10170 +
10171 +ac_cv_member_x86_thread_state64_t_rax=no
10172 +fi
10173 +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
10174 +fi
10175 +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
10176 +fi
10177 +echo "$as_me:$LINENO: result: $ac_cv_member_x86_thread_state64_t_rax" >&5
10178 +echo "${ECHO_T}$ac_cv_member_x86_thread_state64_t_rax" >&6
10179 +if test $ac_cv_member_x86_thread_state64_t_rax = yes; then
10180 +
10181 +cat >>confdefs.h <<\_ACEOF
10182 +#define HAS_X86_THREAD_STATE64_RAX 1
10183 +_ACEOF
10184 +
10185 +fi
10186 +
10187 +    echo "$as_me:$LINENO: checking for x86_thread_state64_t.__rax" >&5
10188 +echo $ECHO_N "checking for x86_thread_state64_t.__rax... $ECHO_C" >&6
10189 +if test "${ac_cv_member_x86_thread_state64_t___rax+set}" = set; then
10190 +  echo $ECHO_N "(cached) $ECHO_C" >&6
10191 +else
10192 +  cat >conftest.$ac_ext <<_ACEOF
10193 +/* confdefs.h.  */
10194 +_ACEOF
10195 +cat confdefs.h >>conftest.$ac_ext
10196 +cat >>conftest.$ac_ext <<_ACEOF
10197 +/* end confdefs.h.  */
10198 +#include <sys/cdefs.h>
10199 +      #include <mach/thread_status.h>
10200 +
10201 +int
10202 +main ()
10203 +{
10204 +static x86_thread_state64_t ac_aggr;
10205 +if (ac_aggr.__rax)
10206 +return 0;
10207 +  ;
10208 +  return 0;
10209 +}
10210 +_ACEOF
10211 +rm -f conftest.$ac_objext
10212 +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
10213 +  (eval $ac_compile) 2>conftest.er1
10214 +  ac_status=$?
10215 +  grep -v '^ *+' conftest.er1 >conftest.err
10216 +  rm -f conftest.er1
10217 +  cat conftest.err >&5
10218 +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
10219 +  (exit $ac_status); } &&
10220 +        { ac_try='test -z "$ac_c_werror_flag"
10221 +                        || test ! -s conftest.err'
10222 +  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
10223 +  (eval $ac_try) 2>&5
10224 +  ac_status=$?
10225 +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
10226 +  (exit $ac_status); }; } &&
10227 +        { ac_try='test -s conftest.$ac_objext'
10228 +  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
10229 +  (eval $ac_try) 2>&5
10230 +  ac_status=$?
10231 +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
10232 +  (exit $ac_status); }; }; then
10233 +  ac_cv_member_x86_thread_state64_t___rax=yes
10234 +else
10235 +  echo "$as_me: failed program was:" >&5
10236 +sed 's/^/| /' conftest.$ac_ext >&5
10237 +
10238 +cat >conftest.$ac_ext <<_ACEOF
10239 +/* confdefs.h.  */
10240 +_ACEOF
10241 +cat confdefs.h >>conftest.$ac_ext
10242 +cat >>conftest.$ac_ext <<_ACEOF
10243 +/* end confdefs.h.  */
10244 +#include <sys/cdefs.h>
10245 +      #include <mach/thread_status.h>
10246 +
10247 +int
10248 +main ()
10249 +{
10250 +static x86_thread_state64_t ac_aggr;
10251 +if (sizeof ac_aggr.__rax)
10252 +return 0;
10253 +  ;
10254 +  return 0;
10255 +}
10256 +_ACEOF
10257 +rm -f conftest.$ac_objext
10258 +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
10259 +  (eval $ac_compile) 2>conftest.er1
10260 +  ac_status=$?
10261 +  grep -v '^ *+' conftest.er1 >conftest.err
10262 +  rm -f conftest.er1
10263 +  cat conftest.err >&5
10264 +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
10265 +  (exit $ac_status); } &&
10266 +        { ac_try='test -z "$ac_c_werror_flag"
10267 +                        || test ! -s conftest.err'
10268 +  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
10269 +  (eval $ac_try) 2>&5
10270 +  ac_status=$?
10271 +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
10272 +  (exit $ac_status); }; } &&
10273 +        { ac_try='test -s conftest.$ac_objext'
10274 +  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
10275 +  (eval $ac_try) 2>&5
10276 +  ac_status=$?
10277 +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
10278 +  (exit $ac_status); }; }; then
10279 +  ac_cv_member_x86_thread_state64_t___rax=yes
10280 +else
10281 +  echo "$as_me: failed program was:" >&5
10282 +sed 's/^/| /' conftest.$ac_ext >&5
10283 +
10284 +ac_cv_member_x86_thread_state64_t___rax=no
10285 +fi
10286 +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
10287 +fi
10288 +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
10289 +fi
10290 +echo "$as_me:$LINENO: result: $ac_cv_member_x86_thread_state64_t___rax" >&5
10291 +echo "${ECHO_T}$ac_cv_member_x86_thread_state64_t___rax" >&6
10292 +if test $ac_cv_member_x86_thread_state64_t___rax = yes; then
10293 +
10294 +cat >>confdefs.h <<\_ACEOF
10295 +#define HAS_X86_THREAD_STATE64___RAX 1
10296 +_ACEOF
10297 +
10298 +fi
10299 +
10300 +     ;;
10301    *) ;;
10302  esac
10303  
10304 @@ -6392,8 +6620,16 @@
10305      ;;
10306  esac
10307  
10308 +# extra LD Flags which are required for targets
10309 +case "${host}" in
10310 +  *-*-darwin*)
10311 +    extra_ldflags_libgc=-Wl,-single_module
10312 +    ;;
10313 +esac
10314  
10315  
10316 +
10317 +
10318  target_all=libgcjgc.la
10319  
10320  
10321 @@ -8246,6 +8482,7 @@
10322  s,@THREADLIBS@,$THREADLIBS,;t t
10323  s,@POWERPC_DARWIN_TRUE@,$POWERPC_DARWIN_TRUE,;t t
10324  s,@POWERPC_DARWIN_FALSE@,$POWERPC_DARWIN_FALSE,;t t
10325 +s,@extra_ldflags_libgc@,$extra_ldflags_libgc,;t t
10326  s,@EXTRA_TEST_LIBS@,$EXTRA_TEST_LIBS,;t t
10327  s,@target_all@,$target_all,;t t
10328  s,@CPLUSPLUS_TRUE@,$CPLUSPLUS_TRUE,;t t
10329 Index: boehm-gc/os_dep.c
10330 ===================================================================
10331 --- boehm-gc/os_dep.c   (.../tags/gcc_4_2_0_release)    (wersja 125589)
10332 +++ boehm-gc/os_dep.c   (.../branches/gcc-4_2-branch)   (wersja 125589)
10333 @@ -3371,7 +3371,7 @@
10334        1. Apple's mach/xnu documentation
10335        2. Timothy J. Wood's "Mach Exception Handlers 101" post to the
10336           omnigroup's macosx-dev list. 
10337 -         www.omnigroup.com/mailman/archive/macosx-dev/2000-June/002030.html
10338 +         www.omnigroup.com/mailman/archive/macosx-dev/2000-June/014178.html
10339        3. macosx-nat.c from Apple's GDB source code.
10340  */
10341     
10342 @@ -3683,7 +3683,7 @@
10343          mask,
10344          GC_ports.exception,
10345          EXCEPTION_DEFAULT,
10346 -        MACHINE_THREAD_STATE
10347 +        GC_MACH_THREAD_STATE
10348      );
10349      if(r != KERN_SUCCESS) ABORT("task_set_exception_ports failed");
10350  
10351 @@ -3802,10 +3802,16 @@
10352          mach_msg_type_number_t exc_state_count = PPC_EXCEPTION_STATE64_COUNT;
10353          ppc_exception_state64_t exc_state;
10354  #     endif
10355 -#   elif defined(I386)
10356 -        thread_state_flavor_t flavor = i386_EXCEPTION_STATE;
10357 -        mach_msg_type_number_t exc_state_count = i386_EXCEPTION_STATE_COUNT;
10358 -        i386_exception_state_t exc_state;
10359 +#   elif defined(I386) || defined(X86_64)
10360 +#     if CPP_WORDSZ == 32
10361 +       thread_state_flavor_t flavor = x86_EXCEPTION_STATE32;
10362 +       mach_msg_type_number_t exc_state_count = x86_EXCEPTION_STATE32_COUNT;
10363 +       x86_exception_state32_t exc_state;
10364 +#     else
10365 +       thread_state_flavor_t flavor = x86_EXCEPTION_STATE64;
10366 +       mach_msg_type_number_t exc_state_count = x86_EXCEPTION_STATE64_COUNT;
10367 +       x86_exception_state64_t exc_state;
10368 +#     endif
10369  #   else
10370  #      error FIXME for non-ppc darwin
10371  #   endif
10372 @@ -3838,9 +3844,9 @@
10373      
10374      /* This is the address that caused the fault */
10375  #if defined(POWERPC)
10376 -    addr = (char*) exc_state.dar;
10377 -#elif defined (I386)
10378 -    addr = (char*) exc_state.faultvaddr;
10379 +    addr = (char*) exc_state. THREAD_FLD(dar);
10380 +#elif defined (I386) || defined (X86_64)
10381 +    addr = (char*) exc_state. THREAD_FLD(faultvaddr);
10382  #else
10383  #   error FIXME for non POWERPC/I386
10384  #endif
10385 Index: boehm-gc/Makefile.am
10386 ===================================================================
10387 --- boehm-gc/Makefile.am        (.../tags/gcc_4_2_0_release)    (wersja 125589)
10388 +++ boehm-gc/Makefile.am        (.../branches/gcc-4_2-branch)   (wersja 125589)
10389 @@ -33,11 +33,13 @@
10390  rs6000_mach_dep.s sparc_mach_dep.S sparc_netbsd_mach_dep.s \
10391  sparc_sunos4_mach_dep.s ia64_save_regs_in_stack.s
10392  
10393 +extra_ldflags_libgc = @extra_ldflags_libgc@
10394 +
10395  # Include THREADLIBS here to ensure that the correct versions of
10396  # linuxthread semaphore functions get linked:
10397  libgcjgc_la_LIBADD = @addobjs@ $(THREADLIBS) $(UNWINDLIBS)
10398  libgcjgc_la_DEPENDENCIES = @addobjs@
10399 -libgcjgc_la_LDFLAGS = -version-info 1:2:0 -rpath $(toolexeclibdir)
10400 +libgcjgc_la_LDFLAGS = $(extra_ldflags_libgc) -version-info 1:2:0 -rpath $(toolexeclibdir)
10401  
10402  libgcjgc_convenience_la_LIBADD = @addobjs@
10403  libgcjgc_convenience_la_DEPENDENCIES = @addobjs@
10404 Index: boehm-gc/dyn_load.c
10405 ===================================================================
10406 --- boehm-gc/dyn_load.c (.../tags/gcc_4_2_0_release)    (wersja 125589)
10407 +++ boehm-gc/dyn_load.c (.../branches/gcc-4_2-branch)   (wersja 125589)
10408 @@ -1152,7 +1152,7 @@
10409  };
10410      
10411  #ifdef DARWIN_DEBUG
10412 -static const char *GC_dyld_name_for_hdr(struct mach_header *hdr) {
10413 +static const char *GC_dyld_name_for_hdr(const struct GC_MACH_HEADER *hdr) {
10414      unsigned long i,c;
10415      c = _dyld_image_count();
10416      for(i=0;i<c;i++) if(_dyld_get_image_header(i) == hdr)
10417 @@ -1162,12 +1162,17 @@
10418  #endif
10419          
10420  /* This should never be called by a thread holding the lock */
10421 -static void GC_dyld_image_add(struct mach_header* hdr, unsigned long slide) {
10422 +static void GC_dyld_image_add(const struct GC_MACH_HEADER *hdr, intptr_t slide)
10423 +{
10424      unsigned long start,end,i;
10425 -    const struct section *sec;
10426 +    const struct GC_MACH_SECTION *sec;
10427      if (GC_no_dls) return;
10428      for(i=0;i<sizeof(GC_dyld_sections)/sizeof(GC_dyld_sections[0]);i++) {
10429 -        sec = getsectbynamefromheader(
10430 +#   if defined (__LP64__)
10431 +      sec = getsectbynamefromheader_64(
10432 +#   else
10433 +      sec = getsectbynamefromheader(
10434 +#   endif
10435              hdr,GC_dyld_sections[i].seg,GC_dyld_sections[i].sect);
10436          if(sec == NULL || sec->size == 0) continue;
10437          start = slide + sec->addr;
10438 @@ -1184,11 +1189,16 @@
10439  }
10440  
10441  /* This should never be called by a thread holding the lock */
10442 -static void GC_dyld_image_remove(struct mach_header* hdr, unsigned long slide) {
10443 +static void GC_dyld_image_remove(const struct GC_MACH_HEADER *hdr,
10444 +                                intptr_t slide) {
10445      unsigned long start,end,i;
10446 -    const struct section *sec;
10447 +    const struct GC_MACH_SECTION *sec;
10448      for(i=0;i<sizeof(GC_dyld_sections)/sizeof(GC_dyld_sections[0]);i++) {
10449 -        sec = getsectbynamefromheader(
10450 +#   if defined (__LP64__)
10451 +      sec = getsectbynamefromheader_64(
10452 +#   else
10453 +      sec = getsectbynamefromheader(
10454 +#   endif
10455              hdr,GC_dyld_sections[i].seg,GC_dyld_sections[i].sect);
10456          if(sec == NULL || sec->size == 0) continue;
10457          start = slide + sec->addr;
10458 Index: configure.in
10459 ===================================================================
10460 --- configure.in        (.../tags/gcc_4_2_0_release)    (wersja 125589)
10461 +++ configure.in        (.../branches/gcc-4_2-branch)   (wersja 125589)
10462 @@ -2419,7 +2419,13 @@
10463    # Pass -fkeep-inline-functions for stage 1 if the GCC version supports it.
10464    CFLAGS="$CFLAGS -fkeep-inline-functions"
10465    AC_MSG_CHECKING([whether -fkeep-inline-functions is supported])
10466 -  AC_TRY_COMPILE(,,
10467 +  AC_TRY_COMPILE([
10468 +#if (__GNUC__ < 3) \
10469 +    || (__GNUC__ == 3 && (__GNUC_MINOR__ < 3 \
10470 +                         || (__GNUC_MINOR__ == 3 && __GNUC_PATCHLEVEL__ < 1)))
10471 +#error http://gcc.gnu.org/PR29382
10472 +#endif
10473 +    ],,
10474      [AC_MSG_RESULT([yes]); stage1_cflags="$stage1_cflags -fkeep-inline-functions"],
10475      [AC_MSG_RESULT([no])])
10476  
10477 Index: ChangeLog
10478 ===================================================================
10479 --- ChangeLog   (.../tags/gcc_4_2_0_release)    (wersja 125589)
10480 +++ ChangeLog   (.../branches/gcc-4_2-branch)   (wersja 125589)
10481 @@ -1,3 +1,9 @@
10482 +2007-05-30  Jakub Jelinek  <jakub@redhat.com>
10483 +
10484 +       PR bootstrap/29382
10485 +       * configure.in: Don't use -fkeep-inline-functions for GCC < 3.3.1.
10486 +       * configure: Rebuilt.
10487 +
10488  2007-05-13  Release Manager
10489  
10490         * GCC 4.2.0 released.
10491 Index: libjava/java/lang/natClassLoader.cc
10492 ===================================================================
10493 --- libjava/java/lang/natClassLoader.cc (.../tags/gcc_4_2_0_release)    (wersja 125589)
10494 +++ libjava/java/lang/natClassLoader.cc (.../branches/gcc-4_2-branch)   (wersja 125589)
10495 @@ -235,6 +235,15 @@
10496  
10497    new_class->engine = &_Jv_soleIndirectCompiledEngine;
10498  
10499 +  /* FIXME:  Way back before the dawn of time, we overloaded the
10500 +     SYNTHETIC class access modifier to mean INTERPRETED.  This was a
10501 +     Bad Thing, but it didn't matter then because classes were never
10502 +     marked synthetic.  However, it is possible to redeem the
10503 +     situation: _Jv_NewClassFromInitializer is only called from
10504 +     compiled classes, so we clear the INTERPRETED flag.  This is a
10505 +     kludge!  */
10506 +  new_class->accflags &= ~java::lang::reflect::Modifier::INTERPRETED;
10507 +
10508    if (_Jv_CheckABIVersion ((unsigned long) new_class->next_or_version))
10509      (*_Jv_RegisterClassHook) (new_class);
10510    
10511 Index: libjava/ChangeLog
10512 ===================================================================
10513 --- libjava/ChangeLog   (.../tags/gcc_4_2_0_release)    (wersja 125589)
10514 +++ libjava/ChangeLog   (.../branches/gcc-4_2-branch)   (wersja 125589)
10515 @@ -1,3 +1,8 @@
10516 +2007-05-31  Andrew Haley  <aph@redhat.com>
10517 +
10518 +       * java/lang/natClassLoader.cc (_Jv_NewClassFromInitializer): Clear
10519 +       INTERPRETED access modifier.
10520 +
10521  2007-05-13  Release Manager
10522  
10523         * GCC 4.2.0 released.
10524 Index: maintainer-scripts/ChangeLog
10525 ===================================================================
10526 --- maintainer-scripts/ChangeLog        (.../tags/gcc_4_2_0_release)    (wersja 125589)
10527 +++ maintainer-scripts/ChangeLog        (.../branches/gcc-4_2-branch)   (wersja 125589)
10528 @@ -1,3 +1,7 @@
10529 +2007-05-28  Mark Mitchell  <mark@codesourcery.com>
10530 +
10531 +       * gcc_release: Adjust placement of release candidates.
10532 +
10533  2007-05-13  Release Manager
10534  
10535         * GCC 4.2.0 released.
10536 Index: maintainer-scripts/gcc_release
10537 ===================================================================
10538 --- maintainer-scripts/gcc_release      (.../tags/gcc_4_2_0_release)    (wersja 125589)
10539 +++ maintainer-scripts/gcc_release      (.../branches/gcc-4_2-branch)   (wersja 125589)
10540 @@ -699,10 +699,10 @@
10541    # and minor release numbers.
10542    SVNBRANCH="branches/gcc-${RELEASE_MAJOR}_${RELEASE_MINOR}-branch"
10543  
10544 -  # If this is not a final release, set various parameters acordingly.
10545 +  # If this is not a final release, set various parameters accordingly.
10546    if [ ${FINAL} -ne 1 ]; then
10547 -    RELEASE="${RELEASE}-${DATE}"
10548 -    FTP_PATH="${FTP_PATH}/prerelease-${RELEASE}/"
10549 +    RELEASE="${RELEASE}-RC-${DATE}"
10550 +    FTP_PATH="${SNAPSHOTS_DIR}/${RELEASE}"
10551    else
10552      FTP_PATH="${FTP_PATH}/releases/gcc-${RELEASE}/"
10553    fi
This page took 1.203619 seconds and 3 git commands to generate.