2 ===================================================================
3 --- configure (.../tags/gcc_4_2_0_release) (revision 125292)
4 +++ configure (.../branches/gcc-4_2-branch) (revision 125292)
10 + || (__GNUC__ == 3 && (__GNUC_MINOR__ < 3 \
11 + || (__GNUC_MINOR__ == 3 && __GNUC_PATCHLEVEL__ < 1)))
12 +#error http://gcc.gnu.org/PR29382
19 ===================================================================
20 --- gcc/tree-vrp.c (.../tags/gcc_4_2_0_release) (revision 125292)
21 +++ gcc/tree-vrp.c (.../branches/gcc-4_2-branch) (revision 125292)
23 || operand_equal_p (val, TYPE_MIN_VALUE (TREE_TYPE (val)), 0)));
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. */
31 +avoid_overflow_infinity (tree val)
33 + if (!is_overflow_infinity (val))
36 + if (operand_equal_p (val, TYPE_MAX_VALUE (TREE_TYPE (val)), 0))
37 + return TYPE_MAX_VALUE (TREE_TYPE (val));
40 +#ifdef ENABLE_CHECKING
41 + gcc_assert (operand_equal_p (val, TYPE_MIN_VALUE (TREE_TYPE (val)), 0));
43 + return TYPE_MIN_VALUE (TREE_TYPE (val));
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
52 infinity when we shouldn't. */
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)
58 gcc_assert (is_gimple_min_invariant (val));
59 - if (is_overflow_infinity (val))
61 - if (operand_equal_p (val, TYPE_MAX_VALUE (TREE_TYPE (val)), 0))
62 - val = TYPE_MAX_VALUE (TREE_TYPE (val));
65 -#ifdef ENABLE_CHECKING
66 - gcc_assert (operand_equal_p (val,
67 - TYPE_MIN_VALUE (TREE_TYPE (val)), 0));
69 - val = TYPE_MIN_VALUE (TREE_TYPE (val));
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);
77 /* Set value range VR to a non-negative range of type TYPE.
80 set_value_range_to_null (value_range_t *vr, tree type)
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);
89 cond_code = swap_tree_comparison (TREE_CODE (cond));
92 + limit = avoid_overflow_infinity (limit);
94 type = TREE_TYPE (limit);
95 gcc_assert (limit != var);
98 if (TREE_CODE (op0) == SSA_NAME)
99 vr0 = *(get_value_range (op0));
100 else if (is_gimple_min_invariant (op0))
101 - set_value_range_to_value (&vr0, op0);
102 + set_value_range_to_value (&vr0, op0, NULL);
104 set_value_range_to_varying (&vr0);
106 @@ -1627,7 +1637,7 @@
107 if (TREE_CODE (op1) == SSA_NAME)
108 vr1 = *(get_value_range (op1));
109 else if (is_gimple_min_invariant (op1))
110 - set_value_range_to_value (&vr1, op1);
111 + set_value_range_to_value (&vr1, op1, NULL);
113 set_value_range_to_varying (&vr1);
115 @@ -2006,7 +2016,7 @@
116 if (TREE_CODE (op0) == SSA_NAME)
117 vr0 = *(get_value_range (op0));
118 else if (is_gimple_min_invariant (op0))
119 - set_value_range_to_value (&vr0, op0);
120 + set_value_range_to_value (&vr0, op0, NULL);
122 set_value_range_to_varying (&vr0);
124 @@ -2393,7 +2403,10 @@
125 its type may be different from _Bool. Convert VAL to EXPR's
127 val = fold_convert (TREE_TYPE (expr), val);
128 - set_value_range (vr, VR_RANGE, val, val, vr->equiv);
129 + if (is_gimple_min_invariant (val))
130 + set_value_range_to_value (vr, val, vr->equiv);
132 + set_value_range (vr, VR_RANGE, val, val, vr->equiv);
135 set_value_range_to_varying (vr);
136 @@ -2424,7 +2437,7 @@
137 else if (TREE_CODE_CLASS (code) == tcc_comparison)
138 extract_range_from_comparison (vr, expr);
139 else if (is_gimple_min_invariant (expr))
140 - set_value_range_to_value (vr, expr);
141 + set_value_range_to_value (vr, expr, NULL);
143 set_value_range_to_varying (vr);
145 @@ -4156,7 +4169,7 @@
146 t = retval = NULL_TREE;
147 EXECUTE_IF_SET_IN_BITMAP (e2, 0, i2, bi2)
152 value_range_t vr2 = *(vr_value[i2]);
155 ===================================================================
156 --- gcc/DATESTAMP (.../tags/gcc_4_2_0_release) (revision 125292)
157 +++ gcc/DATESTAMP (.../branches/gcc-4_2-branch) (revision 125292)
161 Index: gcc/pointer-set.c
162 ===================================================================
163 --- gcc/pointer-set.c (.../tags/gcc_4_2_0_release) (revision 125292)
164 +++ gcc/pointer-set.c (.../branches/gcc-4_2-branch) (revision 125292)
167 #include "pointer-set.h"
169 -/* A pointer sets is represented as a simple open-addressing hash
170 +/* A pointer set is represented as a simple open-addressing hash
171 table. Simplifications: The hash code is based on the value of the
172 pointer, not what it points to. The number of buckets is always a
173 power of 2. Null pointers are a reserved value. Deletion is not
174 - supported. There is no mechanism for user control of hash
175 - function, equality comparison, initial size, or resizing policy.
177 + supported (yet). There is no mechanism for user control of hash
178 + function, equality comparison, initial size, or resizing policy. */
182 @@ -114,22 +113,16 @@
186 -/* Subroutine of pointer_set_insert. Inserts P into an empty
187 - element of SLOTS, an array of length N_SLOTS. Returns nonzero
188 - if P was already present in N_SLOTS. */
190 +/* Subroutine of pointer_set_insert. Return the insertion slot for P into
191 + an empty element of SLOTS, an array of length N_SLOTS. */
192 +static inline size_t
193 insert_aux (void *p, void **slots, size_t n_slots, size_t log_slots)
195 size_t n = hash1 (p, n_slots, log_slots);
200 - else if (slots[n] == 0)
205 + if (slots[n] == p || slots[n] == 0)
210 @@ -144,12 +137,10 @@
212 pointer_set_insert (struct pointer_set_t *pset, void *p)
214 - if (insert_aux (p, pset->slots, pset->n_slots, pset->log_slots))
217 - /* We've inserted a new element. Expand the table if necessary to keep
218 - the load factor small. */
219 - ++pset->n_elements;
222 + /* For simplicity, expand the set even if P is already there. This can be
223 + superfluous but can happen at most once. */
224 if (pset->n_elements > pset->n_slots / 4)
226 size_t new_log_slots = pset->log_slots + 1;
230 for (i = 0; i < pset->n_slots; ++i)
232 - if (pset->slots[i])
233 - insert_aux (pset->slots[i], new_slots, new_n_slots, new_log_slots);
235 + void *value = pset->slots[i];
236 + n = insert_aux (value, new_slots, new_n_slots, new_log_slots);
237 + new_slots[n] = value;
240 XDELETEVEC (pset->slots);
241 @@ -169,5 +161,144 @@
242 pset->slots = new_slots;
245 + n = insert_aux (p, pset->slots, pset->n_slots, pset->log_slots);
246 + if (pset->slots[n])
249 + pset->slots[n] = p;
250 + ++pset->n_elements;
254 +/* Pass each pointer in PSET to the function in FN, together with the fixed
255 + parameter DATA. If FN returns false, the iteration stops. */
257 +void pointer_set_traverse (struct pointer_set_t *pset,
258 + bool (*fn) (void *, void *), void *data)
261 + for (i = 0; i < pset->n_slots; ++i)
262 + if (pset->slots[i] && !fn (pset->slots[i], data))
267 +/* A pointer map is represented the same way as a pointer_set, so
268 + the hash code is based on the address of the key, rather than
269 + its contents. Null keys are a reserved value. Deletion is not
270 + supported (yet). There is no mechanism for user control of hash
271 + function, equality comparison, initial size, or resizing policy. */
273 +struct pointer_map_t
276 + size_t n_slots; /* n_slots = 2^log_slots */
283 +/* Allocate an empty pointer map. */
284 +struct pointer_map_t *
285 +pointer_map_create (void)
287 + struct pointer_map_t *result = XNEW (struct pointer_map_t);
289 + result->n_elements = 0;
290 + result->log_slots = 8;
291 + result->n_slots = (size_t) 1 << result->log_slots;
293 + result->keys = XCNEWVEC (void *, result->n_slots);
294 + result->values = XCNEWVEC (void *, result->n_slots);
298 +/* Reclaims all memory associated with PMAP. */
299 +void pointer_map_destroy (struct pointer_map_t *pmap)
301 + XDELETEVEC (pmap->keys);
302 + XDELETEVEC (pmap->values);
306 +/* Returns a pointer to the value to which P maps, if PMAP contains P. P
307 + must be nonnull. Return NULL if PMAP does not contain P.
309 + Collisions are resolved by linear probing. */
311 +pointer_map_contains (struct pointer_map_t *pmap, void *p)
313 + size_t n = hash1 (p, pmap->n_slots, pmap->log_slots);
317 + if (pmap->keys[n] == p)
318 + return &pmap->values[n];
319 + else if (pmap->keys[n] == 0)
324 + if (n == pmap->n_slots)
330 +/* Inserts P into PMAP if it wasn't already there. Returns a pointer
331 + to the value. P must be nonnull. */
333 +pointer_map_insert (struct pointer_map_t *pmap, void *p)
337 + /* For simplicity, expand the map even if P is already there. This can be
338 + superfluous but can happen at most once. */
339 + if (pmap->n_elements > pmap->n_slots / 4)
341 + size_t new_log_slots = pmap->log_slots + 1;
342 + size_t new_n_slots = pmap->n_slots * 2;
343 + void **new_keys = XCNEWVEC (void *, new_n_slots);
344 + void **new_values = XCNEWVEC (void *, new_n_slots);
347 + for (i = 0; i < pmap->n_slots; ++i)
350 + void *key = pmap->keys[i];
351 + n = insert_aux (key, new_keys, new_n_slots, new_log_slots);
353 + new_values[n] = pmap->values[i];
356 + XDELETEVEC (pmap->keys);
357 + XDELETEVEC (pmap->values);
358 + pmap->n_slots = new_n_slots;
359 + pmap->log_slots = new_log_slots;
360 + pmap->keys = new_keys;
361 + pmap->values = new_values;
364 + n = insert_aux (p, pmap->keys, pmap->n_slots, pmap->log_slots);
365 + if (!pmap->keys[n])
367 + ++pmap->n_elements;
371 + return &pmap->values[n];
374 +/* Pass each pointer in PMAP to the function in FN, together with the pointer
375 + to the value and the fixed parameter DATA. If FN returns false, the
376 + iteration stops. */
378 +void pointer_map_traverse (struct pointer_map_t *pmap,
379 + bool (*fn) (void *, void **, void *), void *data)
382 + for (i = 0; i < pmap->n_slots; ++i)
383 + if (pmap->keys[i] && !fn (pmap->keys[i], &pmap->values[i], data))
386 Index: gcc/pointer-set.h
387 ===================================================================
388 --- gcc/pointer-set.h (.../tags/gcc_4_2_0_release) (revision 125292)
389 +++ gcc/pointer-set.h (.../branches/gcc-4_2-branch) (revision 125292)
391 #define POINTER_SET_H
393 struct pointer_set_t;
395 struct pointer_set_t *pointer_set_create (void);
396 void pointer_set_destroy (struct pointer_set_t *pset);
398 int pointer_set_contains (struct pointer_set_t *pset, void *p);
399 int pointer_set_insert (struct pointer_set_t *pset, void *p);
400 +void pointer_set_traverse (struct pointer_set_t *, bool (*) (void *, void *),
403 +struct pointer_map_t;
404 +struct pointer_map_t *pointer_map_create (void);
405 +void pointer_map_destroy (struct pointer_map_t *pmap);
407 +void **pointer_map_contains (struct pointer_map_t *pmap, void *p);
408 +void **pointer_map_insert (struct pointer_map_t *pmap, void *p);
409 +void pointer_map_traverse (struct pointer_map_t *,
410 + bool (*) (void *, void **, void *), void *);
412 #endif /* POINTER_SET_H */
413 Index: gcc/fold-const.c
414 ===================================================================
415 --- gcc/fold-const.c (.../tags/gcc_4_2_0_release) (revision 125292)
416 +++ gcc/fold-const.c (.../branches/gcc-4_2-branch) (revision 125292)
417 @@ -12634,9 +12634,14 @@
418 /* ... fall through ... */
421 - if (truth_value_p (TREE_CODE (t)))
422 - /* Truth values evaluate to 0 or 1, which is nonnegative. */
425 + tree type = TREE_TYPE (t);
426 + if ((TYPE_PRECISION (type) != 1 || TYPE_UNSIGNED (type))
427 + && truth_value_p (TREE_CODE (t)))
428 + /* Truth values evaluate to 0 or 1, which is nonnegative unless we
429 + have a signed:1 type (where the value is -1 and 0). */
434 /* We don't know sign of `t', so be conservative and return false. */
436 ===================================================================
437 --- gcc/DEV-PHASE (.../tags/gcc_4_2_0_release) (revision 125292)
438 +++ gcc/DEV-PHASE (.../branches/gcc-4_2-branch) (revision 125292)
442 ===================================================================
443 --- gcc/ChangeLog (.../tags/gcc_4_2_0_release) (revision 125292)
444 +++ gcc/ChangeLog (.../branches/gcc-4_2-branch) (revision 125292)
446 +2007-05-31 H.J. Lu <hongjiu.lu@intel.com>
448 + Backport from mainline:
449 + 2007-05-25 H.J. Lu <hongjiu.lu@intel.com>
451 + * config/i386/i386.c (__builtin_ia32_vec_ext_v2df): Mark it
453 + (__builtin_ia32_vec_ext_v2di): Likewise.
454 + (__builtin_ia32_vec_ext_v4si): Likewise.
455 + (__builtin_ia32_vec_ext_v8hi): Likewise.
456 + (__builtin_ia32_vec_set_v8hi): Likewise.
458 +2007-05-31 John David Anglin <dave.anglin@nrc-cnrc.gc.ca>
460 + Backport from mainline:
461 + 2007-05-05 Aurelien Jarno <aurelien@aurel32.net>
463 + * config/pa/pa.md: Split tgd_load, tld_load and tie_load
464 + into pic and non-pic versions. Mark r19 as used for
465 + tgd_load_pic, tld_load_pic and tie_load_pic. Mark r27 as used
466 + for tgd_load, tld_load and tie_load .
467 + * config/pa/pa.c (legitimize_tls_address): Emit pic or non-pic
468 + version of tgd_load, tld_load and tie_load depending on the
471 +2007-05-27 Daniel Berlin <dberlin@dberlin.org>
474 + Backport PTA solver from mainline
476 + * pointer-set.c: Copy from mainline
477 + * pointer-set.h: Ditto.
478 + * tree-ssa-structalias.c: Copy solver portions from mainline.
479 + * Makefile.in (tree-ssa-structalias.o): Update dependencies
481 +2007-05-30 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
483 + * tree-vrp.c (compare_names): Initialize sop.
485 +2007-05-30 Jakub Jelinek <jakub@redhat.com>
487 + PR tree-optimization/31769
488 + * except.c (duplicate_eh_regions): Clear prev_try if
489 + ERT_MUST_NOT_THROW region is inside of ERT_TRY region.
491 +2007-05-28 Andrew Pinski <andrew_pinski@playstation.sony.com>
494 + * fold-const.c (tree_expr_nonnegative_warnv_p): Don't
495 + return true when truth_value_p is true and the type
498 +2007-05-27 H.J. Lu <hongjiu.lu@intel.com>
500 + Backport from mainline:
501 + 2007-05-25 Uros Bizjak <ubizjak@gmail.com>
503 + * config/i386/sse.md (*vec_extractv2di_1_sse2): Do not calculate
504 + "memory" attribute for "sseishft" type insn without operands[2].
506 + 2007-05-25 H.J. Lu <hongjiu.lu@intel.com>
508 + * config/i386/sse.md (*vec_extractv2di_1_sse2): Correct shift.
510 +2007-05-22 Ian Lance Taylor <iant@google.com>
512 + * tree-vrp.c (avoid_overflow_infinity): New static function,
513 + broken out of set_value_range_to_value.
514 + (set_value_range_to_value): Call avoid_overflow_infinity.
515 + (extract_range_from_assert): Likewise.
517 +2007-05-23 Chen Liqin <liqin@sunnorth.com.cn>
520 + * config/score/misc.md (bitclr_c, bitset_c, bittgl_c): remove.
521 + * config/score/predicate.md (const_pow2, const_npow2): remove.
522 + * config/score/score.h (ASM_OUTPUT_EXTERNAL): add ASM_OUTPUT_EXTERNAL undef.
524 + * config/score/score.c (score_print_operand): makes sure that only lower
527 +2007-05-21 Uros Bizjak <ubizjak@gmail.com>
530 + Backport from mainline.
531 + * config/i386/i386.md (*addti3_1, *addti3_1 splitter): Use
532 + x86_64_general_operand as operand[2] predicate. Remove "iF"
533 + from operand constraints and use "e" constraint instead.
534 + (*subti3_1, *subti3_1 splitter): Ditto.
535 + (*negti2_1, *negti2_1 splitter): Use nonimmediate_operand as
536 + operand[1] predicate.
538 +2007-05-21 Uros Bizjak <ubizjak@gmail.com>
541 + Backport from mainline.
542 + * config/i386/sse.md ("*sse3_movddup"): Use operands[0] and
543 + operands[1] in insn constraint. Correct type attribute to sselog1.
545 +2007-05-20 Kaz Kojima <kkojima@gcc.gnu.org>
548 + Backport from mainline.
549 + * config/sh/sh.c (output_stack_adjust): Avoid using the frame
550 + register itself to hold the offset constant. Tell flow the use
551 + of r4 and r5 when they are used.
553 +2007-05-20 Kaz Kojima <kkojima@gcc.gnu.org>
556 + Backport from mainline.
557 + * config/sh/sh.md (length): Check if prev_nonnote_insn (insn)
560 +2007-05-20 Kaz Kojima <kkojima@gcc.gnu.org>
563 + Backport from mainline.
564 + * config/sh/sh.c (sh_adjust_cost): Use the result of single_set
565 + instead of PATTERN.
567 +2007-05-20 Kaz Kojima <kkojima@gcc.gnu.org>
570 + Backport from mainline.
571 + * config/sh/sh.md (cmp{eq,gt,gtu}{si,di}_media): Remove.
572 + (cmpsi{eq,gt,gtu}{si,di}_media): Rename to
573 + cmp{eq,gt,gtu}{si,di}_media.
574 + (*cmpne0si_media): Remove.
575 + (*movsicc_umin): Adjust gen_cmp*_media call.
576 + (unordered): Change the mode of unordered and operands[1] to
578 + (seq): Adjust gen_cmp*_media calls. Make the mode of
579 + a temporary result of compare SImode if needed. If the mode
580 + of operands[0] is DImode, extend the temporary result to DImode.
581 + (slt, sle, sgt, sge, sgtu, sltu, sleu, sgue, sne): Likewise.
582 + (sunorderd): Change the mode of match_operand and unorderd to
584 + (cmpeq{sf,df}_media): Remove.
585 + (cmpsieq{sf,df}_media): Rename to cmpeq{sf,df}_media.
586 + (cmp{gt,ge,un}{sf,df}_media): Change the mode of match_operand
587 + and compare operation to SImode.
589 +2007-05-18 Joseph Myers <joseph@codesourcery.com>
591 + * config/soft-fp/double.h, config/soft-fp/extended.h,
592 + config/soft-fp/floatundidf.c, config/soft-fp/floatundisf.c,
593 + config/soft-fp/floatunsidf.c, config/soft-fp/floatunsisf.c,
594 + config/soft-fp/op-2.h, config/soft-fp/op-4.h,
595 + config/soft-fp/op-common.h, config/soft-fp/quad.h: Update from
598 +2007-05-17 Ian Lance Taylor <iant@google.com>
600 + PR tree-optimization/31953
601 + * tree-vrp.c (set_value_range_to_value): Add equiv parameter.
602 + Change all callers.
603 + (set_value_range_to_null): Call set_value_range_to_value.
604 + (extract_range_from_comparison): Likewise.
606 +2007-05-17 Eric Botcazou <ebotcazou@libertysurf.fr>
608 + PR rtl-optimization/31691
609 + * combine.c (simplify_set): Build a new src pattern instead of
610 + substituting its operands in the COMPARE case.
612 +2007-05-14 Mark Mitchell <mark@codesourcery.com>
614 + * BASE-VER: Set to 4.2.1.
615 + * DEV-PHASE: Set to prerelease.
617 2007-05-13 Release Manager
619 * GCC 4.2.0 released.
621 2007-04-03 Stuart Hastings <stuart@apple.com>
624 - * objc/objc-act.c (next_sjlj_build_catch_list): Delete volatile from rethrow decl.
625 + * objc/objc-act.c (next_sjlj_build_catch_list): Delete volatile
627 * cse.c (record_jump_equiv): Bail out on CCmode comparisons.
629 2007-04-03 Jakub Jelinek <jakub@redhat.com>
630 Index: gcc/testsuite/gcc.c-torture/execute/vrp-7.c
631 ===================================================================
632 --- gcc/testsuite/gcc.c-torture/execute/vrp-7.c (.../tags/gcc_4_2_0_release) (revision 0)
633 +++ gcc/testsuite/gcc.c-torture/execute/vrp-7.c (.../branches/gcc-4_2-branch) (revision 125292)
643 +void __attribute__((noinline)) foo (int f)
645 + t.b = (f & 0x10) ? 1 : 0;
655 Index: gcc/testsuite/gcc.c-torture/execute/20070517-1.c
656 ===================================================================
657 --- gcc/testsuite/gcc.c-torture/execute/20070517-1.c (.../tags/gcc_4_2_0_release) (revision 0)
658 +++ gcc/testsuite/gcc.c-torture/execute/20070517-1.c (.../branches/gcc-4_2-branch) (revision 125292)
660 +/* PR rtl-optimization/31691 */
661 +/* Origin: Chi-Hua Chen <stephaniechc-gccbug@yahoo.com> */
663 +extern void abort (void);
665 +static int get_kind(int) __attribute__ ((noinline));
667 +static int get_kind(int v)
669 + volatile int k = v;
673 +static int some_call(void) __attribute__ ((noinline));
675 +static int some_call(void)
680 +static void example (int arg)
682 + int tmp, kind = get_kind (arg);
684 + if (kind == 9 || kind == 10 || kind == 5)
686 + if (some_call() == 0)
688 + if (kind == 9 || kind == 10)
701 Index: gcc/testsuite/gcc.c-torture/compile/pr31953.c
702 ===================================================================
703 --- gcc/testsuite/gcc.c-torture/compile/pr31953.c (.../tags/gcc_4_2_0_release) (revision 0)
704 +++ gcc/testsuite/gcc.c-torture/compile/pr31953.c (.../branches/gcc-4_2-branch) (revision 125292)
708 + int hexedit_mode:1;
710 +toggle_hexedit_mode (struct WView *view)
712 + if (view->hexedit_mode)
717 + view->hexedit_mode = !view->hexedit_mode;
720 Index: gcc/testsuite/gcc.target/i386/sse2-vec-3.c
721 ===================================================================
722 --- gcc/testsuite/gcc.target/i386/sse2-vec-3.c (.../tags/gcc_4_2_0_release) (revision 0)
723 +++ gcc/testsuite/gcc.target/i386/sse2-vec-3.c (.../branches/gcc-4_2-branch) (revision 125292)
725 +/* { dg-do run { target i?86-*-* x86_64-*-* } } */
726 +/* { dg-options "-O2 -msse2" } */
728 +#include "sse2-check.h"
730 +#include <emmintrin.h>
747 + for (i = 0; i < 16; i++)
750 + res[0] = __builtin_ia32_vec_ext_v4si ((__v4si)val1.x, 0);
751 + res[1] = __builtin_ia32_vec_ext_v4si ((__v4si)val1.x, 1);
752 + res[2] = __builtin_ia32_vec_ext_v4si ((__v4si)val1.x, 2);
753 + res[3] = __builtin_ia32_vec_ext_v4si ((__v4si)val1.x, 3);
755 + for (i = 0; i < 4; i++)
758 + for (i = 0; i < 4; i++)
759 + if (res[i] != val1.i [masks[i]])
762 Index: gcc/testsuite/gcc.target/i386/pr31167.c
763 ===================================================================
764 --- gcc/testsuite/gcc.target/i386/pr31167.c (.../tags/gcc_4_2_0_release) (revision 0)
765 +++ gcc/testsuite/gcc.target/i386/pr31167.c (.../branches/gcc-4_2-branch) (revision 125292)
767 +/* { dg-do compile { target x86_64-*-* } } */
768 +/* { dg-options "-O" } */
770 +typedef int int32_t;
772 +int32_t round32hi (const __int128_t arg)
774 + const int SHIFT = 96;
775 + const int mshift = 96;
776 + const __int128_t M = (~(__int128_t) 0) << mshift;
777 + const __int128_t L = (~M) + 1;
778 + const __int128_t L1 = ((__int128_t) L) >> 1;
779 + const __int128_t Mlo = ((__int128_t) (~M)) >> 1;
780 + __int128_t vv = arg & M;
782 + if ((arg & (L1)) && ((arg & Mlo) || (arg & L)))
785 + return (int32_t) (vv >> SHIFT);
787 Index: gcc/testsuite/gcc.target/i386/sse2-vec-4.c
788 ===================================================================
789 --- gcc/testsuite/gcc.target/i386/sse2-vec-4.c (.../tags/gcc_4_2_0_release) (revision 0)
790 +++ gcc/testsuite/gcc.target/i386/sse2-vec-4.c (.../branches/gcc-4_2-branch) (revision 125292)
792 +/* { dg-do run { target i?86-*-* x86_64-*-* } } */
793 +/* { dg-options "-O2 -msse2" } */
795 +#include "sse2-check.h"
797 +#include <emmintrin.h>
814 + for (i = 0; i < 16; i++)
817 + res[0] = __builtin_ia32_vec_ext_v8hi ((__v8hi)val1.x, 0);
818 + res[1] = __builtin_ia32_vec_ext_v8hi ((__v8hi)val1.x, 1);
819 + res[2] = __builtin_ia32_vec_ext_v8hi ((__v8hi)val1.x, 2);
820 + res[3] = __builtin_ia32_vec_ext_v8hi ((__v8hi)val1.x, 3);
821 + res[4] = __builtin_ia32_vec_ext_v8hi ((__v8hi)val1.x, 4);
822 + res[5] = __builtin_ia32_vec_ext_v8hi ((__v8hi)val1.x, 5);
823 + res[6] = __builtin_ia32_vec_ext_v8hi ((__v8hi)val1.x, 6);
824 + res[7] = __builtin_ia32_vec_ext_v8hi ((__v8hi)val1.x, 7);
826 + for (i = 0; i < 8; i++)
829 + for (i = 0; i < 8; i++)
830 + if (res[i] != val1.s [masks[i]])
833 Index: gcc/testsuite/gcc.target/i386/sse2-check.h
834 ===================================================================
835 --- gcc/testsuite/gcc.target/i386/sse2-check.h (.../tags/gcc_4_2_0_release) (revision 0)
836 +++ gcc/testsuite/gcc.target/i386/sse2-check.h (.../branches/gcc-4_2-branch) (revision 125292)
841 +#include "../../gcc.dg/i386-cpuid.h"
843 +static void sse2_test (void);
848 + unsigned long cpu_facilities;
850 + cpu_facilities = i386_cpuid_edx ();
852 + /* Run SSE2 test only if host has SSE2 support. */
853 + if ((cpu_facilities & bit_SSE2))
858 Index: gcc/testsuite/gcc.target/i386/sse2-vec-1.c
859 ===================================================================
860 --- gcc/testsuite/gcc.target/i386/sse2-vec-1.c (.../tags/gcc_4_2_0_release) (revision 0)
861 +++ gcc/testsuite/gcc.target/i386/sse2-vec-1.c (.../branches/gcc-4_2-branch) (revision 125292)
863 +/* { dg-do run { target i?86-*-* x86_64-*-* } } */
864 +/* { dg-options "-O2 -msse2" } */
866 +#include "sse2-check.h"
868 +#include <emmintrin.h>
888 + res[0] = __builtin_ia32_vec_ext_v2df ((__v2df)val1.x, msk0);
889 + res[1] = __builtin_ia32_vec_ext_v2df ((__v2df)val1.x, msk1);
894 + for (i = 0; i < 2; i++)
895 + if (res[i] != val1.d [masks[i]])
898 Index: gcc/testsuite/gcc.target/i386/sse2-vec-5.c
899 ===================================================================
900 --- gcc/testsuite/gcc.target/i386/sse2-vec-5.c (.../tags/gcc_4_2_0_release) (revision 0)
901 +++ gcc/testsuite/gcc.target/i386/sse2-vec-5.c (.../branches/gcc-4_2-branch) (revision 125292)
903 +/* { dg-do run { target i?86-*-* x86_64-*-* } } */
904 +/* { dg-options "-O2 -msse2" } */
906 +#include "sse2-check.h"
908 +#include <emmintrin.h>
925 + for (i = 0; i < 16; i++)
928 + res[0] = __builtin_ia32_vec_ext_v16qi ((__v16qi)val1.x, 0);
929 + res[1] = __builtin_ia32_vec_ext_v16qi ((__v16qi)val1.x, 1);
930 + res[2] = __builtin_ia32_vec_ext_v16qi ((__v16qi)val1.x, 2);
931 + res[3] = __builtin_ia32_vec_ext_v16qi ((__v16qi)val1.x, 3);
932 + res[4] = __builtin_ia32_vec_ext_v16qi ((__v16qi)val1.x, 4);
933 + res[5] = __builtin_ia32_vec_ext_v16qi ((__v16qi)val1.x, 5);
934 + res[6] = __builtin_ia32_vec_ext_v16qi ((__v16qi)val1.x, 6);
935 + res[7] = __builtin_ia32_vec_ext_v16qi ((__v16qi)val1.x, 7);
936 + res[8] = __builtin_ia32_vec_ext_v16qi ((__v16qi)val1.x, 8);
937 + res[9] = __builtin_ia32_vec_ext_v16qi ((__v16qi)val1.x, 9);
938 + res[10] = __builtin_ia32_vec_ext_v16qi ((__v16qi)val1.x, 10);
939 + res[11] = __builtin_ia32_vec_ext_v16qi ((__v16qi)val1.x, 11);
940 + res[12] = __builtin_ia32_vec_ext_v16qi ((__v16qi)val1.x, 12);
941 + res[13] = __builtin_ia32_vec_ext_v16qi ((__v16qi)val1.x, 13);
942 + res[14] = __builtin_ia32_vec_ext_v16qi ((__v16qi)val1.x, 14);
943 + res[15] = __builtin_ia32_vec_ext_v16qi ((__v16qi)val1.x, 15);
945 + for (i = 0; i < 16; i++)
948 + for (i = 0; i < 16; i++)
949 + if (res[i] != val1.c [masks[i]])
952 Index: gcc/testsuite/gcc.target/i386/sse2-vec-2.c
953 ===================================================================
954 --- gcc/testsuite/gcc.target/i386/sse2-vec-2.c (.../tags/gcc_4_2_0_release) (revision 0)
955 +++ gcc/testsuite/gcc.target/i386/sse2-vec-2.c (.../branches/gcc-4_2-branch) (revision 125292)
957 +/* { dg-do run { target i?86-*-* x86_64-*-* } } */
958 +/* { dg-options "-O2 -msse2" } */
960 +#include "sse2-check.h"
962 +#include <emmintrin.h>
979 + for (i = 0; i < 16; i++)
982 + res[0] = __builtin_ia32_vec_ext_v2di ((__v2di)val1.x, 0);
983 + res[1] = __builtin_ia32_vec_ext_v2di ((__v2di)val1.x, 1);
985 + for (i = 0; i < 2; i++)
988 + for (i = 0; i < 2; i++)
989 + if (res[i] != val1.ll [masks[i]])
992 Index: gcc/testsuite/gcc.target/i386/sse2-vec-6.c
993 ===================================================================
994 --- gcc/testsuite/gcc.target/i386/sse2-vec-6.c (.../tags/gcc_4_2_0_release) (revision 0)
995 +++ gcc/testsuite/gcc.target/i386/sse2-vec-6.c (.../branches/gcc-4_2-branch) (revision 125292)
997 +/* { dg-do run { target i?86-*-* x86_64-*-* } } */
998 +/* { dg-options "-O2 -msse2" } */
1000 +#include "sse2-check.h"
1002 +#include <emmintrin.h>
1003 +#include <string.h>
1015 + } val1, res[16], tmp;
1016 + short ins[8] = { 8, 5, 9, 4, 2, 6, 1, 20 };
1020 + for (i = 0; i < 16; i++)
1023 + res[0].x = (__m128i) __builtin_ia32_vec_set_v8hi ((__v8hi)val1.x,
1025 + res[1].x = (__m128i) __builtin_ia32_vec_set_v8hi ((__v8hi)val1.x,
1027 + res[2].x = (__m128i) __builtin_ia32_vec_set_v8hi ((__v8hi)val1.x,
1029 + res[3].x = (__m128i) __builtin_ia32_vec_set_v8hi ((__v8hi)val1.x,
1031 + res[4].x = (__m128i) __builtin_ia32_vec_set_v8hi ((__v8hi)val1.x,
1033 + res[5].x = (__m128i) __builtin_ia32_vec_set_v8hi ((__v8hi)val1.x,
1035 + res[6].x = (__m128i) __builtin_ia32_vec_set_v8hi ((__v8hi)val1.x,
1037 + res[7].x = (__m128i) __builtin_ia32_vec_set_v8hi ((__v8hi)val1.x,
1040 + for (i = 0; i < 8; i++)
1043 + for (i = 0; i < 8; i++)
1046 + tmp.s[masks[i]] = ins[0];
1047 + if (memcmp (&tmp, &res[i], sizeof (tmp)))
1051 + for (i = 0; i < 8; i++)
1053 + res[i].x = (__m128i) __builtin_ia32_vec_set_v8hi ((__v8hi)val1.x,
1058 + for (i = 0; i < 8; i++)
1061 + tmp.s[masks[i]] = ins[i];
1062 + if (memcmp (&tmp, &res[i], sizeof (tmp)))
1066 Index: gcc/testsuite/ChangeLog
1067 ===================================================================
1068 --- gcc/testsuite/ChangeLog (.../tags/gcc_4_2_0_release) (revision 125292)
1069 +++ gcc/testsuite/ChangeLog (.../branches/gcc-4_2-branch) (revision 125292)
1071 +2007-05-31 H.J. Lu <hongjiu.lu@intel.com>
1073 + Backport from mainline:
1074 + 2007-05-25 H.J. Lu <hongjiu.lu@intel.com>
1076 + * gcc.target/i386/sse2-check.h: New.
1077 + * gcc.target/i386/sse2-vec-1.c: Likewise.
1078 + * gcc.target/i386/sse2-vec-2.c: Likewise.
1079 + * gcc.target/i386/sse2-vec-3.c: Likewise.
1080 + * gcc.target/i386/sse2-vec-4.c: Likewise.
1081 + * gcc.target/i386/sse2-vec-5.c: Likewise.
1082 + * gcc.target/i386/sse2-vec-6.c: Likewise.
1084 +2007-05-31 Paul Thomas <pault@gcc.gnu.org>
1087 + * gfortran.dg/altreturn_5.f90: New test.
1090 + * gfortran.dg/char_result_5.f90: New test.
1093 + * gfortran.dg/char_length_5.f90: New test.
1096 + * gfortran.dg/array_reference_1.f90: New test.
1098 +2007-05-22 Tobias Burnus <burnus@net-b.de>
1101 + Backport from mainline.
1102 + * primary.c (match_variable): External functions
1105 +2007-05-30 Jakub Jelinek <jakub@redhat.com>
1107 + PR tree-optimization/31769
1108 + * g++.dg/gomp/pr31769.C: New test.
1110 +2007-05-28 Andrew Pinski <andrew_pinski@playstation.sony.com>
1113 + * gcc.c-torture/execute/vrp-7.c: New test.
1115 +2007-05-23 Jerry DeLisle <jvdelisle@gcc.gnu.org>
1117 + PR libfortran/31964
1118 + * gfortran.fortran-torture/execute/intrinsic_bitops.f90: Update.
1120 +2007-05-22 Jerry DeLisle <jvdelisle@gcc.gnu.org>
1122 + PR libgfortran/31051
1123 + * gfortran.dg/fmt_t_3.f90: New.
1125 +2007-05-22 Dominique d'Humieres <dominiq@lps.ens.fr>
1127 + * gfortran.dg/unf_io_convert_3.f90: Fix dg directive.
1129 +2007-05-22 Tobias Burnus <burnus@net-b.de>
1132 + Backport from mainline.
1133 + * func_assign.f90: New test.
1135 +2007-05-21 Uros Bizjak <ubizjak@gmail.com>
1138 + Backport from mainline.
1139 + * gcc.target/i386/pr31167.c: New test.
1141 +2007-05-20 Jerry DeLisle <jvdelisle@gcc.gnu.org>
1143 + PR libgfortran/31395
1144 + * gfortran.dg/fmt_colon.f90: New test.
1146 +2007-05-20 Thomas Koenig <tkoenig@gcc.gnu.org>
1149 + Backport from trunk.
1150 + * gfortran.dg/backspace_8.f: New test case.
1152 +2007-05-20 Thomas Koenig <tkoenig@gcc.gnu.org>
1154 + PR libfortran/31196
1155 + Backport from trunk.
1156 + * gfortran.dg/reshape_transpose_1.f90: New test.
1158 +2007-05-17 Ian Lance Taylor <iant@google.com>
1160 + PR tree-optimization/31953
1161 + * gcc.c-torture/compile/pr31953.c: New test.
1163 +2007-05-17 Eric Botcazou <ebotcazou@libertysurf.fr>
1165 + * gcc.c-torture/execute/20070517-1.c: New test.
1167 +2007-05-16 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
1170 + * gfortran.dg/substr_4.f: New test.
1172 2007-05-13 Release Manager
1174 * GCC 4.2.0 released.
1175 Index: gcc/testsuite/gfortran.fortran-torture/execute/intrinsic_bitops.f90
1176 ===================================================================
1177 --- gcc/testsuite/gfortran.fortran-torture/execute/intrinsic_bitops.f90 (.../tags/gcc_4_2_0_release) (revision 125292)
1178 +++ gcc/testsuite/gfortran.fortran-torture/execute/intrinsic_bitops.f90 (.../branches/gcc-4_2-branch) (revision 125292)
1186 if (.not. btest (i, o+1)) call abort
1187 if (btest (i, o+2)) call abort
1188 if (iand (i, j) .ne. 2) call abort
1190 if (ishftc (k, o-30) .ne. 48) call abort
1191 if (ishftc (k, o+1, o+3) .ne. 9) call abort
1192 if (not (i) .ne. -3) call abort
1193 + if (ishftc (a, 1, bit_size(a)) .ne. 10) call abort
1194 + if (ishftc (1, 1, 32) .ne. 2) call abort
1196 Index: gcc/testsuite/g++.dg/gomp/pr31769.C
1197 ===================================================================
1198 --- gcc/testsuite/g++.dg/gomp/pr31769.C (.../tags/gcc_4_2_0_release) (revision 0)
1199 +++ gcc/testsuite/g++.dg/gomp/pr31769.C (.../branches/gcc-4_2-branch) (revision 125292)
1201 +// PR tree-optimization/31769
1202 +// { dg-options "-O2 -fopenmp" }
1203 +// { dg-do compile }
1212 + C (int x, int y) {}
1214 +template<typename T, int U>
1229 + A () { b = __null; }
1230 + ~A () { if (b != __null) delete b; }
1232 +struct F : public A
1234 + explicit F (int x) { foo (0); }
1237 + F operator () (C x) const
1239 + return F (const_cast<F &>(*this), x);
1241 + template <typename U> F & operator+= (const U &);
1254 +#pragma omp parallel for
1255 + for (int i = 0; i < 2; ++i)
1262 Index: gcc/testsuite/gfortran.dg/char_length_5.f90
1263 ===================================================================
1264 --- gcc/testsuite/gfortran.dg/char_length_5.f90 (.../tags/gcc_4_2_0_release) (revision 0)
1265 +++ gcc/testsuite/gfortran.dg/char_length_5.f90 (.../branches/gcc-4_2-branch) (revision 125292)
1268 +! Tests the fix for PR31867, in which the interface evaluation
1269 +! of the character length of 'join' (ie. the length available in
1270 +! the caller) was wrong.
1272 +! Contributed by <beliavsky@aol.com>
1277 + function join (words, sep) result(str)
1278 + character (len=*), intent(in) :: words(:),sep
1279 + character (len = (size (words) - 1) * len_trim (sep) + &
1280 + sum (len_trim (words))) :: str
1290 + str = trim (str) // trim (sep) // words(i)
1293 +end module util_mod
1296 + use util_mod, only: join
1299 + character (len=5) :: words(5:8) = (/"two ","three","four ","five "/), sep = "^#^"
1300 + character (len=5) :: words2(4) = (/"bat ","ball ","goal ","stump"/), sep2 = "&"
1302 + if (join (words, sep) .ne. "two^#^three^#^four^#^five") call abort ()
1303 + if (len (join (words, sep)) .ne. 25) call abort ()
1305 + if (join (words(5:6), sep) .ne. "two^#^three") call abort ()
1306 + if (len (join (words(5:6), sep)) .ne. 11) call abort ()
1308 + if (join (words(7:8), sep) .ne. "four^#^five") call abort ()
1309 + if (len (join (words(7:8), sep)) .ne. 11) call abort ()
1311 + if (join (words(5:7:2), sep) .ne. "two^#^four") call abort ()
1312 + if (len (join (words(5:7:2), sep)) .ne. 10) call abort ()
1314 + if (join (words(6:8:2), sep) .ne. "three^#^five") call abort ()
1315 + if (len (join (words(6:8:2), sep)) .ne. 12) call abort ()
1317 + if (join (words2, sep2) .ne. "bat&ball&goal&stump") call abort ()
1318 + if (len (join (words2, sep2)) .ne. 19) call abort ()
1320 + if (join (words2(1:2), sep2) .ne. "bat&ball") call abort ()
1321 + if (len (join (words2(1:2), sep2)) .ne. 8) call abort ()
1323 + if (join (words2(2:4:2), sep2) .ne. "ball&stump") call abort ()
1324 + if (len (join (words2(2:4:2), sep2)) .ne. 10) call abort ()
1327 +! { dg-final { cleanup-modules "util_mod" } }
1328 Index: gcc/testsuite/gfortran.dg/array_reference_1.f90
1329 ===================================================================
1330 --- gcc/testsuite/gfortran.dg/array_reference_1.f90 (.../tags/gcc_4_2_0_release) (revision 0)
1331 +++ gcc/testsuite/gfortran.dg/array_reference_1.f90 (.../branches/gcc-4_2-branch) (revision 125292)
1334 +! Tests the fix for PR31994, aka 31867, in which the offset
1335 +! of 'a' in both subroutines was being evaluated incorrectly.
1336 +! The testcase for PR31867 is char_length_5.f90
1338 +! Contributed by Elizabeth Yip <elizabeth.l.yip@boeing.com>
1339 +! and Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
1343 + call PR31994_comment6
1345 + subroutine PR31994
1347 + complex (kind=4), dimension(2,2) :: a, b, c
1352 + b=conjg (transpose (a))
1355 + if (any (b .ne. c)) call abort ()
1356 + end subroutine PR31994
1357 + subroutine PR31994_comment6
1359 + real ,dimension(2,2)::a
1360 + integer ,dimension(2,2) :: b, c
1361 + a = reshape ((/1.,2.,3.,4./), (/2,2/))
1362 + b=int (transpose(a))
1365 + if (any (b .ne. c)) call abort ()
1366 + end subroutine PR31994_comment6
1368 Index: gcc/testsuite/gfortran.dg/reshape_transpose_1.f90
1369 ===================================================================
1370 --- gcc/testsuite/gfortran.dg/reshape_transpose_1.f90 (.../tags/gcc_4_2_0_release) (revision 0)
1371 +++ gcc/testsuite/gfortran.dg/reshape_transpose_1.f90 (.../branches/gcc-4_2-branch) (revision 125292)
1374 +! PR 31196 - reshape of transposed derived types generated
1381 + character (len=20) line1, line2
1382 + TYPE(datatype), dimension(2,2) :: data, result
1387 + write (unit=line1, fmt="(4I4)") reshape(transpose(data),shape(data))
1388 + write (unit=line2, fmt="(4I4)") (/ 1, 3, 2, 4 /)
1389 + if (line1 /= line2) call abort
1391 Index: gcc/testsuite/gfortran.dg/fmt_colon.f90
1392 ===================================================================
1393 --- gcc/testsuite/gfortran.dg/fmt_colon.f90 (.../tags/gcc_4_2_0_release) (revision 0)
1394 +++ gcc/testsuite/gfortran.dg/fmt_colon.f90 (.../branches/gcc-4_2-branch) (revision 125292)
1397 +! PR31395 Colon edit descriptor is ignored.
1398 +! Test case derived from PR. Prepared by Jerry DeLisle
1399 +! <jvdelisle@gcc.gnu.org>
1402 + character(30) :: astring
1403 + WRITE(astring, 10) i
1404 + 10 FORMAT('i =',I2:' this should not print')
1405 + if (astring.ne."i = 1") call abort
1406 + write(astring, 20) i, i
1407 + 20 format('i =',I2:' this should print',I2)
1408 + if (astring.ne."i = 1 this should print 1") call abort
1410 \ No newline at end of file
1411 Index: gcc/testsuite/gfortran.dg/char_result_13.f90
1412 ===================================================================
1413 --- gcc/testsuite/gfortran.dg/char_result_13.f90 (.../tags/gcc_4_2_0_release) (revision 0)
1414 +++ gcc/testsuite/gfortran.dg/char_result_13.f90 (.../branches/gcc-4_2-branch) (revision 125292)
1416 +! { dg-do compile }
1417 +! tests the fix for PR31540, in which the character lengths in
1418 +! parentheses were not resolved.
1420 +! Contributed by Tobias Burnus <burnus@gcc.gnu.org>
1424 + external pfname1, pfname2
1425 + character ((136)) pfname1
1426 + character ((129+7)) pfname2
1429 Index: gcc/testsuite/gfortran.dg/altreturn_5.f90
1430 ===================================================================
1431 --- gcc/testsuite/gfortran.dg/altreturn_5.f90 (.../tags/gcc_4_2_0_release) (revision 0)
1432 +++ gcc/testsuite/gfortran.dg/altreturn_5.f90 (.../branches/gcc-4_2-branch) (revision 125292)
1435 +! Tests the fix for PR31483, in which dummy argument procedures
1436 +! produced an ICE if they had an alternate return.
1438 +! Contributed by Mathias Fröhlich <M.Froehlich@science-computing.de>
1440 + SUBROUTINE R (i, *, *)
1445 + SUBROUTINE PHLOAD (READER, i, res)
1450 + CALL READER (i, *1, *2)
1459 + call PHLOAD (R, 1, res)
1460 + if (res .ne. "one") call abort ()
1461 + CALL PHLOAD (R, 2, res)
1462 + if (res .ne. "two") call abort ()
1464 \ No newline at end of file
1465 Index: gcc/testsuite/gfortran.dg/substr_4.f
1466 ===================================================================
1467 --- gcc/testsuite/gfortran.dg/substr_4.f (.../tags/gcc_4_2_0_release) (revision 0)
1468 +++ gcc/testsuite/gfortran.dg/substr_4.f (.../branches/gcc-4_2-branch) (revision 125292)
1471 + subroutine test_lower
1473 + character(3), dimension(3) :: zsymel,zsymelr
1474 + common /xx/ zsymel, zsymelr
1475 + integer :: znsymelr
1476 + zsymel = (/ 'X', 'Y', ' ' /)
1477 + zsymelr= (/ 'X', 'Y', ' ' /)
1479 + call check_zsymel(zsymel,zsymelr,znsymelr)
1483 + subroutine check_zsymel(zsymel,zsymelr,znsymelr)
1485 + integer znsymelr, isym
1486 + character(*) zsymel(*),zsymelr(*)
1487 + character(len=80) buf
1488 + zsymel(3)(lenstr(zsymel(3))+1:)='X'
1489 + write (buf,10) (trim(zsymelr(isym)),isym=1,znsymelr)
1490 +10 format(3(a,:,','))
1491 + if (trim(buf) /= 'X,Y') call abort
1492 + end subroutine check_zsymel
1494 + function lenstr(s)
1495 + character(len=*),intent(in) :: s
1497 + if (len_trim(s) /= 0) call abort
1498 + lenstr = len_trim(s)
1499 + end function lenstr
1501 + end subroutine test_lower
1503 + subroutine test_upper
1505 + character(3), dimension(3) :: zsymel,zsymelr
1506 + common /xx/ zsymel, zsymelr
1507 + integer :: znsymelr
1508 + zsymel = (/ 'X', 'Y', ' ' /)
1509 + zsymelr= (/ 'X', 'Y', ' ' /)
1511 + call check_zsymel(zsymel,zsymelr,znsymelr)
1515 + subroutine check_zsymel(zsymel,zsymelr,znsymelr)
1517 + integer znsymelr, isym
1518 + character(*) zsymel(*),zsymelr(*)
1519 + character(len=80) buf
1520 + zsymel(3)(:lenstr(zsymel(3))+1)='X'
1521 + write (buf,20) (trim(zsymelr(isym)),isym=1,znsymelr)
1522 +20 format(3(a,:,','))
1523 + if (trim(buf) /= 'X,Y') call abort
1524 + end subroutine check_zsymel
1526 + function lenstr(s)
1527 + character(len=*),intent(in) :: s
1529 + if (len_trim(s) /= 0) call abort
1530 + lenstr = len_trim(s)
1531 + end function lenstr
1533 + end subroutine test_upper
1539 Index: gcc/testsuite/gfortran.dg/fmt_t_3.f90
1540 ===================================================================
1541 --- gcc/testsuite/gfortran.dg/fmt_t_3.f90 (.../tags/gcc_4_2_0_release) (revision 0)
1542 +++ gcc/testsuite/gfortran.dg/fmt_t_3.f90 (.../branches/gcc-4_2-branch) (revision 125292)
1545 +! PR31051 bug with x and t format descriptors.
1546 +! Test case prepared by Jerry DeLisle <jvdelisle@gcc.gnu.org> from PR.
1548 + integer, parameter :: n = 9
1549 + character(len=40) :: fmt
1550 + character(len=2), dimension(n) :: y
1551 + open(unit=10, status="scratch")
1553 + fmt = '(a,1x,(t7, 3a))'
1554 + write(10, fmt) 'xxxx', (y(i), i = 1,n)
1556 + read(10, '(a)') fmt
1557 + if (fmt.ne."xxxx a a a") call abort()
1559 Index: gcc/testsuite/gfortran.dg/backspace_8.f
1560 ===================================================================
1561 --- gcc/testsuite/gfortran.dg/backspace_8.f (.../tags/gcc_4_2_0_release) (revision 0)
1562 +++ gcc/testsuite/gfortran.dg/backspace_8.f (.../branches/gcc-4_2-branch) (revision 125292)
1565 +C PR libfortran/31618 - backspace after an error didn't work.
1568 + open (21, file="backspace_7.dat", form="unformatted")
1570 + write (21) 4711, 4712
1574 + read (21,err=100,end=100) i,j,k
1579 + if (i .ne. 4711 .or. j .ne. 4712) call abort
1580 + close (21,status="delete")
1582 Index: gcc/testsuite/gfortran.dg/func_assign.f90
1583 ===================================================================
1584 --- gcc/testsuite/gfortran.dg/func_assign.f90 (.../tags/gcc_4_2_0_release) (revision 0)
1585 +++ gcc/testsuite/gfortran.dg/func_assign.f90 (.../branches/gcc-4_2-branch) (revision 125292)
1587 +! { dg-do compile }
1590 +! Do not allow assigning to external functions
1592 +! Contributed by Steve Kargl <sgk@troutmask.apl.washington.edu>
1597 + integer function bar()
1606 + function funget(a)
1610 + end subroutine sub
1612 + sub = 'a' ! { dg-error "Expected VARIABLE" }
1613 + fun = 4.4 ! { dg-error "Expected VARIABLE" }
1614 + funget = 4 ! { dg-error "is not a VALUE" }
1615 + bar = 5 ! { dg-error "is not a VALUE" }
1620 Index: gcc/testsuite/gfortran.dg/unf_io_convert_3.f90
1621 ===================================================================
1622 --- gcc/testsuite/gfortran.dg/unf_io_convert_3.f90 (.../tags/gcc_4_2_0_release) (revision 125292)
1623 +++ gcc/testsuite/gfortran.dg/unf_io_convert_3.f90 (.../branches/gcc-4_2-branch) (revision 125292)
1627 ! { dg-require-effective-target fortran_large_real }
1629 integer,parameter :: k = selected_real_kind (precision (0.0_8) + 1)
1630 Index: gcc/fortran/trans-expr.c
1631 ===================================================================
1632 --- gcc/fortran/trans-expr.c (.../tags/gcc_4_2_0_release) (revision 125292)
1633 +++ gcc/fortran/trans-expr.c (.../branches/gcc-4_2-branch) (revision 125292)
1634 @@ -255,6 +255,10 @@
1635 gfc_conv_string_parameter (se);
1638 + /* Avoid multiple evaluation of substring start. */
1639 + if (!CONSTANT_CLASS_P (start.expr) && !DECL_P (start.expr))
1640 + start.expr = gfc_evaluate_now (start.expr, &se->pre);
1642 /* Change the start of the string. */
1643 if (TYPE_STRING_FLAG (TREE_TYPE (se->expr)))
1645 @@ -273,6 +277,10 @@
1646 gfc_conv_expr_type (&end, ref->u.ss.end, gfc_charlen_type_node);
1647 gfc_add_block_to_block (&se->pre, &end.pre);
1650 + if (!CONSTANT_CLASS_P (end.expr) && !DECL_P (end.expr))
1651 + end.expr = gfc_evaluate_now (end.expr, &se->pre);
1653 tmp = fold_build2 (MINUS_EXPR, gfc_charlen_type_node,
1654 build_int_cst (gfc_charlen_type_node, 1),
1656 @@ -2340,17 +2348,23 @@
1658 /* Generate the actual call. */
1659 gfc_conv_function_val (se, sym);
1661 /* If there are alternate return labels, function type should be
1662 integer. Can't modify the type in place though, since it can be shared
1663 - with other functions. */
1664 + with other functions. For dummy arguments, the typing is done to
1665 + to this result, even if it has to be repeated for each call. */
1666 if (has_alternate_specifier
1667 && TREE_TYPE (TREE_TYPE (TREE_TYPE (se->expr))) != integer_type_node)
1669 - gcc_assert (! sym->attr.dummy);
1670 - TREE_TYPE (sym->backend_decl)
1671 - = build_function_type (integer_type_node,
1672 - TYPE_ARG_TYPES (TREE_TYPE (sym->backend_decl)));
1673 - se->expr = build_fold_addr_expr (sym->backend_decl);
1674 + if (!sym->attr.dummy)
1676 + TREE_TYPE (sym->backend_decl)
1677 + = build_function_type (integer_type_node,
1678 + TYPE_ARG_TYPES (TREE_TYPE (sym->backend_decl)));
1679 + se->expr = build_fold_addr_expr (sym->backend_decl);
1682 + TREE_TYPE (TREE_TYPE (TREE_TYPE (se->expr))) = integer_type_node;
1685 fntype = TREE_TYPE (TREE_TYPE (se->expr));
1686 Index: gcc/fortran/trans-array.c
1687 ===================================================================
1688 --- gcc/fortran/trans-array.c (.../tags/gcc_4_2_0_release) (revision 125292)
1689 +++ gcc/fortran/trans-array.c (.../branches/gcc-4_2-branch) (revision 125292)
1690 @@ -4422,6 +4422,8 @@
1692 if (se->direct_byref)
1693 base = gfc_index_zero_node;
1694 + else if (GFC_ARRAY_TYPE_P (TREE_TYPE (desc)))
1695 + base = gfc_evaluate_now (gfc_conv_array_offset (desc), &loop.pre);
1699 @@ -4489,8 +4491,20 @@
1700 stride, info->stride[dim]);
1702 if (se->direct_byref)
1703 - base = fold_build2 (MINUS_EXPR, TREE_TYPE (base),
1706 + base = fold_build2 (MINUS_EXPR, TREE_TYPE (base),
1709 + else if (GFC_ARRAY_TYPE_P (TREE_TYPE (desc)))
1711 + tmp = gfc_conv_array_lbound (desc, n);
1712 + tmp = fold_build2 (MINUS_EXPR, TREE_TYPE (base),
1713 + tmp, loop.from[dim]);
1714 + tmp = fold_build2 (MULT_EXPR, TREE_TYPE (base),
1715 + tmp, gfc_conv_array_stride (desc, n));
1716 + base = fold_build2 (PLUS_EXPR, TREE_TYPE (base),
1720 /* Store the new stride. */
1721 tmp = gfc_conv_descriptor_stride (parm, gfc_rank_cst[dim]);
1722 @@ -4511,7 +4525,8 @@
1723 gfc_conv_descriptor_data_set (&loop.pre, parm, offset);
1726 - if (se->direct_byref && !se->data_not_needed)
1727 + if ((se->direct_byref || GFC_ARRAY_TYPE_P (TREE_TYPE (desc)))
1728 + && !se->data_not_needed)
1730 /* Set the offset. */
1731 tmp = gfc_conv_descriptor_offset (parm);
1732 Index: gcc/fortran/gfortran.texi
1733 ===================================================================
1734 --- gcc/fortran/gfortran.texi (.../tags/gcc_4_2_0_release) (revision 125292)
1735 +++ gcc/fortran/gfortran.texi (.../branches/gcc-4_2-branch) (revision 125292)
1737 to change the representation of data for unformatted files.
1738 The syntax for the @env{GFORTRAN_CONVERT_UNIT} variable is:
1740 -GFORTRAN_CONVERT_UNIT: mode | mode ';' exception ;
1741 +GFORTRAN_CONVERT_UNIT: mode | mode ';' exception | exception ;
1742 mode: 'native' | 'swap' | 'big_endian' | 'little_endian' ;
1743 exception: mode ':' unit_list | unit_list ;
1744 unit_list: unit_spec | unit_list unit_spec ;
1745 @@ -668,7 +668,12 @@
1746 setting a default data representation for the whole program. The
1747 @code{CONVERT} specifier overrides the @option{-fconvert} compile options.
1749 +@emph{Note that the values specified via the GFORTRAN_CONVERT_UNIT
1750 +environment variable will override the CONVERT specifier in the
1751 +open statement}. This is to give control over data formats to
1752 +users who do not have the source code of their program available.
1755 @c =====================================================================
1756 @c PART II: LANGUAGE REFERENCE
1757 @c =====================================================================
1758 Index: gcc/fortran/ChangeLog
1759 ===================================================================
1760 --- gcc/fortran/ChangeLog (.../tags/gcc_4_2_0_release) (revision 125292)
1761 +++ gcc/fortran/ChangeLog (.../branches/gcc-4_2-branch) (revision 125292)
1763 +2007-05-31 Paul Thomas <pault@gcc.gnu.org>
1766 + * trans-expr.c (gfc_conv_function_call): Give a dummy
1767 + procedure the correct type if it has alternate returns.
1771 + * resolve.c (resolve_fl_procedure): Resolve constant character
1776 + * trans-array.c (gfc_conv_expr_descriptor): Obtain the stored
1777 + offset for non-descriptor, source arrays and correct for stride
1778 + not equal to one before writing to field of output descriptor.
1780 +2007-05-17 Tobias Burnus <burnus@net-b.de>
1782 + * gfortran.texi (GFORTRAN_CONVERT_UNIT): Improve documentation.
1784 +2007-05-16 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
1787 + * trans-expr.c (gfc_conv_substring): Evaluate substring bounds
1790 2007-05-13 Release Manager
1792 * GCC 4.2.0 released.
1793 Index: gcc/fortran/resolve.c
1794 ===================================================================
1795 --- gcc/fortran/resolve.c (.../tags/gcc_4_2_0_release) (revision 125292)
1796 +++ gcc/fortran/resolve.c (.../branches/gcc-4_2-branch) (revision 125292)
1797 @@ -5742,6 +5742,11 @@
1798 if (sym->ts.type == BT_CHARACTER)
1800 gfc_charlen *cl = sym->ts.cl;
1802 + if (cl && cl->length && gfc_is_constant_expr (cl->length)
1803 + && resolve_charlen (cl) == FAILURE)
1806 if (!cl || !cl->length || cl->length->expr_type != EXPR_CONSTANT)
1808 if (sym->attr.proc == PROC_ST_FUNCTION)
1809 Index: gcc/fortran/primary.c
1810 ===================================================================
1811 --- gcc/fortran/primary.c (.../tags/gcc_4_2_0_release) (revision 125292)
1812 +++ gcc/fortran/primary.c (.../branches/gcc-4_2-branch) (revision 125292)
1813 @@ -2415,7 +2415,8 @@
1816 /* Check for a nonrecursive function result */
1817 - if (sym->attr.function && (sym->result == sym || sym->attr.entry))
1818 + if (sym->attr.function && (sym->result == sym || sym->attr.entry)
1819 + && !sym->attr.external)
1821 /* If a function result is a derived type, then the derived
1822 type may still have to be resolved. */
1824 ===================================================================
1825 --- gcc/BASE-VER (.../tags/gcc_4_2_0_release) (revision 125292)
1826 +++ gcc/BASE-VER (.../branches/gcc-4_2-branch) (revision 125292)
1831 ===================================================================
1832 --- gcc/except.c (.../tags/gcc_4_2_0_release) (revision 125292)
1833 +++ gcc/except.c (.../branches/gcc-4_2-branch) (revision 125292)
1834 @@ -1005,7 +1005,11 @@
1835 for (prev_try = VEC_index (eh_region, cfun->eh->region_array, outer_region);
1836 prev_try && prev_try->type != ERT_TRY;
1837 prev_try = prev_try->outer)
1839 + if (prev_try->type == ERT_MUST_NOT_THROW)
1845 /* Remap all of the internal catch and cleanup linkages. Since we
1846 duplicate entire subtrees, all of the referenced regions will have
1847 Index: gcc/combine.c
1848 ===================================================================
1849 --- gcc/combine.c (.../tags/gcc_4_2_0_release) (revision 125292)
1850 +++ gcc/combine.c (.../branches/gcc-4_2-branch) (revision 125292)
1851 @@ -5341,14 +5341,14 @@
1853 else if (GET_MODE (op0) == compare_mode && op1 == const0_rtx)
1855 - SUBST(SET_SRC (x), op0);
1856 + SUBST (SET_SRC (x), op0);
1860 + /* Otherwise, update the COMPARE if needed. */
1861 + else if (XEXP (src, 0) != op0 || XEXP (src, 1) != op1)
1863 - /* Otherwise, update the COMPARE if needed. */
1864 - SUBST (XEXP (src, 0), op0);
1865 - SUBST (XEXP (src, 1), op1);
1866 + SUBST (SET_SRC (x), gen_rtx_COMPARE (compare_mode, op0, op1));
1867 + src = SET_SRC (x);
1871 Index: gcc/Makefile.in
1872 ===================================================================
1873 --- gcc/Makefile.in (.../tags/gcc_4_2_0_release) (revision 125292)
1874 +++ gcc/Makefile.in (.../branches/gcc-4_2-branch) (revision 125292)
1875 @@ -1839,7 +1839,7 @@
1876 tree-ssa-structalias.o: tree-ssa-structalias.c tree-ssa-structalias.h \
1877 $(SYSTEM_H) $(CONFIG_H) $(GGC_H) $(TREE_H) $(TREE_FLOW_H) \
1878 $(TM_H) coretypes.h $(CGRAPH_H) tree-pass.h $(TIMEVAR_H) \
1879 - gt-tree-ssa-structalias.h $(PARAMS_H)
1880 + gt-tree-ssa-structalias.h $(PARAMS_H) pointer-set.h
1881 tree-ssa.o : tree-ssa.c $(TREE_FLOW_H) $(CONFIG_H) $(SYSTEM_H) \
1882 $(RTL_H) $(TREE_H) $(TM_P_H) $(EXPR_H) output.h $(DIAGNOSTIC_H) \
1883 toplev.h $(FUNCTION_H) $(TIMEVAR_H) $(TM_H) coretypes.h \
1884 Index: gcc/tree-ssa-structalias.c
1885 ===================================================================
1886 --- gcc/tree-ssa-structalias.c (.../tags/gcc_4_2_0_release) (revision 125292)
1887 +++ gcc/tree-ssa-structalias.c (.../branches/gcc-4_2-branch) (revision 125292)
1890 #include "tree-ssa-structalias.h"
1892 +#include "pointer-set.h"
1894 /* The idea behind this analyzer is to generate set constraints from the
1895 program, then solve the resulting constraints in order to generate the
1899 Set constraints are a way of modeling program analysis problems that
1900 involve sets. They consist of an inclusion constraint language,
1903 Also see "Ultra-fast Aliasing Analysis using CLA: A Million Lines
1904 of C Code in a Second" by ""Nevin Heintze and Olivier Tardieu" at
1905 - http://citeseer.ist.psu.edu/heintze01ultrafast.html
1906 + http://citeseer.ist.psu.edu/heintze01ultrafast.html
1908 - There are three types of constraint expressions, DEREF, ADDRESSOF, and
1909 - SCALAR. Each constraint expression consists of a constraint type,
1910 - a variable, and an offset.
1912 + There are three types of real constraint expressions, DEREF,
1913 + ADDRESSOF, and SCALAR. Each constraint expression consists
1914 + of a constraint type, a variable, and an offset.
1916 SCALAR is a constraint expression type used to represent x, whether
1917 it appears on the LHS or the RHS of a statement.
1918 DEREF is a constraint expression type used to represent *x, whether
1919 - it appears on the LHS or the RHS of a statement.
1920 + it appears on the LHS or the RHS of a statement.
1921 ADDRESSOF is a constraint expression used to represent &x, whether
1922 it appears on the LHS or the RHS of a statement.
1925 Each pointer variable in the program is assigned an integer id, and
1926 each field of a structure variable is assigned an integer id as well.
1929 Structure variables are linked to their list of fields through a "next
1930 field" in each variable that points to the next field in offset
1932 - Each variable for a structure field has
1934 + Each variable for a structure field has
1936 1. "size", that tells the size in bits of that field.
1937 2. "fullsize, that tells the size in bits of the entire structure.
1938 3. "offset", that tells the offset in bits from the beginning of the
1939 structure to this field.
1946 @@ -110,50 +111,51 @@
1947 foo.b -> id 2, size 32, offset 32, fullsize 64, next NULL
1948 bar -> id 3, size 32, offset 0, fullsize 32, next NULL
1952 In order to solve the system of set constraints, the following is
1955 1. Each constraint variable x has a solution set associated with it,
1959 2. Constraints are separated into direct, copy, and complex.
1960 Direct constraints are ADDRESSOF constraints that require no extra
1961 processing, such as P = &Q
1962 Copy constraints are those of the form P = Q.
1963 - Complex constraints are all the constraints involving dereferences.
1965 + Complex constraints are all the constraints involving dereferences
1966 + and offsets (including offsetted copies).
1968 3. All direct constraints of the form P = &Q are processed, such
1969 - that Q is added to Sol(P)
1970 + that Q is added to Sol(P)
1972 4. All complex constraints for a given constraint variable are stored in a
1973 - linked list attached to that variable's node.
1974 + linked list attached to that variable's node.
1976 5. A directed graph is built out of the copy constraints. Each
1977 - constraint variable is a node in the graph, and an edge from
1978 + constraint variable is a node in the graph, and an edge from
1979 Q to P is added for each copy constraint of the form P = Q
1982 6. The graph is then walked, and solution sets are
1983 propagated along the copy edges, such that an edge from Q to P
1984 causes Sol(P) <- Sol(P) union Sol(Q).
1987 7. As we visit each node, all complex constraints associated with
1988 that node are processed by adding appropriate copy edges to the graph, or the
1989 - appropriate variables to the solution set.
1990 + appropriate variables to the solution set.
1992 8. The process of walking the graph is iterated until no solution
1995 Prior to walking the graph in steps 6 and 7, We perform static
1996 - cycle elimination on the constraint graph, as well
1997 + cycle elimination on the constraint graph, as well
1998 as off-line variable substitution.
2001 TODO: Adding offsets to pointer-to-structures can be handled (IE not punted
2002 on and turned into anything), but isn't. You can just see what offset
2003 inside the pointed-to struct it's going to access.
2006 TODO: Constant bounded arrays can be handled as if they were structs of the
2007 - same number of elements.
2008 + same number of elements.
2010 TODO: Modeling heap and incoming pointers becomes much better if we
2011 add fields to them as we discover them, which we could do.
2012 @@ -161,20 +163,29 @@
2013 TODO: We could handle unions, but to be honest, it's probably not
2014 worth the pain or slowdown. */
2016 -static GTY ((if_marked ("tree_map_marked_p"), param_is (struct tree_map)))
2017 -htab_t heapvar_for_stmt;
2018 +static GTY ((if_marked ("tree_map_marked_p"), param_is (struct tree_map))) htab_t heapvar_for_stmt;
2020 /* One variable to represent all non-local accesses. */
2023 static bool use_field_sensitive = true;
2024 static int in_ipa_mode = 0;
2026 +/* Used for predecessor bitmaps. */
2027 static bitmap_obstack predbitmap_obstack;
2028 -static bitmap_obstack ptabitmap_obstack;
2030 +/* Used for points-to sets. */
2031 +static bitmap_obstack pta_obstack;
2033 +/* Used for oldsolution members of variables. */
2034 +static bitmap_obstack oldpta_obstack;
2036 +/* Used for per-solver-iteration bitmaps. */
2037 static bitmap_obstack iteration_obstack;
2039 static unsigned int create_variable_info_for (tree, const char *);
2040 -static void build_constraint_graph (void);
2041 +typedef struct constraint_graph *constraint_graph_t;
2042 +static void unify_nodes (constraint_graph_t, unsigned int, unsigned int, bool);
2044 DEF_VEC_P(constraint_t);
2045 DEF_VEC_ALLOC_P(constraint_t,heap);
2046 @@ -186,11 +197,13 @@
2047 static struct constraint_stats
2049 unsigned int total_vars;
2050 - unsigned int collapsed_vars;
2051 + unsigned int nonpointer_vars;
2052 unsigned int unified_vars_static;
2053 unsigned int unified_vars_dynamic;
2054 unsigned int iterations;
2055 unsigned int num_edges;
2056 + unsigned int num_implicit_edges;
2057 + unsigned int points_to_sets_created;
2060 struct variable_info
2064 /* Offset of this variable, in bits, from the base variable */
2065 - unsigned HOST_WIDE_INT offset;
2066 + unsigned HOST_WIDE_INT offset;
2068 /* Size of the variable, in bits. */
2069 unsigned HOST_WIDE_INT size;
2070 @@ -216,34 +229,21 @@
2071 /* A link to the variable for the next field in this structure. */
2072 struct variable_info *next;
2074 - /* Node in the graph that represents the constraints and points-to
2075 - solution for the variable. */
2076 - unsigned int node;
2078 - /* True if the address of this variable is taken. Needed for
2079 - variable substitution. */
2080 - unsigned int address_taken:1;
2082 - /* True if this variable is the target of a dereference. Needed for
2083 - variable substitution. */
2084 - unsigned int indirect_target:1;
2086 /* True if the variable is directly the target of a dereference.
2087 This is used to track which variables are *actually* dereferenced
2088 - so we can prune their points to listed. This is equivalent to the
2089 - indirect_target flag when no merging of variables happens. */
2090 + so we can prune their points to listed. */
2091 unsigned int directly_dereferenced:1;
2093 /* True if this is a variable created by the constraint analysis, such as
2094 heap variables and constraints we had to break up. */
2095 unsigned int is_artificial_var:1;
2098 /* True if this is a special variable whose solution set should not be
2100 unsigned int is_special_var:1;
2102 /* True for variables whose size is not known or variable. */
2103 - unsigned int is_unknown_size_var:1;
2104 + unsigned int is_unknown_size_var:1;
2106 /* True for variables that have unions somewhere in them. */
2107 unsigned int has_union:1;
2108 @@ -254,16 +254,15 @@
2109 /* Points-to set for this variable. */
2112 + /* Old points-to set for this variable. */
2113 + bitmap oldsolution;
2115 /* Variable ids represented by this node. */
2118 - /* Vector of complex constraints for this node. Complex
2119 - constraints are those involving dereferences. */
2120 - VEC(constraint_t,heap) *complex;
2122 - /* Variable id this was collapsed to due to type unsafety.
2123 - This should be unused completely after build_constraint_graph, or
2124 - something is broken. */
2125 + /* Variable id this was collapsed to due to type unsafety. This
2126 + should be unused completely after build_succ_graph, or something
2128 struct variable_info *collapsed_to;
2130 typedef struct variable_info *varinfo_t;
2133 DEF_VEC_ALLOC_P(varinfo_t, heap);
2135 -/* Table of variable info structures for constraint variables. Indexed directly
2136 - by variable info id. */
2137 +/* Table of variable info structures for constraint variables.
2138 + Indexed directly by variable info id. */
2139 static VEC(varinfo_t,heap) *varmap;
2141 /* Return the varmap element N */
2143 static inline varinfo_t
2144 get_varinfo (unsigned int n)
2146 - return VEC_index(varinfo_t, varmap, n);
2147 + return VEC_index (varinfo_t, varmap, n);
2150 /* Return the varmap element N, following the collapsed_to link. */
2152 static inline varinfo_t
2153 get_varinfo_fc (unsigned int n)
2155 - varinfo_t v = VEC_index(varinfo_t, varmap, n);
2156 + varinfo_t v = VEC_index (varinfo_t, varmap, n);
2158 if (v->collapsed_to)
2159 return v->collapsed_to;
2160 @@ -331,10 +330,9 @@
2161 /* Variable that represents non-local variables before we expand it to
2162 one for each type. */
2163 static unsigned int nonlocal_vars_id;
2165 /* Lookup a heap var for FROM, and return it if we find one. */
2169 heapvar_lookup (tree from)
2171 struct tree_map *h, in;
2172 @@ -367,25 +365,21 @@
2173 named NAME, and using constraint graph node NODE. */
2176 -new_var_info (tree t, unsigned int id, const char *name, unsigned int node)
2177 +new_var_info (tree t, unsigned int id, const char *name)
2179 varinfo_t ret = pool_alloc (variable_info_pool);
2185 - ret->address_taken = false;
2186 - ret->indirect_target = false;
2187 ret->directly_dereferenced = false;
2188 ret->is_artificial_var = false;
2189 ret->is_heap_var = false;
2190 ret->is_special_var = false;
2191 ret->is_unknown_size_var = false;
2192 ret->has_union = false;
2193 - ret->solution = BITMAP_ALLOC (&ptabitmap_obstack);
2194 - ret->variables = BITMAP_ALLOC (&ptabitmap_obstack);
2195 - ret->complex = NULL;
2196 + ret->solution = BITMAP_ALLOC (&pta_obstack);
2197 + ret->oldsolution = BITMAP_ALLOC (&oldpta_obstack);
2199 ret->collapsed_to = NULL;
2203 /* An expression that appears in a constraint. */
2205 -struct constraint_expr
2206 +struct constraint_expr
2208 /* Constraint type. */
2209 constraint_expr_type type;
2211 static void do_deref (VEC (ce_s, heap) **);
2213 /* Our set constraints are made up of two constraint expressions, one
2217 As described in the introduction, our set constraints each represent an
2218 operation between set valued variables.
2219 @@ -434,63 +428,98 @@
2220 static VEC(constraint_t,heap) *constraints;
2221 static alloc_pool constraint_pool;
2223 -/* An edge in the weighted constraint graph. The edges are weighted,
2224 - with a bit set in weights meaning their is an edge with that
2226 - We don't keep the src in the edge, because we always know what it
2229 -struct constraint_edge
2231 +DEF_VEC_ALLOC_I(int, heap);
2233 +/* The constraint graph is represented as an array of bitmaps
2234 + containing successor nodes. */
2236 +struct constraint_graph
2238 - unsigned int dest;
2241 + /* Size of this graph, which may be different than the number of
2242 + nodes in the variable map. */
2243 + unsigned int size;
2245 -typedef struct constraint_edge *constraint_edge_t;
2246 -static alloc_pool constraint_edge_pool;
2247 + /* Explicit successors of each node. */
2250 -/* Return a new constraint edge from SRC to DEST. */
2251 + /* Implicit predecessors of each node (Used for variable
2253 + bitmap *implicit_preds;
2255 -static constraint_edge_t
2256 -new_constraint_edge (unsigned int dest)
2258 - constraint_edge_t ret = pool_alloc (constraint_edge_pool);
2260 - ret->weights = NULL;
2263 + /* Explicit predecessors of each node (Used for variable substitution). */
2266 -DEF_VEC_P(constraint_edge_t);
2267 -DEF_VEC_ALLOC_P(constraint_edge_t,heap);
2268 + /* Indirect cycle representatives, or -1 if the node has no indirect
2270 + int *indirect_cycles;
2272 + /* Representative node for a node. rep[a] == a unless the node has
2274 + unsigned int *rep;
2276 -/* The constraint graph is represented internally in two different
2277 - ways. The overwhelming majority of edges in the constraint graph
2278 - are zero weigh edges, and thus, using a vector of contrainst_edge_t
2279 - is a waste of time and memory, since they have no weights. We
2280 - simply use a bitmap to store the preds and succs for each node.
2281 - The weighted edges are stored as a set of adjacency vectors, one
2282 - per variable. succs[x] is the vector of successors for variable x,
2283 - and preds[x] is the vector of predecessors for variable x. IOW,
2284 - all edges are "forward" edges, which is not like our CFG. So
2285 - remember that preds[x]->src == x, and succs[x]->src == x. */
2286 + /* Equivalence class representative for a node. This is used for
2287 + variable substitution. */
2290 -struct constraint_graph
2292 - bitmap *zero_weight_succs;
2293 - bitmap *zero_weight_preds;
2294 - VEC(constraint_edge_t,heap) **succs;
2295 - VEC(constraint_edge_t,heap) **preds;
2296 + /* Label for each node, used during variable substitution. */
2297 + unsigned int *label;
2299 + /* Bitmap of nodes where the bit is set if the node is a direct
2300 + node. Used for variable substitution. */
2301 + sbitmap direct_nodes;
2303 + /* Vector of complex constraints for each graph node. Complex
2304 + constraints are those involving dereferences or offsets that are
2306 + VEC(constraint_t,heap) **complex;
2309 -typedef struct constraint_graph *constraint_graph_t;
2311 static constraint_graph_t graph;
2312 -static int graph_size;
2314 +/* During variable substitution and the offline version of indirect
2315 + cycle finding, we create nodes to represent dereferences and
2316 + address taken constraints. These represent where these start and
2318 +#define FIRST_REF_NODE (VEC_length (varinfo_t, varmap))
2319 +#define LAST_REF_NODE (FIRST_REF_NODE + (FIRST_REF_NODE - 1))
2320 +#define FIRST_ADDR_NODE (LAST_REF_NODE + 1)
2322 +/* Return the representative node for NODE, if NODE has been unioned
2323 + with another NODE.
2324 + This function performs path compression along the way to finding
2325 + the representative. */
2327 +static unsigned int
2328 +find (unsigned int node)
2330 + gcc_assert (node < graph->size);
2331 + if (graph->rep[node] != node)
2332 + return graph->rep[node] = find (graph->rep[node]);
2336 +/* Union the TO and FROM nodes to the TO nodes.
2337 + Note that at some point in the future, we may want to do
2338 + union-by-rank, in which case we are going to have to return the
2339 + node we unified to. */
2342 +unite (unsigned int to, unsigned int from)
2344 + gcc_assert (to < graph->size && from < graph->size);
2345 + if (to != from && graph->rep[from] != to)
2347 + graph->rep[from] = to;
2353 /* Create a new constraint consisting of LHS and RHS expressions. */
2355 -static constraint_t
2356 +static constraint_t
2357 new_constraint (const struct constraint_expr lhs,
2358 const struct constraint_expr rhs)
2361 if (c->lhs.type == ADDRESSOF)
2362 fprintf (file, "&");
2363 else if (c->lhs.type == DEREF)
2364 - fprintf (file, "*");
2365 + fprintf (file, "*");
2366 fprintf (file, "%s", get_varinfo_fc (c->lhs.var)->name);
2367 if (c->lhs.offset != 0)
2368 fprintf (file, " + " HOST_WIDE_INT_PRINT_DEC, c->lhs.offset);
2369 @@ -550,23 +579,24 @@
2370 dump_constraints (stderr);
2373 -/* SOLVER FUNCTIONS
2374 +/* SOLVER FUNCTIONS
2376 The solver is a simple worklist solver, that works on the following
2379 - sbitmap changed_nodes = all ones;
2380 - changed_count = number of nodes;
2381 - For each node that was already collapsed:
2384 + sbitmap changed_nodes = all zeroes;
2385 + changed_count = 0;
2386 + For each node that is not already collapsed:
2388 + set bit in changed nodes
2390 while (changed_count > 0)
2392 compute topological ordering for constraint graph
2395 find and collapse cycles in the constraint graph (updating
2396 changed if necessary)
2399 for each node (n) in the graph in topological order:
2402 @@ -619,11 +649,11 @@
2405 /* Return true if two constraints A and B are equal. */
2409 constraint_equal (struct constraint a, struct constraint b)
2411 - return constraint_expr_equal (a.lhs, b.lhs)
2412 + return constraint_expr_equal (a.lhs, b.lhs)
2413 && constraint_expr_equal (a.rhs, b.rhs);
2417 constraint_vec_find (VEC(constraint_t,heap) *vec,
2418 struct constraint lookfor)
2420 - unsigned int place;
2421 + unsigned int place;
2426 /* If this is a properly sized variable, only add offset if it's
2427 less than end. Otherwise, it is globbed to a single
2431 if ((get_varinfo (i)->offset + offset) < get_varinfo (i)->fullsize)
2433 unsigned HOST_WIDE_INT fieldoffset = get_varinfo (i)->offset + offset;
2434 @@ -693,15 +723,15 @@
2436 bitmap_set_bit (result, v->id);
2438 - else if (get_varinfo (i)->is_artificial_var
2439 + else if (get_varinfo (i)->is_artificial_var
2440 || get_varinfo (i)->has_union
2441 || get_varinfo (i)->is_unknown_size_var)
2443 bitmap_set_bit (result, i);
2447 - bitmap_copy (set, result);
2449 + bitmap_copy (set, result);
2450 BITMAP_FREE (result);
2453 @@ -727,397 +757,149 @@
2457 -/* Insert constraint C into the list of complex constraints for VAR. */
2458 +/* Insert constraint C into the list of complex constraints for graph
2462 -insert_into_complex (unsigned int var, constraint_t c)
2463 +insert_into_complex (constraint_graph_t graph,
2464 + unsigned int var, constraint_t c)
2466 - varinfo_t vi = get_varinfo (var);
2467 - unsigned int place = VEC_lower_bound (constraint_t, vi->complex, c,
2468 + VEC (constraint_t, heap) *complex = graph->complex[var];
2469 + unsigned int place = VEC_lower_bound (constraint_t, complex, c,
2471 - VEC_safe_insert (constraint_t, heap, vi->complex, place, c);
2475 -/* Compare two constraint edges A and B, return true if they are equal. */
2478 -constraint_edge_equal (struct constraint_edge a, struct constraint_edge b)
2480 - return a.dest == b.dest;
2481 + /* Only insert constraints that do not already exist. */
2482 + if (place >= VEC_length (constraint_t, complex)
2483 + || !constraint_equal (*c, *VEC_index (constraint_t, complex, place)))
2484 + VEC_safe_insert (constraint_t, heap, graph->complex[var], place, c);
2487 -/* Compare two constraint edges, return true if A is less than B */
2490 -constraint_edge_less (const constraint_edge_t a, const constraint_edge_t b)
2492 - if (a->dest < b->dest)
2497 -/* Find the constraint edge that matches LOOKFOR, in VEC.
2498 - Return the edge, if found, NULL otherwise. */
2500 -static constraint_edge_t
2501 -constraint_edge_vec_find (VEC(constraint_edge_t,heap) *vec,
2502 - struct constraint_edge lookfor)
2504 - unsigned int place;
2505 - constraint_edge_t edge = NULL;
2507 - place = VEC_lower_bound (constraint_edge_t, vec, &lookfor,
2508 - constraint_edge_less);
2509 - if (place >= VEC_length (constraint_edge_t, vec))
2511 - edge = VEC_index (constraint_edge_t, vec, place);
2512 - if (!constraint_edge_equal (*edge, lookfor))
2517 /* Condense two variable nodes into a single variable node, by moving
2518 all associated info from SRC to TO. */
2521 -condense_varmap_nodes (unsigned int to, unsigned int src)
2523 +merge_node_constraints (constraint_graph_t graph, unsigned int to,
2524 + unsigned int from)
2526 - varinfo_t tovi = get_varinfo (to);
2527 - varinfo_t srcvi = get_varinfo (src);
2530 - bitmap_iterator bi;
2532 - /* the src node, and all its variables, are now the to node. */
2534 - EXECUTE_IF_SET_IN_BITMAP (srcvi->variables, 0, i, bi)
2535 - get_varinfo (i)->node = to;
2537 - /* Merge the src node variables and the to node variables. */
2538 - bitmap_set_bit (tovi->variables, src);
2539 - bitmap_ior_into (tovi->variables, srcvi->variables);
2540 - bitmap_clear (srcvi->variables);
2543 + gcc_assert (find (from) == to);
2545 /* Move all complex constraints from src node into to node */
2546 - for (i = 0; VEC_iterate (constraint_t, srcvi->complex, i, c); i++)
2547 + for (i = 0; VEC_iterate (constraint_t, graph->complex[from], i, c); i++)
2549 /* In complex constraints for node src, we may have either
2550 - a = *src, and *src = a. */
2552 + a = *src, and *src = a, or an offseted constraint which are
2553 + always added to the rhs node's constraints. */
2555 if (c->rhs.type == DEREF)
2557 + else if (c->lhs.type == DEREF)
2563 - constraint_set_union (&tovi->complex, &srcvi->complex);
2564 - VEC_free (constraint_t, heap, srcvi->complex);
2565 - srcvi->complex = NULL;
2566 + constraint_set_union (&graph->complex[to], &graph->complex[from]);
2567 + VEC_free (constraint_t, heap, graph->complex[from]);
2568 + graph->complex[from] = NULL;
2571 -/* Erase an edge from SRC to SRC from GRAPH. This routine only
2572 - handles self-edges (e.g. an edge from a to a). */
2575 -erase_graph_self_edge (constraint_graph_t graph, unsigned int src)
2577 - VEC(constraint_edge_t,heap) *predvec = graph->preds[src];
2578 - VEC(constraint_edge_t,heap) *succvec = graph->succs[src];
2579 - struct constraint_edge edge;
2580 - unsigned int place;
2584 - /* Remove from the successors. */
2585 - place = VEC_lower_bound (constraint_edge_t, succvec, &edge,
2586 - constraint_edge_less);
2588 - /* Make sure we found the edge. */
2589 -#ifdef ENABLE_CHECKING
2591 - constraint_edge_t tmp = VEC_index (constraint_edge_t, succvec, place);
2592 - gcc_assert (constraint_edge_equal (*tmp, edge));
2595 - VEC_ordered_remove (constraint_edge_t, succvec, place);
2597 - /* Remove from the predecessors. */
2598 - place = VEC_lower_bound (constraint_edge_t, predvec, &edge,
2599 - constraint_edge_less);
2601 - /* Make sure we found the edge. */
2602 -#ifdef ENABLE_CHECKING
2604 - constraint_edge_t tmp = VEC_index (constraint_edge_t, predvec, place);
2605 - gcc_assert (constraint_edge_equal (*tmp, edge));
2608 - VEC_ordered_remove (constraint_edge_t, predvec, place);
2611 /* Remove edges involving NODE from GRAPH. */
2614 clear_edges_for_node (constraint_graph_t graph, unsigned int node)
2616 - VEC(constraint_edge_t,heap) *succvec = graph->succs[node];
2617 - VEC(constraint_edge_t,heap) *predvec = graph->preds[node];
2618 - bitmap_iterator bi;
2620 - constraint_edge_t c = NULL;
2623 - /* Walk the successors, erase the associated preds. */
2625 - EXECUTE_IF_IN_NONNULL_BITMAP (graph->zero_weight_succs[node], 0, j, bi)
2627 - bitmap_clear_bit (graph->zero_weight_preds[j], node);
2629 - for (i = 0; VEC_iterate (constraint_edge_t, succvec, i, c); i++)
2630 - if (c->dest != node)
2632 - unsigned int place;
2633 - struct constraint_edge lookfor;
2634 - constraint_edge_t result;
2636 - lookfor.dest = node;
2637 - place = VEC_lower_bound (constraint_edge_t, graph->preds[c->dest],
2638 - &lookfor, constraint_edge_less);
2639 - result = VEC_ordered_remove (constraint_edge_t,
2640 - graph->preds[c->dest], place);
2641 - pool_free (constraint_edge_pool, result);
2644 - /* Walk the preds, erase the associated succs. */
2646 - EXECUTE_IF_IN_NONNULL_BITMAP (graph->zero_weight_preds[node], 0, j, bi)
2648 - bitmap_clear_bit (graph->zero_weight_succs[j], node);
2650 - for (i =0; VEC_iterate (constraint_edge_t, predvec, i, c); i++)
2651 - if (c->dest != node)
2653 - unsigned int place;
2654 - struct constraint_edge lookfor;
2655 - constraint_edge_t result;
2657 - lookfor.dest = node;
2658 - place = VEC_lower_bound (constraint_edge_t, graph->succs[c->dest],
2659 - &lookfor, constraint_edge_less);
2660 - result = VEC_ordered_remove (constraint_edge_t,
2661 - graph->succs[c->dest], place);
2662 - pool_free (constraint_edge_pool, result);
2666 - if (graph->zero_weight_preds[node])
2668 - BITMAP_FREE (graph->zero_weight_preds[node]);
2669 - graph->zero_weight_preds[node] = NULL;
2672 - if (graph->zero_weight_succs[node])
2674 - BITMAP_FREE (graph->zero_weight_succs[node]);
2675 - graph->zero_weight_succs[node] = NULL;
2678 - VEC_free (constraint_edge_t, heap, graph->preds[node]);
2679 - VEC_free (constraint_edge_t, heap, graph->succs[node]);
2680 - graph->preds[node] = NULL;
2681 - graph->succs[node] = NULL;
2682 + if (graph->succs[node])
2683 + BITMAP_FREE (graph->succs[node]);
2686 -static bool edge_added = false;
2688 -/* Add edge (src, dest) to the graph. */
2691 -add_graph_edge (constraint_graph_t graph, unsigned int src, unsigned int dest)
2693 - unsigned int place;
2694 - VEC(constraint_edge_t,heap) *vec;
2695 - struct constraint_edge newe;
2698 - vec = graph->preds[src];
2699 - place = VEC_lower_bound (constraint_edge_t, vec, &newe,
2700 - constraint_edge_less);
2701 - if (place == VEC_length (constraint_edge_t, vec)
2702 - || VEC_index (constraint_edge_t, vec, place)->dest != dest)
2704 - constraint_edge_t edge = new_constraint_edge (dest);
2706 - VEC_safe_insert (constraint_edge_t, heap, graph->preds[src],
2708 - edge = new_constraint_edge (src);
2710 - place = VEC_lower_bound (constraint_edge_t, graph->succs[dest],
2711 - edge, constraint_edge_less);
2712 - VEC_safe_insert (constraint_edge_t, heap, graph->succs[dest],
2714 - edge_added = true;
2715 - stats.num_edges++;
2723 -/* Return the bitmap representing the weights of edge (SRC, DEST). */
2726 -get_graph_weights (constraint_graph_t graph, unsigned int src,
2727 - unsigned int dest)
2729 - constraint_edge_t edge;
2730 - VEC(constraint_edge_t,heap) *vec;
2731 - struct constraint_edge lookfor;
2733 - lookfor.dest = dest;
2735 - vec = graph->preds[src];
2736 - edge = constraint_edge_vec_find (vec, lookfor);
2737 - gcc_assert (edge != NULL);
2738 - return &edge->weights;
2741 -/* Allocate graph weight bitmap for the edges associated with SRC and
2742 - DEST in GRAPH. Both the pred and the succ edges share a single
2743 - bitmap, so we need to set both edges to that bitmap. */
2746 -allocate_graph_weights (constraint_graph_t graph, unsigned int src,
2747 - unsigned int dest)
2750 - constraint_edge_t edge;
2751 - VEC(constraint_edge_t,heap) *vec;
2752 - struct constraint_edge lookfor;
2754 - result = BITMAP_ALLOC (&ptabitmap_obstack);
2756 - /* Set the pred weight. */
2757 - lookfor.dest = dest;
2758 - vec = graph->preds[src];
2759 - edge = constraint_edge_vec_find (vec, lookfor);
2760 - gcc_assert (edge != NULL);
2761 - edge->weights = result;
2763 - /* Set the succ weight. */
2764 - lookfor.dest = src;
2765 - vec = graph->succs[dest];
2766 - edge = constraint_edge_vec_find (vec, lookfor);
2767 - gcc_assert (edge != NULL);
2768 - edge->weights = result;
2774 /* Merge GRAPH nodes FROM and TO into node TO. */
2777 -merge_graph_nodes (constraint_graph_t graph, unsigned int to,
2778 +merge_graph_nodes (constraint_graph_t graph, unsigned int to,
2781 - VEC(constraint_edge_t,heap) *succvec = graph->succs[from];
2782 - VEC(constraint_edge_t,heap) *predvec = graph->preds[from];
2784 - constraint_edge_t c;
2786 - bitmap_iterator bi;
2788 - /* Merge all the zero weighted predecessor edges. */
2789 - if (graph->zero_weight_preds[from])
2790 + if (graph->indirect_cycles[from] != -1)
2792 - if (!graph->zero_weight_preds[to])
2793 - graph->zero_weight_preds[to] = BITMAP_ALLOC (&predbitmap_obstack);
2795 - EXECUTE_IF_SET_IN_BITMAP (graph->zero_weight_preds[from], 0, j, bi)
2796 + /* If we have indirect cycles with the from node, and we have
2797 + none on the to node, the to node has indirect cycles from the
2798 + from node now that they are unified.
2799 + If indirect cycles exist on both, unify the nodes that they
2800 + are in a cycle with, since we know they are in a cycle with
2802 + if (graph->indirect_cycles[to] == -1)
2806 - bitmap_clear_bit (graph->zero_weight_succs[j], from);
2807 - bitmap_set_bit (graph->zero_weight_succs[j], to);
2809 + graph->indirect_cycles[to] = graph->indirect_cycles[from];
2811 - bitmap_ior_into (graph->zero_weight_preds[to],
2812 - graph->zero_weight_preds[from]);
2816 + unsigned int tonode = find (graph->indirect_cycles[to]);
2817 + unsigned int fromnode = find (graph->indirect_cycles[from]);
2819 - /* Merge all the zero weighted successor edges. */
2820 - if (graph->zero_weight_succs[from])
2822 - if (!graph->zero_weight_succs[to])
2823 - graph->zero_weight_succs[to] = BITMAP_ALLOC (&ptabitmap_obstack);
2824 - EXECUTE_IF_SET_IN_BITMAP (graph->zero_weight_succs[from], 0, j, bi)
2826 - bitmap_clear_bit (graph->zero_weight_preds[j], from);
2827 - bitmap_set_bit (graph->zero_weight_preds[j], to);
2828 + if (unite (tonode, fromnode))
2829 + unify_nodes (graph, tonode, fromnode, true);
2831 - bitmap_ior_into (graph->zero_weight_succs[to],
2832 - graph->zero_weight_succs[from]);
2835 - /* Merge all the nonzero weighted predecessor edges. */
2836 - for (i = 0; VEC_iterate (constraint_edge_t, predvec, i, c); i++)
2837 + /* Merge all the successor edges. */
2838 + if (graph->succs[from])
2840 - unsigned int d = c->dest;
2843 + if (!graph->succs[to])
2844 + graph->succs[to] = BITMAP_ALLOC (&pta_obstack);
2845 + bitmap_ior_into (graph->succs[to],
2846 + graph->succs[from]);
2849 - if (c->dest == from)
2851 + clear_edges_for_node (graph, from);
2854 - add_graph_edge (graph, to, d);
2856 - temp = *(get_graph_weights (graph, from, c->dest));
2859 - weights = get_graph_weights (graph, to, d);
2861 - *weights = allocate_graph_weights (graph, to, d);
2863 - bitmap_ior_into (*weights, temp);
2868 - /* Merge all the nonzero weighted successor edges. */
2869 - for (i = 0; VEC_iterate (constraint_edge_t, succvec, i, c); i++)
2871 - unsigned int d = c->dest;
2874 +/* Add an indirect graph edge to GRAPH, going from TO to FROM if
2875 + it doesn't exist in the graph already. */
2877 - if (c->dest == from)
2880 +add_implicit_graph_edge (constraint_graph_t graph, unsigned int to,
2881 + unsigned int from)
2886 - add_graph_edge (graph, d, to);
2887 + if (!graph->implicit_preds[to])
2888 + graph->implicit_preds[to] = BITMAP_ALLOC (&predbitmap_obstack);
2890 - temp = *(get_graph_weights (graph, c->dest, from));
2893 - weights = get_graph_weights (graph, d, to);
2895 - *weights = allocate_graph_weights (graph, d, to);
2896 - bitmap_ior_into (*weights, temp);
2898 + if (!bitmap_bit_p (graph->implicit_preds[to], from))
2900 + stats.num_implicit_edges++;
2901 + bitmap_set_bit (graph->implicit_preds[to], from);
2903 - clear_edges_for_node (graph, from);
2906 -/* Add a graph edge to GRAPH, going from TO to FROM, with WEIGHT, if
2907 +/* Add a predecessor graph edge to GRAPH, going from TO to FROM if
2908 it doesn't exist in the graph already.
2909 Return false if the edge already existed, true otherwise. */
2912 +add_pred_graph_edge (constraint_graph_t graph, unsigned int to,
2913 + unsigned int from)
2915 + if (!graph->preds[to])
2916 + graph->preds[to] = BITMAP_ALLOC (&predbitmap_obstack);
2917 + if (!bitmap_bit_p (graph->preds[to], from))
2918 + bitmap_set_bit (graph->preds[to], from);
2921 +/* Add a graph edge to GRAPH, going from FROM to TO if
2922 + it doesn't exist in the graph already.
2923 + Return false if the edge already existed, true otherwise. */
2926 -int_add_graph_edge (constraint_graph_t graph, unsigned int to,
2927 - unsigned int from, unsigned HOST_WIDE_INT weight)
2928 +add_graph_edge (constraint_graph_t graph, unsigned int to,
2929 + unsigned int from)
2931 - if (to == from && weight == 0)
2936 @@ -1125,41 +907,15 @@
2941 + if (!graph->succs[from])
2942 + graph->succs[from] = BITMAP_ALLOC (&pta_obstack);
2943 + if (!bitmap_bit_p (graph->succs[from], to))
2945 - if (!graph->zero_weight_preds[to])
2946 - graph->zero_weight_preds[to] = BITMAP_ALLOC (&predbitmap_obstack);
2947 - if (!graph->zero_weight_succs[from])
2948 - graph->zero_weight_succs[from] = BITMAP_ALLOC (&ptabitmap_obstack);
2949 - if (!bitmap_bit_p (graph->zero_weight_succs[from], to))
2951 - edge_added = true;
2953 - stats.num_edges++;
2954 - bitmap_set_bit (graph->zero_weight_preds[to], from);
2955 - bitmap_set_bit (graph->zero_weight_succs[from], to);
2958 + if (to < FIRST_REF_NODE && from < FIRST_REF_NODE)
2959 + stats.num_edges++;
2960 + bitmap_set_bit (graph->succs[from], to);
2966 - r = add_graph_edge (graph, to, from);
2967 - weights = get_graph_weights (graph, to, from);
2972 - *weights = allocate_graph_weights (graph, to, from);
2973 - bitmap_set_bit (*weights, weight);
2977 - r |= !bitmap_bit_p (*weights, weight);
2978 - bitmap_set_bit (*weights, weight);
2985 @@ -1168,46 +924,51 @@
2986 /* Return true if {DEST.SRC} is an existing graph edge in GRAPH. */
2989 -valid_graph_edge (constraint_graph_t graph, unsigned int src,
2990 +valid_graph_edge (constraint_graph_t graph, unsigned int src,
2993 - struct constraint_edge lookfor;
2994 - lookfor.dest = src;
2996 - return (graph->zero_weight_succs[dest]
2997 - && bitmap_bit_p (graph->zero_weight_succs[dest], src))
2998 - || constraint_edge_vec_find (graph->succs[dest], lookfor) != NULL;
2999 + return (graph->succs[dest]
3000 + && bitmap_bit_p (graph->succs[dest], src));
3003 -/* Return true if {DEST, SRC} is an existing weighted graph edge (IE has
3004 - a weight other than 0) in GRAPH. */
3006 -valid_weighted_graph_edge (constraint_graph_t graph, unsigned int src,
3007 - unsigned int dest)
3009 - struct constraint_edge lookfor;
3010 - lookfor.dest = src;
3012 - return graph->preds[src]
3013 - && constraint_edge_vec_find (graph->succs[dest], lookfor) != NULL;
3015 +/* Build the constraint graph, adding only predecessor edges right now. */
3018 -/* Build the constraint graph. */
3021 -build_constraint_graph (void)
3022 +build_pred_graph (void)
3029 graph = XNEW (struct constraint_graph);
3030 - graph_size = VEC_length (varinfo_t, varmap) + 1;
3031 - graph->succs = XCNEWVEC (VEC(constraint_edge_t,heap) *, graph_size);
3032 - graph->preds = XCNEWVEC (VEC(constraint_edge_t,heap) *, graph_size);
3033 - graph->zero_weight_succs = XCNEWVEC (bitmap, graph_size);
3034 - graph->zero_weight_preds = XCNEWVEC (bitmap, graph_size);
3035 + graph->size = (VEC_length (varinfo_t, varmap)) * 3;
3036 + graph->succs = XCNEWVEC (bitmap, graph->size);
3037 + graph->implicit_preds = XCNEWVEC (bitmap, graph->size);
3038 + graph->preds = XCNEWVEC (bitmap, graph->size);
3039 + graph->indirect_cycles = XNEWVEC (int, VEC_length (varinfo_t, varmap));
3040 + graph->label = XCNEWVEC (unsigned int, graph->size);
3041 + graph->rep = XNEWVEC (unsigned int, graph->size);
3042 + graph->eq_rep = XNEWVEC (int, graph->size);
3043 + graph->complex = XCNEWVEC (VEC(constraint_t, heap) *,
3044 + VEC_length (varinfo_t, varmap));
3045 + graph->direct_nodes = sbitmap_alloc (graph->size);
3046 + sbitmap_zero (graph->direct_nodes);
3048 + for (j = 0; j < FIRST_REF_NODE; j++)
3050 + if (!get_varinfo (j)->is_special_var)
3051 + SET_BIT (graph->direct_nodes, j);
3054 + for (j = 0; j < graph->size; j++)
3056 + graph->rep[j] = j;
3057 + graph->eq_rep[j] = -1;
3060 + for (j = 0; j < VEC_length (varinfo_t, varmap); j++)
3061 + graph->indirect_cycles[j] = -1;
3063 for (i = 0; VEC_iterate (constraint_t, constraints, i, c); i++)
3065 struct constraint_expr lhs = c->lhs;
3066 @@ -1217,31 +978,92 @@
3068 if (lhs.type == DEREF)
3070 - /* *x = y or *x = &y (complex) */
3071 - if (rhs.type == ADDRESSOF || rhsvar > anything_id)
3072 - insert_into_complex (lhsvar, c);
3074 + if (rhs.offset == 0 && lhs.offset == 0 && rhs.type == SCALAR)
3075 + add_pred_graph_edge (graph, FIRST_REF_NODE + lhsvar, rhsvar);
3076 + if (rhs.type == ADDRESSOF)
3077 + RESET_BIT (graph->direct_nodes, rhsvar);
3079 else if (rhs.type == DEREF)
3081 - /* !special var= *y */
3082 - if (!(get_varinfo (lhsvar)->is_special_var))
3083 - insert_into_complex (rhsvar, c);
3085 + if (rhs.offset == 0 && lhs.offset == 0 && lhs.type == SCALAR)
3086 + add_pred_graph_edge (graph, lhsvar, FIRST_REF_NODE + rhsvar);
3088 + RESET_BIT (graph->direct_nodes, lhsvar);
3090 else if (rhs.type == ADDRESSOF)
3093 + add_pred_graph_edge (graph, lhsvar, FIRST_ADDR_NODE + rhsvar);
3094 + /* Implicitly, *x = y */
3095 + add_implicit_graph_edge (graph, FIRST_REF_NODE + lhsvar, rhsvar);
3097 + RESET_BIT (graph->direct_nodes, rhsvar);
3099 + else if (lhsvar > anything_id
3100 + && lhsvar != rhsvar && lhs.offset == 0 && rhs.offset == 0)
3103 + add_pred_graph_edge (graph, lhsvar, rhsvar);
3104 + /* Implicitly, *x = *y */
3105 + add_implicit_graph_edge (graph, FIRST_REF_NODE + lhsvar,
3106 + FIRST_REF_NODE + rhsvar);
3108 + else if (lhs.offset != 0 || rhs.offset != 0)
3110 + if (rhs.offset != 0)
3111 + RESET_BIT (graph->direct_nodes, lhs.var);
3112 + if (lhs.offset != 0)
3113 + RESET_BIT (graph->direct_nodes, rhs.var);
3118 +/* Build the constraint graph, adding successor edges. */
3121 +build_succ_graph (void)
3126 + for (i = 0; VEC_iterate (constraint_t, constraints, i, c); i++)
3128 + struct constraint_expr lhs;
3129 + struct constraint_expr rhs;
3130 + unsigned int lhsvar;
3131 + unsigned int rhsvar;
3138 + lhsvar = find (get_varinfo_fc (lhs.var)->id);
3139 + rhsvar = find (get_varinfo_fc (rhs.var)->id);
3141 + if (lhs.type == DEREF)
3143 + if (rhs.offset == 0 && lhs.offset == 0 && rhs.type == SCALAR)
3144 + add_graph_edge (graph, FIRST_REF_NODE + lhsvar, rhsvar);
3146 + else if (rhs.type == DEREF)
3148 + if (rhs.offset == 0 && lhs.offset == 0 && lhs.type == SCALAR)
3149 + add_graph_edge (graph, lhsvar, FIRST_REF_NODE + rhsvar);
3151 + else if (rhs.type == ADDRESSOF)
3154 + gcc_assert (find (get_varinfo_fc (rhs.var)->id)
3155 + == get_varinfo_fc (rhs.var)->id);
3156 bitmap_set_bit (get_varinfo (lhsvar)->solution, rhsvar);
3158 - else if (lhsvar > anything_id)
3159 + else if (lhsvar > anything_id
3160 + && lhsvar != rhsvar && lhs.offset == 0 && rhs.offset == 0)
3162 - /* Ignore 0 weighted self edges, as they can't possibly contribute
3164 - if (lhsvar != rhsvar || rhs.offset != 0 || lhs.offset != 0)
3166 - /* x = y (simple) */
3167 - int_add_graph_edge (graph, lhs.var, rhs.var, rhs.offset);
3170 + add_graph_edge (graph, lhsvar, rhsvar);
3174 @@ -1260,20 +1082,20 @@
3178 - sbitmap in_component;
3180 + unsigned int *dfs;
3181 + unsigned int *node_mapping;
3183 - unsigned int *visited_index;
3184 VEC(unsigned,heap) *scc_stack;
3185 - VEC(unsigned,heap) *unification_queue;
3189 /* Recursive routine to find strongly connected components in GRAPH.
3190 SI is the SCC info to store the information in, and N is the id of current
3191 graph node we are processing.
3194 This is Tarjan's strongly connected component finding algorithm, as
3195 - modified by Nuutila to keep only non-root nodes on the stack.
3196 + modified by Nuutila to keep only non-root nodes on the stack.
3197 The algorithm can be found in "On finding the strongly connected
3198 connected components in a directed graph" by Esko Nuutila and Eljas
3199 Soisalon-Soininen, in Information Processing Letters volume 49,
3200 @@ -1284,188 +1106,144 @@
3204 + unsigned int my_dfs;
3206 - gcc_assert (get_varinfo (n)->node == n);
3207 SET_BIT (si->visited, n);
3208 - RESET_BIT (si->in_component, n);
3209 - si->visited_index[n] = si->current_index ++;
3211 + si->dfs[n] = si->current_index ++;
3212 + my_dfs = si->dfs[n];
3214 /* Visit all the successors. */
3215 - EXECUTE_IF_IN_NONNULL_BITMAP (graph->zero_weight_succs[n], 0, i, bi)
3216 + EXECUTE_IF_IN_NONNULL_BITMAP (graph->succs[n], 0, i, bi)
3218 - unsigned int w = i;
3221 + if (i > LAST_REF_NODE)
3225 + if (TEST_BIT (si->roots, w))
3228 if (!TEST_BIT (si->visited, w))
3229 scc_visit (graph, si, w);
3230 - if (!TEST_BIT (si->in_component, w))
3232 - unsigned int t = get_varinfo (w)->node;
3233 - unsigned int nnode = get_varinfo (n)->node;
3234 - if (si->visited_index[t] < si->visited_index[nnode])
3235 - get_varinfo (n)->node = t;
3238 + unsigned int t = find (w);
3239 + unsigned int nnode = find (n);
3240 + gcc_assert (nnode == n);
3242 + if (si->dfs[t] < si->dfs[nnode])
3243 + si->dfs[n] = si->dfs[t];
3248 /* See if any components have been identified. */
3249 - if (get_varinfo (n)->node == n)
3250 + if (si->dfs[n] == my_dfs)
3252 - unsigned int t = si->visited_index[n];
3253 - SET_BIT (si->in_component, n);
3254 - while (VEC_length (unsigned, si->scc_stack) != 0
3255 - && t < si->visited_index[VEC_last (unsigned, si->scc_stack)])
3256 + if (VEC_length (unsigned, si->scc_stack) > 0
3257 + && si->dfs[VEC_last (unsigned, si->scc_stack)] >= my_dfs)
3259 - unsigned int w = VEC_pop (unsigned, si->scc_stack);
3260 - get_varinfo (w)->node = n;
3261 - SET_BIT (si->in_component, w);
3262 - /* Mark this node for collapsing. */
3263 - VEC_safe_push (unsigned, heap, si->unification_queue, w);
3267 - VEC_safe_push (unsigned, heap, si->scc_stack, n);
3269 + bitmap scc = BITMAP_ALLOC (NULL);
3270 + bool have_ref_node = n >= FIRST_REF_NODE;
3271 + unsigned int lowest_node;
3272 + bitmap_iterator bi;
3274 + bitmap_set_bit (scc, n);
3276 -/* Collapse two variables into one variable. */
3277 + while (VEC_length (unsigned, si->scc_stack) != 0
3278 + && si->dfs[VEC_last (unsigned, si->scc_stack)] >= my_dfs)
3280 + unsigned int w = VEC_pop (unsigned, si->scc_stack);
3283 -collapse_nodes (constraint_graph_t graph, unsigned int to, unsigned int from)
3285 - bitmap tosol, fromsol;
3286 + bitmap_set_bit (scc, w);
3287 + if (w >= FIRST_REF_NODE)
3288 + have_ref_node = true;
3291 - condense_varmap_nodes (to, from);
3292 - tosol = get_varinfo (to)->solution;
3293 - fromsol = get_varinfo (from)->solution;
3294 - bitmap_ior_into (tosol, fromsol);
3295 - merge_graph_nodes (graph, to, from);
3297 - if (valid_graph_edge (graph, to, to))
3299 - if (graph->zero_weight_preds[to])
3301 - bitmap_clear_bit (graph->zero_weight_preds[to], to);
3302 - bitmap_clear_bit (graph->zero_weight_succs[to], to);
3303 + lowest_node = bitmap_first_set_bit (scc);
3304 + gcc_assert (lowest_node < FIRST_REF_NODE);
3305 + EXECUTE_IF_SET_IN_BITMAP (scc, 0, i, bi)
3307 + if (i < FIRST_REF_NODE)
3309 + /* Mark this node for collapsing. */
3310 + if (unite (lowest_node, i))
3311 + unify_nodes (graph, lowest_node, i, false);
3315 + unite (lowest_node, i);
3316 + graph->indirect_cycles[i - FIRST_REF_NODE] = lowest_node;
3320 - if (valid_weighted_graph_edge (graph, to, to))
3322 - bitmap weights = *(get_graph_weights (graph, to, to));
3323 - if (!weights || bitmap_empty_p (weights))
3324 - erase_graph_self_edge (graph, to);
3326 + SET_BIT (si->roots, n);
3328 - BITMAP_FREE (fromsol);
3329 - get_varinfo (to)->address_taken |= get_varinfo (from)->address_taken;
3330 - get_varinfo (to)->indirect_target |= get_varinfo (from)->indirect_target;
3332 + VEC_safe_push (unsigned, heap, si->scc_stack, n);
3335 +/* Unify node FROM into node TO, updating the changed count if
3336 + necessary when UPDATE_CHANGED is true. */
3338 -/* Unify nodes in GRAPH that we have found to be part of a cycle.
3339 - SI is the Strongly Connected Components information structure that tells us
3340 - what components to unify.
3341 - UPDATE_CHANGED should be set to true if the changed sbitmap and changed
3342 - count should be updated to reflect the unification. */
3345 -process_unification_queue (constraint_graph_t graph, struct scc_info *si,
3346 - bool update_changed)
3347 +unify_nodes (constraint_graph_t graph, unsigned int to, unsigned int from,
3348 + bool update_changed)
3351 - bitmap tmp = BITMAP_ALLOC (update_changed ? &iteration_obstack : NULL);
3352 - bitmap_clear (tmp);
3354 - /* We proceed as follows:
3355 + gcc_assert (to != from && find (to) == to);
3356 + if (dump_file && (dump_flags & TDF_DETAILS))
3357 + fprintf (dump_file, "Unifying %s to %s\n",
3358 + get_varinfo (from)->name,
3359 + get_varinfo (to)->name);
3361 - For each component in the queue (components are delineated by
3362 - when current_queue_element->node != next_queue_element->node):
3363 + if (update_changed)
3364 + stats.unified_vars_dynamic++;
3366 + stats.unified_vars_static++;
3368 - rep = representative node for component
3369 + merge_graph_nodes (graph, to, from);
3370 + merge_node_constraints (graph, to, from);
3372 - For each node (tounify) to be unified in the component,
3373 - merge the solution for tounify into tmp bitmap
3375 - clear solution for tounify
3377 - merge edges from tounify into rep
3379 - merge complex constraints from tounify into rep
3381 - update changed count to note that tounify will never change
3384 - Merge tmp into solution for rep, marking rep changed if this
3385 - changed rep's solution.
3387 - Delete any 0 weighted self-edges we now have for rep. */
3388 - while (i != VEC_length (unsigned, si->unification_queue))
3389 + if (update_changed && TEST_BIT (changed, from))
3391 - unsigned int tounify = VEC_index (unsigned, si->unification_queue, i);
3392 - unsigned int n = get_varinfo (tounify)->node;
3394 - if (dump_file && (dump_flags & TDF_DETAILS))
3395 - fprintf (dump_file, "Unifying %s to %s\n",
3396 - get_varinfo (tounify)->name,
3397 - get_varinfo (n)->name);
3398 - if (update_changed)
3399 - stats.unified_vars_dynamic++;
3400 + RESET_BIT (changed, from);
3401 + if (!TEST_BIT (changed, to))
3402 + SET_BIT (changed, to);
3404 - stats.unified_vars_static++;
3405 - bitmap_ior_into (tmp, get_varinfo (tounify)->solution);
3406 - merge_graph_nodes (graph, n, tounify);
3407 - condense_varmap_nodes (n, tounify);
3409 - if (update_changed && TEST_BIT (changed, tounify))
3411 - RESET_BIT (changed, tounify);
3412 - if (!TEST_BIT (changed, n))
3413 - SET_BIT (changed, n);
3416 - gcc_assert (changed_count > 0);
3419 + gcc_assert (changed_count > 0);
3424 - bitmap_clear (get_varinfo (tounify)->solution);
3427 - /* If we've either finished processing the entire queue, or
3428 - finished processing all nodes for component n, update the solution for
3430 - if (i == VEC_length (unsigned, si->unification_queue)
3431 - || get_varinfo (VEC_index (unsigned, si->unification_queue, i))->node != n)
3432 + /* If the solution changes because of the merging, we need to mark
3433 + the variable as changed. */
3434 + if (bitmap_ior_into (get_varinfo (to)->solution,
3435 + get_varinfo (from)->solution))
3437 + if (update_changed && !TEST_BIT (changed, to))
3439 - /* If the solution changes because of the merging, we need to mark
3440 - the variable as changed. */
3441 - if (bitmap_ior_into (get_varinfo (n)->solution, tmp))
3443 - if (update_changed && !TEST_BIT (changed, n))
3445 - SET_BIT (changed, n);
3449 - bitmap_clear (tmp);
3451 - if (valid_graph_edge (graph, n, n))
3453 - if (graph->zero_weight_succs[n])
3455 - if (graph->zero_weight_preds[n])
3456 - bitmap_clear_bit (graph->zero_weight_preds[n], n);
3457 - bitmap_clear_bit (graph->zero_weight_succs[n], n);
3459 - if (valid_weighted_graph_edge (graph, n, n))
3461 - bitmap weights = *(get_graph_weights (graph, n, n));
3462 - if (!weights || bitmap_empty_p (weights))
3463 - erase_graph_self_edge (graph, n);
3466 + SET_BIT (changed, to);
3470 - BITMAP_FREE (tmp);
3472 + BITMAP_FREE (get_varinfo (from)->solution);
3473 + BITMAP_FREE (get_varinfo (from)->oldsolution);
3475 + if (stats.iterations > 0)
3477 + BITMAP_FREE (get_varinfo (to)->oldsolution);
3478 + get_varinfo (to)->oldsolution = BITMAP_ALLOC (&oldpta_obstack);
3481 + if (valid_graph_edge (graph, to, to))
3483 + if (graph->succs[to])
3484 + bitmap_clear_bit (graph->succs[to], to);
3489 /* Information needed to compute the topological ordering of a graph. */
3492 @@ -1509,37 +1287,24 @@
3493 topo_visit (constraint_graph_t graph, struct topo_info *ti,
3496 - VEC(constraint_edge_t,heap) *succs = graph->succs[n];
3499 - constraint_edge_t c;
3503 SET_BIT (ti->visited, n);
3504 - if (VEC_length (constraint_edge_t, succs) != 0)
3506 - temp = BITMAP_ALLOC (&iteration_obstack);
3507 - if (graph->zero_weight_succs[n])
3508 - bitmap_ior_into (temp, graph->zero_weight_succs[n]);
3509 - for (i = 0; VEC_iterate (constraint_edge_t, succs, i, c); i++)
3510 - bitmap_set_bit (temp, c->dest);
3513 - temp = graph->zero_weight_succs[n];
3516 - EXECUTE_IF_SET_IN_BITMAP (temp, 0, j, bi)
3517 + if (graph->succs[n])
3518 + EXECUTE_IF_SET_IN_BITMAP (graph->succs[n], 0, j, bi)
3520 if (!TEST_BIT (ti->visited, j))
3521 topo_visit (graph, ti, j);
3524 VEC_safe_push (unsigned, heap, ti->topo_order, n);
3527 /* Return true if variable N + OFFSET is a legal field of N. */
3531 type_safe (unsigned int n, unsigned HOST_WIDE_INT *offset)
3533 varinfo_t ninfo = get_varinfo (n);
3534 @@ -1582,10 +1347,10 @@
3535 v = first_vi_for_offset (get_varinfo (j), fieldoffset);
3540 sol = get_varinfo (t)->solution;
3541 if (!bitmap_bit_p (sol, rhs))
3544 bitmap_set_bit (sol, rhs);
3545 if (!TEST_BIT (changed, t))
3547 @@ -1596,7 +1361,7 @@
3549 else if (0 && dump_file && !(get_varinfo (j)->is_special_var))
3550 fprintf (dump_file, "Untypesafe usage in do_da_constraint.\n");
3556 @@ -1607,7 +1372,7 @@
3557 do_sd_constraint (constraint_graph_t graph, constraint_t c,
3560 - unsigned int lhs = get_varinfo (c->lhs.var)->node;
3561 + unsigned int lhs = find (c->lhs.var);
3563 bitmap sol = get_varinfo (lhs)->solution;
3565 @@ -1620,7 +1385,7 @@
3566 bitmap_set_bit (sol, anything_id);
3569 - /* For each variable j in delta (Sol(y)), add
3570 + /* For each variable j in delta (Sol(y)), add
3571 an edge in the graph from j to x, and union Sol(j) into Sol(x). */
3572 EXECUTE_IF_SET_IN_BITMAP (delta, 0, j, bi)
3574 @@ -1634,18 +1399,18 @@
3575 v = first_vi_for_offset (get_varinfo (j), fieldoffset);
3581 /* Adding edges from the special vars is pointless.
3582 They don't have sets that can change. */
3583 if (get_varinfo (t) ->is_special_var)
3584 flag |= bitmap_ior_into (sol, get_varinfo (t)->solution);
3585 - else if (int_add_graph_edge (graph, lhs, t, 0))
3586 + else if (add_graph_edge (graph, lhs, t))
3587 flag |= bitmap_ior_into (sol, get_varinfo (t)->solution);
3589 else if (0 && dump_file && !(get_varinfo (j)->is_special_var))
3590 fprintf (dump_file, "Untypesafe usage in do_sd_constraint\n");
3596 @@ -1658,15 +1423,15 @@
3597 SET_BIT (changed, lhs);
3604 /* Process a constraint C that represents *x = y. */
3607 -do_ds_constraint (constraint_graph_t graph, constraint_t c, bitmap delta)
3608 +do_ds_constraint (constraint_t c, bitmap delta)
3610 - unsigned int rhs = get_varinfo (c->rhs.var)->node;
3611 + unsigned int rhs = find (c->rhs.var);
3612 unsigned HOST_WIDE_INT roff = c->rhs.offset;
3613 bitmap sol = get_varinfo (rhs)->solution;
3615 @@ -1685,8 +1450,8 @@
3616 v = first_vi_for_offset (get_varinfo (j), fieldoffset);
3623 if (!bitmap_bit_p (get_varinfo (t)->solution, anything_id))
3625 bitmap_set_bit (get_varinfo (t)->solution, anything_id);
3626 @@ -1705,40 +1470,39 @@
3627 EXECUTE_IF_SET_IN_BITMAP (delta, 0, j, bi)
3629 unsigned HOST_WIDE_INT loff = c->lhs.offset;
3630 - if (type_safe (j, &loff) && !(get_varinfo(j)->is_special_var))
3631 + if (type_safe (j, &loff) && !(get_varinfo (j)->is_special_var))
3635 unsigned HOST_WIDE_INT fieldoffset = get_varinfo (j)->offset + loff;
3638 v = first_vi_for_offset (get_varinfo (j), fieldoffset);
3642 - if (int_add_graph_edge (graph, t, rhs, roff))
3644 + tmp = get_varinfo (t)->solution;
3646 + if (set_union_with_increment (tmp, sol, roff))
3648 - bitmap tmp = get_varinfo (t)->solution;
3649 - if (set_union_with_increment (tmp, sol, roff))
3650 + get_varinfo (t)->solution = tmp;
3652 + sol = get_varinfo (rhs)->solution;
3653 + if (!TEST_BIT (changed, t))
3655 - get_varinfo (t)->solution = tmp;
3657 - sol = get_varinfo (rhs)->solution;
3658 - if (!TEST_BIT (changed, t))
3660 - SET_BIT (changed, t);
3663 + SET_BIT (changed, t);
3669 else if (0 && dump_file && !(get_varinfo (j)->is_special_var))
3670 fprintf (dump_file, "Untypesafe usage in do_ds_constraint\n");
3674 -/* Handle a non-simple (simple meaning requires no iteration), non-copy
3675 - constraint (IE *x = &y, x = *y, and *x = y). */
3677 +/* Handle a non-simple (simple meaning requires no iteration),
3678 + constraint (IE *x = &y, x = *y, *x = y, and x = y with offsets involved). */
3681 do_complex_constraint (constraint_graph_t graph, constraint_t c, bitmap delta)
3683 @@ -1752,33 +1516,62 @@
3687 - do_ds_constraint (graph, c, delta);
3688 + do_ds_constraint (c, delta);
3692 + else if (c->rhs.type == DEREF)
3695 if (!(get_varinfo (c->lhs.var)->is_special_var))
3696 do_sd_constraint (graph, c, delta);
3702 + bool flag = false;
3705 + gcc_assert (c->rhs.type == SCALAR && c->lhs.type == SCALAR);
3706 + t = find (c->rhs.var);
3707 + solution = get_varinfo (t)->solution;
3708 + t = find (c->lhs.var);
3709 + tmp = get_varinfo (t)->solution;
3711 + flag = set_union_with_increment (tmp, solution, c->rhs.offset);
3715 + get_varinfo (t)->solution = tmp;
3716 + if (!TEST_BIT (changed, t))
3718 + SET_BIT (changed, t);
3725 /* Initialize and return a new SCC info structure. */
3727 static struct scc_info *
3728 -init_scc_info (void)
3729 +init_scc_info (size_t size)
3731 struct scc_info *si = XNEW (struct scc_info);
3732 - size_t size = VEC_length (varinfo_t, varmap);
3735 si->current_index = 0;
3736 si->visited = sbitmap_alloc (size);
3737 sbitmap_zero (si->visited);
3738 - si->in_component = sbitmap_alloc (size);
3739 - sbitmap_ones (si->in_component);
3740 - si->visited_index = XCNEWVEC (unsigned int, size + 1);
3741 + si->roots = sbitmap_alloc (size);
3742 + sbitmap_zero (si->roots);
3743 + si->node_mapping = XNEWVEC (unsigned int, size);
3744 + si->dfs = XCNEWVEC (unsigned int, size);
3746 + for (i = 0; i < size; i++)
3747 + si->node_mapping[i] = i;
3749 si->scc_stack = VEC_alloc (unsigned, heap, 1);
3750 - si->unification_queue = VEC_alloc (unsigned, heap, 1);
3754 @@ -1786,209 +1579,430 @@
3757 free_scc_info (struct scc_info *si)
3760 sbitmap_free (si->visited);
3761 - sbitmap_free (si->in_component);
3762 - free (si->visited_index);
3763 + sbitmap_free (si->roots);
3764 + free (si->node_mapping);
3766 VEC_free (unsigned, heap, si->scc_stack);
3767 - VEC_free (unsigned, heap, si->unification_queue);
3773 -/* Find cycles in GRAPH that occur, using strongly connected components, and
3774 - collapse the cycles into a single representative node. if UPDATE_CHANGED
3775 - is true, then update the changed sbitmap to note those nodes whose
3776 - solutions have changed as a result of collapsing. */
3777 +/* Find indirect cycles in GRAPH that occur, using strongly connected
3778 + components, and note them in the indirect cycles map.
3780 + This technique comes from Ben Hardekopf and Calvin Lin,
3781 + "It Pays to be Lazy: Fast and Accurate Pointer Analysis for Millions of
3782 + Lines of Code", submitted to PLDI 2007. */
3785 -find_and_collapse_graph_cycles (constraint_graph_t graph, bool update_changed)
3786 +find_indirect_cycles (constraint_graph_t graph)
3789 - unsigned int size = VEC_length (varinfo_t, varmap);
3790 - struct scc_info *si = init_scc_info ();
3791 + unsigned int size = graph->size;
3792 + struct scc_info *si = init_scc_info (size);
3794 - for (i = 0; i != size; ++i)
3795 - if (!TEST_BIT (si->visited, i) && get_varinfo (i)->node == i)
3796 + for (i = 0; i < MIN (LAST_REF_NODE, size); i ++ )
3797 + if (!TEST_BIT (si->visited, i) && find (i) == i)
3798 scc_visit (graph, si, i);
3800 - process_unification_queue (graph, si, update_changed);
3805 /* Compute a topological ordering for GRAPH, and store the result in the
3806 topo_info structure TI. */
3810 compute_topo_order (constraint_graph_t graph,
3811 struct topo_info *ti)
3814 unsigned int size = VEC_length (varinfo_t, varmap);
3817 for (i = 0; i != size; ++i)
3818 - if (!TEST_BIT (ti->visited, i) && get_varinfo (i)->node == i)
3819 + if (!TEST_BIT (ti->visited, i) && find (i) == i)
3820 topo_visit (graph, ti, i);
3823 -/* Return true if bitmap B is empty, or a bitmap other than bit 0 is set. */
3824 +/* Perform offline variable substitution.
3827 -bitmap_other_than_zero_bit_set (bitmap b)
3830 - bitmap_iterator bi;
3832 - if (bitmap_empty_p (b))
3834 - EXECUTE_IF_SET_IN_BITMAP (b, 1, i, bi)
3839 -/* Perform offline variable substitution.
3841 This is a linear time way of identifying variables that must have
3842 equivalent points-to sets, including those caused by static cycles,
3843 and single entry subgraphs, in the constraint graph.
3845 The technique is described in "Off-line variable substitution for
3846 scaling points-to analysis" by Atanas Rountev and Satish Chandra,
3847 - in "ACM SIGPLAN Notices" volume 35, number 5, pages 47-56. */
3848 + in "ACM SIGPLAN Notices" volume 35, number 5, pages 47-56.
3850 + There is an optimal way to do this involving hash based value
3851 + numbering, once the technique is published i will implement it
3854 + The general method of finding equivalence classes is as follows:
3855 + Add fake nodes (REF nodes) and edges for *a = b and a = *b constraints.
3856 + Add fake nodes (ADDRESS nodes) and edges for a = &b constraints.
3857 + Initialize all non-REF/ADDRESS nodes to be direct nodes
3858 + For each SCC in the predecessor graph:
3859 + for each member (x) of the SCC
3860 + if x is not a direct node:
3861 + set rootnode(SCC) to be not a direct node
3862 + collapse node x into rootnode(SCC).
3863 + if rootnode(SCC) is not a direct node:
3864 + label rootnode(SCC) with a new equivalence class
3866 + if all labeled predecessors of rootnode(SCC) have the same
3868 + label rootnode(SCC) with this label
3870 + label rootnode(SCC) with a new equivalence class
3872 + All direct nodes with the same equivalence class can be replaced
3873 + with a single representative node.
3874 + All unlabeled nodes (label == 0) are not pointers and all edges
3875 + involving them can be eliminated.
3876 + We perform these optimizations during move_complex_constraints.
3879 +static int equivalence_class;
3881 +/* Recursive routine to find strongly connected components in GRAPH,
3882 + and label it's nodes with equivalence classes.
3883 + This is used during variable substitution to find cycles involving
3884 + the regular or implicit predecessors, and label them as equivalent.
3885 + The SCC finding algorithm used is the same as that for scc_visit. */
3888 -perform_var_substitution (constraint_graph_t graph)
3889 +label_visit (constraint_graph_t graph, struct scc_info *si, unsigned int n)
3891 - struct topo_info *ti = init_topo_info ();
3893 - bitmap_obstack_initialize (&iteration_obstack);
3894 - /* Compute the topological ordering of the graph, then visit each
3895 - node in topological order. */
3896 - compute_topo_order (graph, ti);
3898 - while (VEC_length (unsigned, ti->topo_order) != 0)
3900 + bitmap_iterator bi;
3901 + unsigned int my_dfs;
3903 + gcc_assert (si->node_mapping[n] == n);
3904 + SET_BIT (si->visited, n);
3905 + si->dfs[n] = si->current_index ++;
3906 + my_dfs = si->dfs[n];
3908 + /* Visit all the successors. */
3909 + EXECUTE_IF_IN_NONNULL_BITMAP (graph->preds[n], 0, i, bi)
3911 - unsigned int i = VEC_pop (unsigned, ti->topo_order);
3912 - unsigned int pred;
3913 - varinfo_t vi = get_varinfo (i);
3914 - bool okay_to_elim = false;
3915 - unsigned int root = VEC_length (varinfo_t, varmap);
3916 - VEC(constraint_edge_t,heap) *predvec = graph->preds[i];
3917 - constraint_edge_t ce = NULL;
3920 - bitmap_iterator bi;
3921 + unsigned int w = si->node_mapping[i];
3923 - /* We can't eliminate things whose address is taken, or which is
3924 - the target of a dereference. */
3925 - if (vi->address_taken || vi->indirect_target)
3926 + if (TEST_BIT (si->roots, w))
3929 - /* See if all predecessors of I are ripe for elimination */
3930 - EXECUTE_IF_IN_NONNULL_BITMAP (graph->zero_weight_preds[i], 0, k, bi)
3933 - w = get_varinfo (k)->node;
3934 + if (!TEST_BIT (si->visited, w))
3935 + label_visit (graph, si, w);
3937 + unsigned int t = si->node_mapping[w];
3938 + unsigned int nnode = si->node_mapping[n];
3939 + gcc_assert (nnode == n);
3941 - /* We can't eliminate the node if one of the predecessors is
3942 - part of a different strongly connected component. */
3943 - if (!okay_to_elim)
3946 - okay_to_elim = true;
3948 - else if (w != root)
3950 - okay_to_elim = false;
3953 + if (si->dfs[t] < si->dfs[nnode])
3954 + si->dfs[n] = si->dfs[t];
3958 - /* Theorem 4 in Rountev and Chandra: If i is a direct node,
3959 - then Solution(i) is a subset of Solution (w), where w is a
3960 - predecessor in the graph.
3961 - Corollary: If all predecessors of i have the same
3962 - points-to set, then i has that same points-to set as
3963 - those predecessors. */
3964 - tmp = BITMAP_ALLOC (NULL);
3965 - bitmap_and_compl (tmp, get_varinfo (i)->solution,
3966 - get_varinfo (w)->solution);
3967 - if (!bitmap_empty_p (tmp))
3969 - okay_to_elim = false;
3970 - BITMAP_FREE (tmp);
3973 - BITMAP_FREE (tmp);
3975 + /* Visit all the implicit predecessors. */
3976 + EXECUTE_IF_IN_NONNULL_BITMAP (graph->implicit_preds[n], 0, i, bi)
3978 + unsigned int w = si->node_mapping[i];
3982 - VEC_iterate (constraint_edge_t, predvec, pred, ce);
3987 - weight = *(get_graph_weights (graph, i, ce->dest));
3988 + if (TEST_BIT (si->roots, w))
3991 - /* We can't eliminate variables that have nonzero weighted
3992 - edges between them. */
3993 - if (weight && bitmap_other_than_zero_bit_set (weight))
3995 - okay_to_elim = false;
3998 - w = get_varinfo (ce->dest)->node;
3999 + if (!TEST_BIT (si->visited, w))
4000 + label_visit (graph, si, w);
4002 + unsigned int t = si->node_mapping[w];
4003 + unsigned int nnode = si->node_mapping[n];
4004 + gcc_assert (nnode == n);
4006 - /* We can't eliminate the node if one of the predecessors is
4007 - part of a different strongly connected component. */
4008 - if (!okay_to_elim)
4011 - okay_to_elim = true;
4013 - else if (w != root)
4015 - okay_to_elim = false;
4018 + if (si->dfs[t] < si->dfs[nnode])
4019 + si->dfs[n] = si->dfs[t];
4023 - /* Theorem 4 in Rountev and Chandra: If i is a direct node,
4024 - then Solution(i) is a subset of Solution (w), where w is a
4025 - predecessor in the graph.
4026 - Corollary: If all predecessors of i have the same
4027 - points-to set, then i has that same points-to set as
4028 - those predecessors. */
4029 - tmp = BITMAP_ALLOC (NULL);
4030 - bitmap_and_compl (tmp, get_varinfo (i)->solution,
4031 - get_varinfo (w)->solution);
4032 - if (!bitmap_empty_p (tmp))
4034 - okay_to_elim = false;
4035 - BITMAP_FREE (tmp);
4038 - BITMAP_FREE (tmp);
4040 + /* See if any components have been identified. */
4041 + if (si->dfs[n] == my_dfs)
4043 + while (VEC_length (unsigned, si->scc_stack) != 0
4044 + && si->dfs[VEC_last (unsigned, si->scc_stack)] >= my_dfs)
4046 + unsigned int w = VEC_pop (unsigned, si->scc_stack);
4047 + si->node_mapping[w] = n;
4049 - /* See if the root is different than the original node.
4050 - If so, we've found an equivalence. */
4051 - if (root != get_varinfo (i)->node && okay_to_elim)
4052 + if (!TEST_BIT (graph->direct_nodes, w))
4053 + RESET_BIT (graph->direct_nodes, n);
4055 + SET_BIT (si->roots, n);
4057 + if (!TEST_BIT (graph->direct_nodes, n))
4059 - /* Found an equivalence */
4060 - get_varinfo (i)->node = root;
4061 - collapse_nodes (graph, root, i);
4062 + graph->label[n] = equivalence_class++;
4066 + unsigned int size = 0;
4067 + unsigned int firstlabel = ~0;
4069 + EXECUTE_IF_IN_NONNULL_BITMAP (graph->preds[n], 0, i, bi)
4071 + unsigned int j = si->node_mapping[i];
4073 + if (j == n || graph->label[j] == 0)
4076 + if (firstlabel == (unsigned int)~0)
4078 + firstlabel = graph->label[j];
4081 + else if (graph->label[j] != firstlabel)
4086 + graph->label[n] = 0;
4087 + else if (size == 1)
4088 + graph->label[n] = firstlabel;
4090 + graph->label[n] = equivalence_class++;
4094 + VEC_safe_push (unsigned, heap, si->scc_stack, n);
4097 +/* Perform offline variable substitution, discovering equivalence
4098 + classes, and eliminating non-pointer variables. */
4100 +static struct scc_info *
4101 +perform_var_substitution (constraint_graph_t graph)
4104 + unsigned int size = graph->size;
4105 + struct scc_info *si = init_scc_info (size);
4107 + bitmap_obstack_initialize (&iteration_obstack);
4108 + equivalence_class = 0;
4110 + /* We only need to visit the non-address nodes for labeling
4111 + purposes, as the address nodes will never have any predecessors,
4112 + because &x never appears on the LHS of a constraint. */
4113 + for (i = 0; i < LAST_REF_NODE; i++)
4114 + if (!TEST_BIT (si->visited, si->node_mapping[i]))
4115 + label_visit (graph, si, si->node_mapping[i]);
4117 + if (dump_file && (dump_flags & TDF_DETAILS))
4118 + for (i = 0; i < FIRST_REF_NODE; i++)
4120 + bool direct_node = TEST_BIT (graph->direct_nodes, i);
4121 + fprintf (dump_file,
4122 + "Equivalence class for %s node id %d:%s is %d\n",
4123 + direct_node ? "Direct node" : "Indirect node", i,
4124 + get_varinfo (i)->name,
4125 + graph->label[si->node_mapping[i]]);
4128 + /* Quickly eliminate our non-pointer variables. */
4130 + for (i = 0; i < FIRST_REF_NODE; i++)
4132 + unsigned int node = si->node_mapping[i];
4134 + if (graph->label[node] == 0 && TEST_BIT (graph->direct_nodes, node))
4136 if (dump_file && (dump_flags & TDF_DETAILS))
4137 - fprintf (dump_file, "Collapsing %s into %s\n",
4138 - get_varinfo (i)->name,
4139 - get_varinfo (root)->name);
4140 - stats.collapsed_vars++;
4141 + fprintf (dump_file,
4142 + "%s is a non-pointer variable, eliminating edges.\n",
4143 + get_varinfo (node)->name);
4144 + stats.nonpointer_vars++;
4145 + clear_edges_for_node (graph, node);
4151 +/* Free information that was only necessary for variable
4155 +free_var_substitution_info (struct scc_info *si)
4157 + free_scc_info (si);
4158 + free (graph->label);
4159 + free (graph->eq_rep);
4160 + sbitmap_free (graph->direct_nodes);
4161 bitmap_obstack_release (&iteration_obstack);
4162 - free_topo_info (ti);
4165 +/* Return an existing node that is equivalent to NODE, which has
4166 + equivalence class LABEL, if one exists. Return NODE otherwise. */
4168 +static unsigned int
4169 +find_equivalent_node (constraint_graph_t graph,
4170 + unsigned int node, unsigned int label)
4172 + /* If the address version of this variable is unused, we can
4173 + substitute it for anything else with the same label.
4174 + Otherwise, we know the pointers are equivalent, but not the
4177 + if (graph->label[FIRST_ADDR_NODE + node] == 0)
4179 + gcc_assert (label < graph->size);
4181 + if (graph->eq_rep[label] != -1)
4183 + /* Unify the two variables since we know they are equivalent. */
4184 + if (unite (graph->eq_rep[label], node))
4185 + unify_nodes (graph, graph->eq_rep[label], node, false);
4186 + return graph->eq_rep[label];
4190 + graph->eq_rep[label] = node;
4196 +/* Move complex constraints to the appropriate nodes, and collapse
4197 + variables we've discovered are equivalent during variable
4198 + substitution. SI is the SCC_INFO that is the result of
4199 + perform_variable_substitution. */
4202 +move_complex_constraints (constraint_graph_t graph,
4203 + struct scc_info *si)
4209 + for (j = 0; j < graph->size; j++)
4210 + gcc_assert (find (j) == j);
4212 + for (i = 0; VEC_iterate (constraint_t, constraints, i, c); i++)
4214 + struct constraint_expr lhs = c->lhs;
4215 + struct constraint_expr rhs = c->rhs;
4216 + unsigned int lhsvar = find (get_varinfo_fc (lhs.var)->id);
4217 + unsigned int rhsvar = find (get_varinfo_fc (rhs.var)->id);
4218 + unsigned int lhsnode, rhsnode;
4219 + unsigned int lhslabel, rhslabel;
4221 + lhsnode = si->node_mapping[lhsvar];
4222 + rhsnode = si->node_mapping[rhsvar];
4223 + lhslabel = graph->label[lhsnode];
4224 + rhslabel = graph->label[rhsnode];
4226 + /* See if it is really a non-pointer variable, and if so, ignore
4227 + the constraint. */
4228 + if (lhslabel == 0)
4230 + if (!TEST_BIT (graph->direct_nodes, lhsnode))
4231 + lhslabel = graph->label[lhsnode] = equivalence_class++;
4234 + if (dump_file && (dump_flags & TDF_DETAILS))
4237 + fprintf (dump_file, "%s is a non-pointer variable,"
4238 + "ignoring constraint:",
4239 + get_varinfo (lhs.var)->name);
4240 + dump_constraint (dump_file, c);
4242 + VEC_replace (constraint_t, constraints, i, NULL);
4247 + if (rhslabel == 0)
4249 + if (!TEST_BIT (graph->direct_nodes, rhsnode))
4250 + rhslabel = graph->label[rhsnode] = equivalence_class++;
4253 + if (dump_file && (dump_flags & TDF_DETAILS))
4256 + fprintf (dump_file, "%s is a non-pointer variable,"
4257 + "ignoring constraint:",
4258 + get_varinfo (rhs.var)->name);
4259 + dump_constraint (dump_file, c);
4261 + VEC_replace (constraint_t, constraints, i, NULL);
4266 + lhsvar = find_equivalent_node (graph, lhsvar, lhslabel);
4267 + rhsvar = find_equivalent_node (graph, rhsvar, rhslabel);
4268 + c->lhs.var = lhsvar;
4269 + c->rhs.var = rhsvar;
4271 + if (lhs.type == DEREF)
4273 + if (rhs.type == ADDRESSOF || rhsvar > anything_id)
4274 + insert_into_complex (graph, lhsvar, c);
4276 + else if (rhs.type == DEREF)
4278 + if (!(get_varinfo (lhsvar)->is_special_var))
4279 + insert_into_complex (graph, rhsvar, c);
4281 + else if (rhs.type != ADDRESSOF && lhsvar > anything_id
4282 + && (lhs.offset != 0 || rhs.offset != 0))
4284 + insert_into_complex (graph, rhsvar, c);
4290 +/* Eliminate indirect cycles involving NODE. Return true if NODE was
4291 + part of an SCC, false otherwise. */
4294 +eliminate_indirect_cycles (unsigned int node)
4296 + if (graph->indirect_cycles[node] != -1
4297 + && !bitmap_empty_p (get_varinfo (node)->solution))
4300 + VEC(unsigned,heap) *queue = NULL;
4302 + unsigned int to = find (graph->indirect_cycles[node]);
4303 + bitmap_iterator bi;
4305 + /* We can't touch the solution set and call unify_nodes
4306 + at the same time, because unify_nodes is going to do
4307 + bitmap unions into it. */
4309 + EXECUTE_IF_SET_IN_BITMAP (get_varinfo (node)->solution, 0, i, bi)
4311 + if (find (i) == i && i != to)
4313 + if (unite (to, i))
4314 + VEC_safe_push (unsigned, heap, queue, i);
4318 + for (queuepos = 0;
4319 + VEC_iterate (unsigned, queue, queuepos, i);
4322 + unify_nodes (graph, to, i, true);
4324 + VEC_free (unsigned, heap, queue);
4330 /* Solve the constraint graph GRAPH using our worklist solver.
4331 This is based on the PW* family of solvers from the "Efficient Field
4332 Sensitive Pointer Analysis for C" paper.
4333 @@ -2001,17 +2015,28 @@
4335 unsigned int size = VEC_length (varinfo_t, varmap);
4339 - changed_count = size;
4340 + changed_count = 0;
4341 changed = sbitmap_alloc (size);
4342 - sbitmap_ones (changed);
4344 - /* The already collapsed/unreachable nodes will never change, so we
4345 - need to account for them in changed_count. */
4346 + sbitmap_zero (changed);
4348 + /* Mark all initial non-collapsed nodes as changed. */
4349 for (i = 0; i < size; i++)
4350 - if (get_varinfo (i)->node != i)
4354 + varinfo_t ivi = get_varinfo (i);
4355 + if (find (i) == i && !bitmap_empty_p (ivi->solution)
4356 + && ((graph->succs[i] && !bitmap_empty_p (graph->succs[i]))
4357 + || VEC_length (constraint_t, graph->complex[i]) > 0))
4359 + SET_BIT (changed, i);
4364 + /* Allocate a bitmap to be used to store the changed bits. */
4365 + pts = BITMAP_ALLOC (&pta_obstack);
4367 while (changed_count > 0)
4370 @@ -2019,41 +2044,45 @@
4373 bitmap_obstack_initialize (&iteration_obstack);
4377 - /* We already did cycle elimination once, when we did
4378 - variable substitution, so we don't need it again for the
4379 - first iteration. */
4380 - if (stats.iterations > 1)
4381 - find_and_collapse_graph_cycles (graph, true);
4383 - edge_added = false;
4386 compute_topo_order (graph, ti);
4388 while (VEC_length (unsigned, ti->topo_order) != 0)
4391 i = VEC_pop (unsigned, ti->topo_order);
4392 - gcc_assert (get_varinfo (i)->node == i);
4394 + /* If this variable is not a representative, skip it. */
4395 + if (find (i) != i)
4398 + /* In certain indirect cycle cases, we may merge this
4399 + variable to another. */
4400 + if (eliminate_indirect_cycles (i) && find (i) != i)
4403 /* If the node has changed, we need to process the
4404 complex constraints and outgoing edges again. */
4405 if (TEST_BIT (changed, i))
4409 - constraint_edge_t e = NULL;
4411 - bitmap_iterator bi;
4412 - VEC(constraint_t,heap) *complex = get_varinfo (i)->complex;
4413 - VEC(constraint_edge_t,heap) *succs;
4414 + VEC(constraint_t,heap) *complex = graph->complex[i];
4415 bool solution_empty;
4417 RESET_BIT (changed, i);
4420 + /* Compute the changed set of solution bits. */
4421 + bitmap_and_compl (pts, get_varinfo (i)->solution,
4422 + get_varinfo (i)->oldsolution);
4424 + if (bitmap_empty_p (pts))
4427 + bitmap_ior_into (get_varinfo (i)->oldsolution, pts);
4429 solution = get_varinfo (i)->solution;
4430 solution_empty = bitmap_empty_p (solution);
4432 @@ -2065,52 +2094,38 @@
4433 is a constraint where the lhs side is receiving
4434 some set from elsewhere. */
4435 if (!solution_empty || c->lhs.type != DEREF)
4436 - do_complex_constraint (graph, c, solution);
4437 + do_complex_constraint (graph, c, pts);
4440 solution_empty = bitmap_empty_p (solution);
4442 if (!solution_empty)
4444 + bitmap_iterator bi;
4446 /* Propagate solution to all successors. */
4447 - succs = graph->succs[i];
4449 - EXECUTE_IF_IN_NONNULL_BITMAP (graph->zero_weight_succs[i],
4450 + EXECUTE_IF_IN_NONNULL_BITMAP (graph->succs[i],
4453 - bitmap tmp = get_varinfo (j)->solution;
4454 - bool flag = false;
4456 - flag = set_union_with_increment (tmp, solution, 0);
4460 - get_varinfo (j)->solution = tmp;
4461 - if (!TEST_BIT (changed, j))
4463 - SET_BIT (changed, j);
4468 - for (j = 0; VEC_iterate (constraint_edge_t, succs, j, e); j++)
4470 - bitmap tmp = get_varinfo (e->dest)->solution;
4471 - bool flag = false;
4473 - bitmap weights = e->weights;
4474 - bitmap_iterator bi;
4478 - gcc_assert (weights && !bitmap_empty_p (weights));
4479 - EXECUTE_IF_SET_IN_BITMAP (weights, 0, k, bi)
4480 - flag |= set_union_with_increment (tmp, solution, k);
4481 + unsigned int to = find (j);
4482 + tmp = get_varinfo (to)->solution;
4485 + /* Don't try to propagate to ourselves. */
4489 + flag = set_union_with_increment (tmp, pts, 0);
4493 - get_varinfo (e->dest)->solution = tmp;
4494 - if (!TEST_BIT (changed, e->dest))
4495 + get_varinfo (to)->solution = tmp;
4496 + if (!TEST_BIT (changed, to))
4498 - SET_BIT (changed, e->dest);
4499 + SET_BIT (changed, to);
4503 @@ -2122,74 +2137,37 @@
4504 bitmap_obstack_release (&iteration_obstack);
4507 + BITMAP_FREE (pts);
4508 sbitmap_free (changed);
4509 + bitmap_obstack_release (&oldpta_obstack);
4512 +/* Map from trees to variable infos. */
4513 +static struct pointer_map_t *vi_for_tree;
4515 -/* CONSTRAINT AND VARIABLE GENERATION FUNCTIONS */
4517 -/* Map from trees to variable ids. */
4518 -static htab_t id_for_tree;
4519 +/* Insert ID as the variable id for tree T in the vi_for_tree map. */
4521 -typedef struct tree_id
4523 +insert_vi_for_tree (tree t, varinfo_t vi)
4529 -/* Hash a tree id structure. */
4532 -tree_id_hash (const void *p)
4534 - const tree_id_t ta = (tree_id_t) p;
4535 - return htab_hash_pointer (ta->t);
4538 -/* Return true if the tree in P1 and the tree in P2 are the same. */
4541 -tree_id_eq (const void *p1, const void *p2)
4543 - const tree_id_t ta1 = (tree_id_t) p1;
4544 - const tree_id_t ta2 = (tree_id_t) p2;
4545 - return ta1->t == ta2->t;
4548 -/* Insert ID as the variable id for tree T in the hashtable. */
4551 -insert_id_for_tree (tree t, int id)
4554 - struct tree_id finder;
4555 - tree_id_t new_pair;
4558 - slot = htab_find_slot (id_for_tree, &finder, INSERT);
4559 + void **slot = pointer_map_insert (vi_for_tree, t);
4561 gcc_assert (*slot == NULL);
4562 - new_pair = XNEW (struct tree_id);
4564 - new_pair->id = id;
4565 - *slot = (void *)new_pair;
4569 -/* Find the variable id for tree T in ID_FOR_TREE. If T does not
4570 - exist in the hash table, return false, otherwise, return true and
4571 - set *ID to the id we found. */
4572 +/* Find the variable info for tree T in VI_FOR_TREE. If T does not
4573 + exist in the map, return NULL, otherwise, return the varinfo we found. */
4576 -lookup_id_for_tree (tree t, unsigned int *id)
4578 +lookup_vi_for_tree (tree t)
4581 - struct tree_id finder;
4582 + void **slot = pointer_map_contains (vi_for_tree, t);
4587 - pair = htab_find (id_for_tree, &finder);
4592 + return (varinfo_t) *slot;
4595 /* Return a printable name for DECL */
4596 @@ -2210,7 +2188,7 @@
4598 if (TREE_CODE (decl) == SSA_NAME)
4600 - num_printed = asprintf (&temp, "%s_%u",
4601 + num_printed = asprintf (&temp, "%s_%u",
4602 alias_get_name (SSA_NAME_VAR (decl)),
4603 SSA_NAME_VERSION (decl));
4605 @@ -2226,21 +2204,17 @@
4609 -/* Find the variable id for tree T in the hashtable.
4610 - If T doesn't exist in the hash table, create an entry for it. */
4611 +/* Find the variable id for tree T in the map.
4612 + If T doesn't exist in the map, create an entry for it and return it. */
4614 -static unsigned int
4615 -get_id_for_tree (tree t)
4617 +get_vi_for_tree (tree t)
4620 - struct tree_id finder;
4621 + void **slot = pointer_map_contains (vi_for_tree, t);
4623 + return get_varinfo (create_variable_info_for (t, alias_get_name (t)));
4626 - pair = htab_find (id_for_tree, &finder);
4628 - return create_variable_info_for (t, alias_get_name (t));
4631 + return (varinfo_t) *slot;
4634 /* Get a constraint expression from an SSA_VAR_P node. */
4635 @@ -2254,14 +2228,14 @@
4637 /* For parameters, get at the points-to set for the actual parm
4639 - if (TREE_CODE (t) == SSA_NAME
4640 - && TREE_CODE (SSA_NAME_VAR (t)) == PARM_DECL
4641 + if (TREE_CODE (t) == SSA_NAME
4642 + && TREE_CODE (SSA_NAME_VAR (t)) == PARM_DECL
4643 && default_def (SSA_NAME_VAR (t)) == t)
4644 return get_constraint_exp_from_ssa_var (SSA_NAME_VAR (t));
4646 cexpr.type = SCALAR;
4648 - cexpr.var = get_id_for_tree (t);
4650 + cexpr.var = get_vi_for_tree (t)->id;
4651 /* If we determine the result is "anything", and we know this is readonly,
4652 say it points to readonly memory instead. */
4653 if (cexpr.var == anything_id && TREE_READONLY (t))
4654 @@ -2269,7 +2243,7 @@
4655 cexpr.type = ADDRESSOF;
4656 cexpr.var = readonly_id;
4663 @@ -2290,7 +2264,13 @@
4664 get_varinfo (lhs.var)->directly_dereferenced = true;
4665 if (rhs.type == DEREF)
4666 get_varinfo (rhs.var)->directly_dereferenced = true;
4669 + if (!use_field_sensitive)
4671 + t->rhs.offset = 0;
4672 + t->lhs.offset = 0;
4675 /* ANYTHING == ANYTHING is pointless. */
4676 if (lhs.var == anything_id && rhs.var == anything_id)
4678 @@ -2302,7 +2282,7 @@
4681 process_constraint (t);
4684 /* This can happen in our IR with things like n->a = *p */
4685 else if (rhs.type == DEREF && lhs.type == DEREF && rhs.var != anything_id)
4687 @@ -2312,33 +2292,19 @@
4688 tree pointedtotype = TREE_TYPE (pointertype);
4689 tree tmpvar = create_tmp_var_raw (pointedtotype, "doubledereftmp");
4690 struct constraint_expr tmplhs = get_constraint_exp_from_ssa_var (tmpvar);
4693 /* If this is an aggregate of known size, we should have passed
4694 this off to do_structure_copy, and it should have broken it
4696 - gcc_assert (!AGGREGATE_TYPE_P (pointedtotype)
4697 + gcc_assert (!AGGREGATE_TYPE_P (pointedtotype)
4698 || get_varinfo (rhs.var)->is_unknown_size_var);
4701 process_constraint (new_constraint (tmplhs, rhs));
4702 process_constraint (new_constraint (lhs, tmplhs));
4704 - else if (rhs.type == ADDRESSOF)
4707 - gcc_assert (rhs.offset == 0);
4709 - /* No need to mark address taken simply because of escaped vars
4711 - if (lhs.var != escaped_vars_id)
4712 - for (vi = get_varinfo (rhs.var); vi != NULL; vi = vi->next)
4713 - vi->address_taken = true;
4715 - VEC_safe_push (constraint_t, heap, constraints, t);
4719 - if (lhs.type != DEREF && rhs.type == DEREF)
4720 - get_varinfo (lhs.var)->indirect_target = true;
4721 + gcc_assert (rhs.type != ADDRESSOF || rhs.offset == 0);
4722 VEC_safe_push (constraint_t, heap, constraints, t);
4725 @@ -2350,10 +2316,12 @@
4726 could_have_pointers (tree t)
4728 tree type = TREE_TYPE (t);
4730 - if (POINTER_TYPE_P (type) || AGGREGATE_TYPE_P (type)
4732 + if (POINTER_TYPE_P (type)
4733 + || AGGREGATE_TYPE_P (type)
4734 || TREE_CODE (type) == COMPLEX_TYPE)
4740 @@ -2367,9 +2335,9 @@
4741 if (TREE_CODE (DECL_FIELD_OFFSET (fdecl)) != INTEGER_CST
4742 || TREE_CODE (DECL_FIELD_BIT_OFFSET (fdecl)) != INTEGER_CST)
4745 - return (tree_low_cst (DECL_FIELD_OFFSET (fdecl), 1) * 8)
4746 - + tree_low_cst (DECL_FIELD_BIT_OFFSET (fdecl), 1);
4748 + return (tree_low_cst (DECL_FIELD_OFFSET (fdecl), 1) * 8)
4749 + + tree_low_cst (DECL_FIELD_BIT_OFFSET (fdecl), 1);
4753 @@ -2388,7 +2356,7 @@
4755 if (accesspos < fieldpos && (accesspos + accesssize > fieldpos))
4762 @@ -2411,20 +2379,20 @@
4763 while (!SSA_VAR_P (forzero) && !CONSTANT_CLASS_P (forzero))
4764 forzero = TREE_OPERAND (forzero, 0);
4766 - if (CONSTANT_CLASS_P (forzero) && integer_zerop (forzero))
4767 + if (CONSTANT_CLASS_P (forzero) && integer_zerop (forzero))
4769 struct constraint_expr temp;
4773 temp.var = integer_id;
4775 VEC_safe_push (ce_s, heap, *results, &temp);
4780 t = get_ref_base_and_extent (t, &bitpos, &bitsize, &bitmaxsize);
4782 - /* String constants's are readonly, so there is nothing to really do
4783 + /* String constants are readonly, so there is nothing to really do
4785 if (TREE_CODE (t) == STRING_CST)
4787 @@ -2438,21 +2406,21 @@
4788 /* This can also happen due to weird offsetof type macros. */
4789 if (TREE_CODE (t) != ADDR_EXPR && result->type == ADDRESSOF)
4790 result->type = SCALAR;
4793 if (result->type == SCALAR)
4795 /* In languages like C, you can access one past the end of an
4796 array. You aren't allowed to dereference it, so we can
4797 ignore this constraint. When we handle pointer subtraction,
4798 we may have to do something cute here. */
4801 if (result->offset < get_varinfo (result->var)->fullsize
4804 /* It's also not true that the constraint will actually start at the
4805 right offset, it may start in some padding. We only care about
4806 setting the constraint to the first actual field it touches, so
4807 - walk to find it. */
4808 + walk to find it. */
4810 for (curr = get_varinfo (result->var); curr; curr = curr->next)
4812 @@ -2495,6 +2463,7 @@
4814 struct constraint_expr *c;
4817 for (i = 0; VEC_iterate (ce_s, *constraints, i, c); i++)
4819 if (c->type == SCALAR)
4820 @@ -2576,6 +2545,7 @@
4821 tree pttype = TREE_TYPE (TREE_TYPE (t));
4823 get_constraint_for (exp, results);
4825 /* Make sure we capture constraints to all elements
4827 if ((handled_component_p (exp)
4828 @@ -2588,7 +2558,7 @@
4830 if (VEC_length (ce_s, *results) == 0)
4834 gcc_assert (VEC_length (ce_s, *results) == 1);
4835 origrhs = VEC_last (ce_s, *results);
4837 @@ -2619,12 +2589,12 @@
4838 VEC_safe_push (ce_s, heap, *results, &tmp);
4843 for (i = 0; VEC_iterate (ce_s, *results, i, c); i++)
4845 if (c->type == DEREF)
4849 c->type = ADDRESSOF;
4852 @@ -2638,9 +2608,9 @@
4855 tree heapvar = heapvar_lookup (t);
4858 if (heapvar == NULL)
4861 heapvar = create_tmp_var_raw (ptr_type_node, "HEAP");
4862 DECL_EXTERNAL (heapvar) = 1;
4863 if (referenced_vars)
4864 @@ -2650,7 +2620,7 @@
4866 temp.var = create_variable_info_for (heapvar,
4867 alias_get_name (heapvar));
4870 vi = get_varinfo (temp.var);
4871 vi->is_artificial_var = 1;
4872 vi->is_heap_var = 1;
4873 @@ -2712,7 +2682,7 @@
4874 case NON_LVALUE_EXPR:
4876 tree op = TREE_OPERAND (t, 0);
4879 /* Cast from non-pointer to pointers are bad news for us.
4880 Anything else, we see through */
4881 if (!(POINTER_TYPE_P (TREE_TYPE (t))
4882 @@ -2738,7 +2708,7 @@
4884 switch (TREE_CODE (t))
4889 get_constraint_for (PHI_RESULT (t), results);
4891 @@ -2782,8 +2752,8 @@
4894 /* Handle the structure copy case where we have a simple structure copy
4895 - between LHS and RHS that is of SIZE (in bits)
4897 + between LHS and RHS that is of SIZE (in bits)
4899 For each field of the lhs variable (lhsfield)
4900 For each field of the rhs variable at lhsfield.offset (rhsfield)
4901 add the constraint lhsfield = rhsfield
4902 @@ -2808,7 +2778,7 @@
4903 struct constraint_expr temprhs = rhs;
4904 unsigned HOST_WIDE_INT fieldoffset;
4906 - templhs.var = p->id;
4907 + templhs.var = p->id;
4908 q = get_varinfo (temprhs.var);
4909 fieldoffset = p->offset - pstart;
4910 q = first_vi_for_offset (q, q->offset + fieldoffset);
4911 @@ -2823,8 +2793,8 @@
4913 /* Handle the structure copy case where we have a structure copy between a
4914 aggregate on the LHS and a dereference of a pointer on the RHS
4915 - that is of SIZE (in bits)
4917 + that is of SIZE (in bits)
4919 For each field of the lhs variable (lhsfield)
4920 rhs.offset = lhsfield->offset
4921 add the constraint lhsfield = rhs
4922 @@ -2849,12 +2819,12 @@
4925 if (templhs.type == SCALAR)
4926 - templhs.var = p->id;
4927 + templhs.var = p->id;
4929 templhs.offset = p->offset;
4932 q = get_varinfo (temprhs.var);
4933 - fieldoffset = p->offset - pstart;
4934 + fieldoffset = p->offset - pstart;
4935 temprhs.offset += fieldoffset;
4936 process_constraint (new_constraint (templhs, temprhs));
4938 @@ -2862,7 +2832,7 @@
4940 /* Handle the structure copy case where we have a structure copy
4941 between a aggregate on the RHS and a dereference of a pointer on
4942 - the LHS that is of SIZE (in bits)
4943 + the LHS that is of SIZE (in bits)
4945 For each field of the rhs variable (rhsfield)
4946 lhs.offset = rhsfield->offset
4947 @@ -2888,12 +2858,12 @@
4950 if (temprhs.type == SCALAR)
4951 - temprhs.var = p->id;
4952 + temprhs.var = p->id;
4954 temprhs.offset = p->offset;
4957 q = get_varinfo (templhs.var);
4958 - fieldoffset = p->offset - pstart;
4959 + fieldoffset = p->offset - pstart;
4960 templhs.offset += fieldoffset;
4961 process_constraint (new_constraint (templhs, temprhs));
4963 @@ -2901,7 +2871,7 @@
4965 /* Sometimes, frontends like to give us bad type information. This
4966 function will collapse all the fields from VAR to the end of VAR,
4967 - into VAR, so that we treat those fields as a single variable.
4968 + into VAR, so that we treat those fields as a single variable.
4969 We return the variable they were collapsed into. */
4972 @@ -2913,16 +2883,16 @@
4973 for (field = currvar->next; field; field = field->next)
4976 - fprintf (dump_file, "Type safety: Collapsing var %s into %s\n",
4977 + fprintf (dump_file, "Type safety: Collapsing var %s into %s\n",
4978 field->name, currvar->name);
4981 gcc_assert (!field->collapsed_to);
4982 field->collapsed_to = currvar;
4985 currvar->next = NULL;
4986 currvar->size = currvar->fullsize - currvar->offset;
4992 @@ -2944,7 +2914,7 @@
4993 gcc_assert (VEC_length (ce_s, rhsc) == 1);
4994 lhs = *(VEC_last (ce_s, lhsc));
4995 rhs = *(VEC_last (ce_s, rhsc));
4998 VEC_free (ce_s, heap, lhsc);
4999 VEC_free (ce_s, heap, rhsc);
5001 @@ -2955,7 +2925,7 @@
5007 /* This is fairly conservative for the RHS == ADDRESSOF case, in that it's
5008 possible it's something we could handle. However, most cases falling
5009 into this are dealing with transparent unions, which are slightly
5010 @@ -3021,11 +2991,11 @@
5012 lhssize = TREE_INT_CST_LOW (lhstypesize);
5015 - if (rhs.type == SCALAR && lhs.type == SCALAR)
5017 + if (rhs.type == SCALAR && lhs.type == SCALAR)
5019 if (!do_simple_structure_copy (lhs, rhs, MIN (lhssize, rhssize)))
5022 lhs.var = collapse_rest_of_var (lhs.var);
5023 rhs.var = collapse_rest_of_var (rhs.var);
5025 @@ -3042,7 +3012,7 @@
5028 tree pointedtotype = lhstype;
5032 gcc_assert (rhs.type == DEREF && lhs.type == DEREF);
5033 tmpvar = create_tmp_var_raw (pointedtotype, "structcopydereftmp");
5034 @@ -3052,6 +3022,7 @@
5039 /* Update related alias information kept in AI. This is used when
5040 building name tags, alias sets and deciding grouping heuristics.
5041 STMT is the statement to process. This function also updates
5042 @@ -3261,7 +3232,6 @@
5047 /* Handle pointer arithmetic EXPR when creating aliasing constraints.
5048 Expressions of the type PTR + CST can be handled in two ways:
5050 @@ -3307,6 +3277,7 @@
5055 for (i = 0; VEC_iterate (ce_s, lhsc, i, c); i++)
5056 for (j = 0; VEC_iterate (ce_s, temp, j, c2); j++)
5058 @@ -3360,12 +3331,12 @@
5064 /* For a phi node, assign all the arguments to
5066 get_constraint_for (PHI_RESULT (t), &lhsc);
5067 for (i = 0; i < PHI_NUM_ARGS (t); i++)
5071 tree strippedrhs = PHI_ARG_DEF (t, i);
5073 @@ -3401,7 +3372,6 @@
5077 - unsigned int varid;
5081 @@ -3423,17 +3393,16 @@
5082 we should still be able to handle. */
5085 - varid = get_id_for_tree (decl);
5086 + fi = get_vi_for_tree (decl);
5090 decl = TREE_OPERAND (rhsop, 0);
5091 - varid = get_id_for_tree (decl);
5092 + fi = get_vi_for_tree (decl);
5095 /* Assign all the passed arguments to the appropriate incoming
5096 parameters of the function. */
5097 - fi = get_varinfo (varid);
5098 arglist = TREE_OPERAND (rhsop, 1);
5100 for (;arglist; arglist = TREE_CHAIN (arglist))
5101 @@ -3463,13 +3432,14 @@
5106 /* If we are returning a value, assign it to the result. */
5109 struct constraint_expr rhs;
5110 struct constraint_expr *lhsp;
5114 get_constraint_for (lhsop, &lhsc);
5115 if (TREE_CODE (decl) != FUNCTION_DECL)
5117 @@ -3485,7 +3455,7 @@
5119 for (j = 0; VEC_iterate (ce_s, lhsc, j, lhsp); j++)
5120 process_constraint (new_constraint (*lhsp, rhs));
5124 /* Otherwise, just a regular assignment statement. */
5125 else if (TREE_CODE (t) == MODIFY_EXPR)
5126 @@ -3494,7 +3464,7 @@
5127 tree rhsop = TREE_OPERAND (t, 1);
5130 - if ((AGGREGATE_TYPE_P (TREE_TYPE (lhsop))
5131 + if ((AGGREGATE_TYPE_P (TREE_TYPE (lhsop))
5132 || TREE_CODE (TREE_TYPE (lhsop)) == COMPLEX_TYPE)
5133 && (AGGREGATE_TYPE_P (TREE_TYPE (rhsop))
5134 || TREE_CODE (TREE_TYPE (lhsop)) == COMPLEX_TYPE))
5135 @@ -3513,7 +3483,7 @@
5137 /* RHS that consist of unary operations,
5138 exceptional types, or bare decls/constants, get
5139 - handled directly by get_constraint_for. */
5140 + handled directly by get_constraint_for. */
5142 case tcc_declaration:
5144 @@ -3528,7 +3498,7 @@
5146 struct constraint_expr *c2;
5150 for (k = 0; VEC_iterate (ce_s, rhsc, k, c2); k++)
5151 process_constraint (new_constraint (*c, *c2));
5153 @@ -3570,7 +3540,7 @@
5162 @@ -3578,7 +3548,7 @@
5163 /* After promoting variables and computing aliasing we will
5164 need to re-scan most statements. FIXME: Try to minimize the
5165 number of statements re-scanned. It's not really necessary to
5166 - re-scan *all* statements. */
5167 + re-scan *all* statements. */
5168 mark_stmt_modified (origt);
5169 VEC_free (ce_s, heap, rhsc);
5170 VEC_free (ce_s, heap, lhsc);
5171 @@ -3591,7 +3561,7 @@
5172 first field that overlaps with OFFSET.
5173 Return NULL if we can't find one. */
5177 first_vi_for_offset (varinfo_t start, unsigned HOST_WIDE_INT offset)
5179 varinfo_t curr = start;
5180 @@ -3617,7 +3587,7 @@
5182 varinfo_t prev = base;
5183 varinfo_t curr = base->next;
5189 @@ -3630,7 +3600,7 @@
5191 varinfo_t prev = base;
5192 varinfo_t curr = base->next;
5198 @@ -3652,13 +3622,13 @@
5200 /* qsort comparison function for two fieldoff's PA and PB */
5204 fieldoff_compare (const void *pa, const void *pb)
5206 const fieldoff_s *foa = (const fieldoff_s *)pa;
5207 const fieldoff_s *fob = (const fieldoff_s *)pb;
5208 HOST_WIDE_INT foasize, fobsize;
5211 if (foa->offset != fob->offset)
5212 return foa->offset - fob->offset;
5214 @@ -3671,8 +3641,8 @@
5216 sort_fieldstack (VEC(fieldoff_s,heap) *fieldstack)
5218 - qsort (VEC_address (fieldoff_s, fieldstack),
5219 - VEC_length (fieldoff_s, fieldstack),
5220 + qsort (VEC_address (fieldoff_s, fieldstack),
5221 + VEC_length (fieldoff_s, fieldstack),
5222 sizeof (fieldoff_s),
5225 @@ -3686,12 +3656,12 @@
5229 -push_fields_onto_fieldstack (tree type, VEC(fieldoff_s,heap) **fieldstack,
5230 +push_fields_onto_fieldstack (tree type, VEC(fieldoff_s,heap) **fieldstack,
5231 HOST_WIDE_INT offset, bool *has_union)
5237 if (TREE_CODE (type) == COMPLEX_TYPE)
5239 fieldoff_s *real_part, *img_part;
5240 @@ -3700,13 +3670,13 @@
5241 real_part->size = TYPE_SIZE (TREE_TYPE (type));
5242 real_part->offset = offset;
5243 real_part->decl = NULL_TREE;
5246 img_part = VEC_safe_push (fieldoff_s, heap, *fieldstack, NULL);
5247 img_part->type = TREE_TYPE (type);
5248 img_part->size = TYPE_SIZE (TREE_TYPE (type));
5249 img_part->offset = offset + TREE_INT_CST_LOW (TYPE_SIZE (TREE_TYPE (type)));
5250 img_part->decl = NULL_TREE;
5256 @@ -3733,12 +3703,12 @@
5264 && (TREE_CODE (TREE_TYPE (type)) == QUAL_UNION_TYPE
5265 || TREE_CODE (TREE_TYPE (type)) == UNION_TYPE))
5269 if (!AGGREGATE_TYPE_P (TREE_TYPE (type))) /* var_can_have_subvars */
5271 else if (!(pushed = push_fields_onto_fieldstack
5272 @@ -3772,12 +3742,12 @@
5280 && (TREE_CODE (TREE_TYPE (field)) == QUAL_UNION_TYPE
5281 || TREE_CODE (TREE_TYPE (field)) == UNION_TYPE))
5285 if (!var_can_have_subvars (field))
5287 else if (!(pushed = push_fields_onto_fieldstack
5288 @@ -3789,7 +3759,7 @@
5289 see if we didn't push any subfields and the size is
5290 nonzero, push the field onto the stack */
5297 @@ -3848,15 +3818,15 @@
5301 - for (t = TYPE_ARG_TYPES (TREE_TYPE (decl));
5302 + for (t = TYPE_ARG_TYPES (TREE_TYPE (decl));
5307 if (TREE_VALUE (t) == void_type_node)
5316 @@ -3870,19 +3840,19 @@
5318 unsigned int index = VEC_length (varinfo_t, varmap);
5323 bool is_varargs = false;
5325 /* Create the variable info. */
5327 - vi = new_var_info (decl, index, name, index);
5328 + vi = new_var_info (decl, index, name);
5333 vi->fullsize = count_num_arguments (decl, &is_varargs) + 1;
5334 - insert_id_for_tree (vi->decl, index);
5335 + insert_vi_for_tree (vi->decl, vi);
5336 VEC_safe_push (varinfo_t, heap, varmap, vi);
5339 @@ -3898,12 +3868,12 @@
5345 arg = DECL_ARGUMENTS (decl);
5347 /* Set up variables for each argument. */
5348 for (i = 1; i < vi->fullsize; i++)
5352 const char *newname;
5354 @@ -3912,13 +3882,13 @@
5360 newindex = VEC_length (varinfo_t, varmap);
5361 asprintf (&tempname, "%s.arg%d", name, i-1);
5362 newname = ggc_strdup (tempname);
5365 - argvi = new_var_info (argdecl, newindex,newname, newindex);
5366 + argvi = new_var_info (argdecl, newindex, newname);
5367 argvi->decl = argdecl;
5368 VEC_safe_push (varinfo_t, heap, varmap, argvi);
5370 @@ -3929,7 +3899,7 @@
5371 stats.total_vars ++;
5374 - insert_id_for_tree (arg, newindex);
5375 + insert_vi_for_tree (arg, argvi);
5376 arg = TREE_CHAIN (arg);
5379 @@ -3948,13 +3918,13 @@
5381 if (DECL_RESULT (decl))
5382 resultdecl = DECL_RESULT (decl);
5385 newindex = VEC_length (varinfo_t, varmap);
5386 asprintf (&tempname, "%s.result", name);
5387 newname = ggc_strdup (tempname);
5390 - resultvi = new_var_info (resultdecl, newindex, newname, newindex);
5391 + resultvi = new_var_info (resultdecl, newindex, newname);
5392 resultvi->decl = resultdecl;
5393 VEC_safe_push (varinfo_t, heap, varmap, resultvi);
5394 resultvi->offset = i;
5395 @@ -3964,13 +3934,13 @@
5396 insert_into_field_list_sorted (vi, resultvi);
5397 stats.total_vars ++;
5398 if (DECL_RESULT (decl))
5399 - insert_id_for_tree (DECL_RESULT (decl), newindex);
5400 + insert_vi_for_tree (DECL_RESULT (decl), resultvi);
5407 -/* Return true if FIELDSTACK contains fields that overlap.
5408 +/* Return true if FIELDSTACK contains fields that overlap.
5409 FIELDSTACK is assumed to be sorted by offset. */
5412 @@ -4057,12 +4027,12 @@
5414 bool is_global = DECL_P (decl) ? is_global_var (decl) : false;
5415 VEC (fieldoff_s,heap) *fieldstack = NULL;
5418 if (TREE_CODE (decl) == FUNCTION_DECL && in_ipa_mode)
5419 return create_function_info_for (decl, name);
5421 hasunion = TREE_CODE (decltype) == UNION_TYPE
5422 - || TREE_CODE (decltype) == QUAL_UNION_TYPE;
5423 + || TREE_CODE (decltype) == QUAL_UNION_TYPE;
5424 if (var_can_have_subvars (decl) && use_field_sensitive && !hasunion)
5426 push_fields_onto_fieldstack (decltype, &fieldstack, 0, &hasunion);
5427 @@ -4072,12 +4042,12 @@
5434 /* If the variable doesn't have subvars, we may end up needing to
5435 sort the field list and create fake variables for all the
5437 - vi = new_var_info (decl, index, name, index);
5438 + vi = new_var_info (decl, index, name);
5441 vi->has_union = hasunion;
5442 @@ -4095,8 +4065,8 @@
5443 vi->fullsize = TREE_INT_CST_LOW (declsize);
5444 vi->size = vi->fullsize;
5447 - insert_id_for_tree (vi->decl, index);
5449 + insert_vi_for_tree (vi->decl, vi);
5450 VEC_safe_push (varinfo_t, heap, varmap, vi);
5451 if (is_global && (!flag_whole_program || !in_ipa_mode))
5453 @@ -4122,9 +4092,9 @@
5457 - if (use_field_sensitive
5459 - && !vi->is_unknown_size_var
5460 + if (use_field_sensitive
5462 + && !vi->is_unknown_size_var
5463 && var_can_have_subvars (decl)
5464 && VEC_length (fieldoff_s, fieldstack) <= MAX_FIELDS_FOR_FIELD_SENSITIVE)
5466 @@ -4148,7 +4118,7 @@
5467 without creating varinfos for the fields anyway, so sorting them is a
5472 sort_fieldstack (fieldstack);
5473 /* Due to some C++ FE issues, like PR 22488, we might end up
5474 what appear to be overlapping fields even though they,
5475 @@ -4156,8 +4126,8 @@
5476 we will simply disable field-sensitivity for these cases. */
5477 notokay = check_for_overlaps (fieldstack);
5483 if (VEC_length (fieldoff_s, fieldstack) != 0)
5484 fo = VEC_index (fieldoff_s, fieldstack, 0);
5486 @@ -4169,11 +4139,11 @@
5487 VEC_free (fieldoff_s, heap, fieldstack);
5492 vi->size = TREE_INT_CST_LOW (fo->size);
5493 vi->offset = fo->offset;
5494 - for (i = VEC_length (fieldoff_s, fieldstack) - 1;
5495 - i >= 1 && VEC_iterate (fieldoff_s, fieldstack, i, fo);
5496 + for (i = VEC_length (fieldoff_s, fieldstack) - 1;
5497 + i >= 1 && VEC_iterate (fieldoff_s, fieldstack, i, fo);
5501 @@ -4184,15 +4154,15 @@
5505 - asprintf (&tempname, "%s.%s",
5506 + asprintf (&tempname, "%s.%s",
5507 vi->name, alias_get_name (fo->decl));
5509 - asprintf (&tempname, "%s." HOST_WIDE_INT_PRINT_DEC,
5510 + asprintf (&tempname, "%s." HOST_WIDE_INT_PRINT_DEC,
5511 vi->name, fo->offset);
5512 newname = ggc_strdup (tempname);
5515 - newvi = new_var_info (decl, newindex, newname, newindex);
5516 + newvi = new_var_info (decl, newindex, newname);
5517 newvi->offset = fo->offset;
5518 newvi->size = TREE_INT_CST_LOW (fo->size);
5519 newvi->fullsize = vi->fullsize;
5520 @@ -4228,14 +4198,22 @@
5522 varinfo_t vi = get_varinfo (var);
5524 - bitmap_iterator bi;
5526 - fprintf (file, "%s = { ", vi->name);
5527 - EXECUTE_IF_SET_IN_BITMAP (get_varinfo (vi->node)->solution, 0, i, bi)
5528 + bitmap_iterator bi;
5530 + if (find (var) != var)
5532 - fprintf (file, "%s ", get_varinfo (i)->name);
5533 + varinfo_t vipt = get_varinfo (find (var));
5534 + fprintf (file, "%s = same as %s\n", vi->name, vipt->name);
5536 - fprintf (file, "}\n");
5539 + fprintf (file, "%s = { ", vi->name);
5540 + EXECUTE_IF_SET_IN_BITMAP (vi->solution, 0, i, bi)
5542 + fprintf (file, "%s ", get_varinfo (i)->name);
5544 + fprintf (file, "}\n");
5548 /* Print the points-to solution for VAR to stdout. */
5549 @@ -4266,7 +4244,7 @@
5550 if (!could_have_pointers (t))
5553 - arg_id = get_id_for_tree (t);
5554 + arg_id = get_vi_for_tree (t)->id;
5556 /* With flag_argument_noalias greater than two means that the incoming
5557 argument cannot alias anything except for itself so create a HEAP
5558 @@ -4276,11 +4254,10 @@
5561 tree heapvar = heapvar_lookup (t);
5566 - lhs.var = get_id_for_tree (t);
5567 + lhs.var = get_vi_for_tree (t)->id;
5569 if (heapvar == NULL_TREE)
5571 @@ -4291,11 +4268,11 @@
5572 add_referenced_var (heapvar);
5573 heapvar_insert (t, heapvar);
5575 - id = get_id_for_tree (heapvar);
5576 - vi = get_varinfo (id);
5578 + vi = get_vi_for_tree (heapvar);
5579 vi->is_artificial_var = 1;
5580 vi->is_heap_var = 1;
5583 rhs.type = ADDRESSOF;
5585 for (p = get_varinfo (lhs.var); p; p = p->next)
5586 @@ -4409,8 +4386,8 @@
5588 find_what_p_points_to (tree p)
5590 - unsigned int id = 0;
5594 if (!have_alias_info)
5596 @@ -4422,10 +4399,10 @@
5597 && default_def (SSA_NAME_VAR (p)) == p)
5598 lookup_p = SSA_NAME_VAR (p);
5600 - if (lookup_id_for_tree (lookup_p, &id))
5601 + vi = lookup_vi_for_tree (lookup_p);
5604 - varinfo_t vi = get_varinfo (id);
5607 if (vi->is_artificial_var)
5610 @@ -4447,7 +4424,7 @@
5612 /* This variable may have been collapsed, let's get the real
5614 - vi = get_varinfo (vi->node);
5615 + vi = get_varinfo (find (vi->id));
5617 /* Translate artificial variables into SSA_NAME_PTR_INFO
5619 @@ -4506,13 +4483,16 @@
5621 fprintf (outfile, "Stats:\n");
5622 fprintf (outfile, "Total vars: %d\n", stats.total_vars);
5623 + fprintf (outfile, "Non-pointer vars: %d\n",
5624 + stats.nonpointer_vars);
5625 fprintf (outfile, "Statically unified vars: %d\n",
5626 stats.unified_vars_static);
5627 - fprintf (outfile, "Collapsed vars: %d\n", stats.collapsed_vars);
5628 fprintf (outfile, "Dynamically unified vars: %d\n",
5629 stats.unified_vars_dynamic);
5630 fprintf (outfile, "Iterations: %d\n", stats.iterations);
5631 fprintf (outfile, "Number of edges: %d\n", stats.num_edges);
5632 + fprintf (outfile, "Number of implicit edges: %d\n",
5633 + stats.num_implicit_edges);
5636 for (i = 0; i < VEC_length (varinfo_t, varmap); i++)
5637 @@ -4540,8 +4520,8 @@
5638 /* Create the NULL variable, used to represent that a variable points
5640 nothing_tree = create_tmp_var_raw (void_type_node, "NULL");
5641 - var_nothing = new_var_info (nothing_tree, 0, "NULL", 0);
5642 - insert_id_for_tree (nothing_tree, 0);
5643 + var_nothing = new_var_info (nothing_tree, 0, "NULL");
5644 + insert_vi_for_tree (nothing_tree, var_nothing);
5645 var_nothing->is_artificial_var = 1;
5646 var_nothing->offset = 0;
5647 var_nothing->size = ~0;
5648 @@ -4553,8 +4533,8 @@
5649 /* Create the ANYTHING variable, used to represent that a variable
5650 points to some unknown piece of memory. */
5651 anything_tree = create_tmp_var_raw (void_type_node, "ANYTHING");
5652 - var_anything = new_var_info (anything_tree, 1, "ANYTHING", 1);
5653 - insert_id_for_tree (anything_tree, 1);
5654 + var_anything = new_var_info (anything_tree, 1, "ANYTHING");
5655 + insert_vi_for_tree (anything_tree, var_anything);
5656 var_anything->is_artificial_var = 1;
5657 var_anything->size = ~0;
5658 var_anything->offset = 0;
5659 @@ -4573,7 +4553,6 @@
5660 rhs.type = ADDRESSOF;
5661 rhs.var = anything_id;
5663 - var_anything->address_taken = true;
5665 /* This specifically does not use process_constraint because
5666 process_constraint ignores all anything = anything constraints, since all
5667 @@ -4583,14 +4562,14 @@
5668 /* Create the READONLY variable, used to represent that a variable
5669 points to readonly memory. */
5670 readonly_tree = create_tmp_var_raw (void_type_node, "READONLY");
5671 - var_readonly = new_var_info (readonly_tree, 2, "READONLY", 2);
5672 + var_readonly = new_var_info (readonly_tree, 2, "READONLY");
5673 var_readonly->is_artificial_var = 1;
5674 var_readonly->offset = 0;
5675 var_readonly->size = ~0;
5676 var_readonly->fullsize = ~0;
5677 var_readonly->next = NULL;
5678 var_readonly->is_special_var = 1;
5679 - insert_id_for_tree (readonly_tree, 2);
5680 + insert_vi_for_tree (readonly_tree, var_readonly);
5682 VEC_safe_push (varinfo_t, heap, varmap, var_readonly);
5684 @@ -4610,8 +4589,8 @@
5685 /* Create the INTEGER variable, used to represent that a variable points
5687 integer_tree = create_tmp_var_raw (void_type_node, "INTEGER");
5688 - var_integer = new_var_info (integer_tree, 3, "INTEGER", 3);
5689 - insert_id_for_tree (integer_tree, 3);
5690 + var_integer = new_var_info (integer_tree, 3, "INTEGER");
5691 + insert_vi_for_tree (integer_tree, var_integer);
5692 var_integer->is_artificial_var = 1;
5693 var_integer->size = ~0;
5694 var_integer->fullsize = ~0;
5695 @@ -4634,8 +4613,8 @@
5696 /* Create the ESCAPED_VARS variable used to represent variables that
5697 escape this function. */
5698 escaped_vars_tree = create_tmp_var_raw (void_type_node, "ESCAPED_VARS");
5699 - var_escaped_vars = new_var_info (escaped_vars_tree, 4, "ESCAPED_VARS", 4);
5700 - insert_id_for_tree (escaped_vars_tree, 4);
5701 + var_escaped_vars = new_var_info (escaped_vars_tree, 4, "ESCAPED_VARS");
5702 + insert_vi_for_tree (escaped_vars_tree, var_escaped_vars);
5703 var_escaped_vars->is_artificial_var = 1;
5704 var_escaped_vars->size = ~0;
5705 var_escaped_vars->fullsize = ~0;
5706 @@ -4660,21 +4639,19 @@
5708 init_alias_vars (void)
5710 - bitmap_obstack_initialize (&ptabitmap_obstack);
5711 + bitmap_obstack_initialize (&pta_obstack);
5712 + bitmap_obstack_initialize (&oldpta_obstack);
5713 bitmap_obstack_initialize (&predbitmap_obstack);
5715 - constraint_pool = create_alloc_pool ("Constraint pool",
5716 + constraint_pool = create_alloc_pool ("Constraint pool",
5717 sizeof (struct constraint), 30);
5718 variable_info_pool = create_alloc_pool ("Variable info pool",
5719 sizeof (struct variable_info), 30);
5720 - constraint_edge_pool = create_alloc_pool ("Constraint edges",
5721 - sizeof (struct constraint_edge), 30);
5723 constraints = VEC_alloc (constraint_t, heap, 8);
5724 varmap = VEC_alloc (varinfo_t, heap, 8);
5725 - id_for_tree = htab_create (10, tree_id_hash, tree_id_eq, free);
5726 + vi_for_tree = pointer_map_create ();
5728 memset (&stats, 0, sizeof (stats));
5733 @@ -4777,6 +4754,43 @@
5734 VEC_free (ce_s, heap, rhsc);
5738 +/* Remove the REF and ADDRESS edges from GRAPH, as well as all the
5739 + predecessor edges. */
5742 +remove_preds_and_fake_succs (constraint_graph_t graph)
5746 + /* Clear the implicit ref and address nodes from the successor
5748 + for (i = 0; i < FIRST_REF_NODE; i++)
5750 + if (graph->succs[i])
5751 + bitmap_clear_range (graph->succs[i], FIRST_REF_NODE,
5752 + FIRST_REF_NODE * 2);
5755 + /* Free the successor list for the non-ref nodes. */
5756 + for (i = FIRST_REF_NODE; i < graph->size; i++)
5758 + if (graph->succs[i])
5759 + BITMAP_FREE (graph->succs[i]);
5762 + /* Now reallocate the size of the successor list as, and blow away
5763 + the predecessor bitmaps. */
5764 + graph->size = VEC_length (varinfo_t, varmap);
5765 + graph->succs = xrealloc (graph->succs, graph->size * sizeof (bitmap));
5767 + free (graph->implicit_preds);
5768 + graph->implicit_preds = NULL;
5769 + free (graph->preds);
5770 + graph->preds = NULL;
5771 + bitmap_obstack_release (&predbitmap_obstack);
5774 /* Create points-to sets for the current function. See the comments
5775 at the start of the file for an algorithmic overview. */
5777 @@ -4784,11 +4798,13 @@
5778 compute_points_to_sets (struct alias_info *ai)
5781 + struct scc_info *si;
5783 timevar_push (TV_TREE_PTA);
5787 + init_alias_heapvars ();
5789 intra_create_variable_infos ();
5791 /* Now walk all statements and derive aliases. */
5792 @@ -4824,36 +4840,42 @@
5796 - build_constraint_graph ();
5800 fprintf (dump_file, "Points-to analysis\n\nConstraints:\n\n");
5801 dump_constraints (dump_file);
5807 "\nCollapsing static cycles and doing variable "
5810 - find_and_collapse_graph_cycles (graph, false);
5811 - perform_var_substitution (graph);
5814 + build_pred_graph ();
5815 + si = perform_var_substitution (graph);
5816 + move_complex_constraints (graph, si);
5817 + free_var_substitution_info (si);
5819 + build_succ_graph ();
5820 + find_indirect_cycles (graph);
5822 + /* Implicit nodes and predecessors are no longer necessary at this
5824 + remove_preds_and_fake_succs (graph);
5827 fprintf (dump_file, "\nSolving graph:\n");
5830 solve_graph (graph);
5834 dump_sa_points_to_info (dump_file);
5836 have_alias_info = true;
5838 timevar_pop (TV_TREE_PTA);
5842 /* Delete created points-to sets. */
5845 @@ -4861,33 +4883,27 @@
5850 - htab_delete (id_for_tree);
5851 - bitmap_obstack_release (&ptabitmap_obstack);
5852 - bitmap_obstack_release (&predbitmap_obstack);
5854 + if (dump_file && (dump_flags & TDF_STATS))
5855 + fprintf (dump_file, "Points to sets created:%d\n",
5856 + stats.points_to_sets_created);
5858 + pointer_map_destroy (vi_for_tree);
5859 + bitmap_obstack_release (&pta_obstack);
5860 VEC_free (constraint_t, heap, constraints);
5863 for (i = 0; VEC_iterate (varinfo_t, varmap, i, v); i++)
5865 - /* Nonlocal vars may add more varinfos. */
5866 - if (i >= graph_size)
5868 + VEC_free (constraint_t, heap, graph->complex[i]);
5869 + free (graph->complex);
5871 - VEC_free (constraint_edge_t, heap, graph->succs[i]);
5872 - VEC_free (constraint_edge_t, heap, graph->preds[i]);
5873 - VEC_free (constraint_t, heap, v->complex);
5875 - free (graph->zero_weight_preds);
5876 - free (graph->zero_weight_succs);
5877 + free (graph->rep);
5878 free (graph->succs);
5879 - free (graph->preds);
5880 + free (graph->indirect_cycles);
5883 VEC_free (varinfo_t, heap, varmap);
5884 free_alloc_pool (variable_info_pool);
5885 - free_alloc_pool (constraint_pool);
5886 - free_alloc_pool (constraint_edge_pool);
5888 + free_alloc_pool (constraint_pool);
5889 have_alias_info = false;
5892 @@ -4905,6 +4921,7 @@
5894 ipa_pta_execute (void)
5897 struct cgraph_node *node;
5899 init_alias_heapvars ();
5900 @@ -4994,6 +5011,7 @@
5902 delete_alias_heapvars ();
5903 delete_points_to_sets ();
5908 @@ -5018,8 +5036,9 @@
5910 init_alias_heapvars (void)
5912 - heapvar_for_stmt = htab_create_ggc (11, tree_map_hash, tree_map_eq,
5914 + if (!heapvar_for_stmt)
5915 + heapvar_for_stmt = htab_create_ggc (11, tree_map_hash, tree_map_eq,
5917 nonlocal_all = NULL_TREE;
5920 @@ -5028,7 +5047,7 @@
5922 nonlocal_all = NULL_TREE;
5923 htab_delete (heapvar_for_stmt);
5924 + heapvar_for_stmt = NULL;
5928 #include "gt-tree-ssa-structalias.h"
5929 Index: gcc/config/i386/i386.md
5930 ===================================================================
5931 --- gcc/config/i386/i386.md (.../tags/gcc_4_2_0_release) (revision 125292)
5932 +++ gcc/config/i386/i386.md (.../branches/gcc-4_2-branch) (revision 125292)
5933 @@ -4749,7 +4749,7 @@
5934 (define_insn "*addti3_1"
5935 [(set (match_operand:TI 0 "nonimmediate_operand" "=r,o")
5936 (plus:TI (match_operand:TI 1 "nonimmediate_operand" "%0,0")
5937 - (match_operand:TI 2 "general_operand" "roiF,riF")))
5938 + (match_operand:TI 2 "x86_64_general_operand" "roe,re")))
5939 (clobber (reg:CC FLAGS_REG))]
5940 "TARGET_64BIT && ix86_binary_operator_ok (PLUS, TImode, operands)"
5942 @@ -4757,7 +4757,7 @@
5944 [(set (match_operand:TI 0 "nonimmediate_operand" "")
5945 (plus:TI (match_operand:TI 1 "nonimmediate_operand" "")
5946 - (match_operand:TI 2 "general_operand" "")))
5947 + (match_operand:TI 2 "x86_64_general_operand" "")))
5948 (clobber (reg:CC FLAGS_REG))]
5949 "TARGET_64BIT && reload_completed"
5950 [(parallel [(set (reg:CC FLAGS_REG) (unspec:CC [(match_dup 1) (match_dup 2)]
5951 @@ -6483,7 +6483,7 @@
5952 (define_insn "*subti3_1"
5953 [(set (match_operand:TI 0 "nonimmediate_operand" "=r,o")
5954 (minus:TI (match_operand:TI 1 "nonimmediate_operand" "0,0")
5955 - (match_operand:TI 2 "general_operand" "roiF,riF")))
5956 + (match_operand:TI 2 "x86_64_general_operand" "roe,re")))
5957 (clobber (reg:CC FLAGS_REG))]
5958 "TARGET_64BIT && ix86_binary_operator_ok (MINUS, TImode, operands)"
5960 @@ -6491,7 +6491,7 @@
5962 [(set (match_operand:TI 0 "nonimmediate_operand" "")
5963 (minus:TI (match_operand:TI 1 "nonimmediate_operand" "")
5964 - (match_operand:TI 2 "general_operand" "")))
5965 + (match_operand:TI 2 "x86_64_general_operand" "")))
5966 (clobber (reg:CC FLAGS_REG))]
5967 "TARGET_64BIT && reload_completed"
5968 [(parallel [(set (reg:CC FLAGS_REG) (compare:CC (match_dup 1) (match_dup 2)))
5969 @@ -9326,7 +9326,7 @@
5971 (define_insn "*negti2_1"
5972 [(set (match_operand:TI 0 "nonimmediate_operand" "=ro")
5973 - (neg:TI (match_operand:TI 1 "general_operand" "0")))
5974 + (neg:TI (match_operand:TI 1 "nonimmediate_operand" "0")))
5975 (clobber (reg:CC FLAGS_REG))]
5977 && ix86_unary_operator_ok (NEG, TImode, operands)"
5978 @@ -9334,7 +9334,7 @@
5981 [(set (match_operand:TI 0 "nonimmediate_operand" "")
5982 - (neg:TI (match_operand:TI 1 "general_operand" "")))
5983 + (neg:TI (match_operand:TI 1 "nonimmediate_operand" "")))
5984 (clobber (reg:CC FLAGS_REG))]
5985 "TARGET_64BIT && reload_completed"
5987 Index: gcc/config/i386/sse.md
5988 ===================================================================
5989 --- gcc/config/i386/sse.md (.../tags/gcc_4_2_0_release) (revision 125292)
5990 +++ gcc/config/i386/sse.md (.../branches/gcc-4_2-branch) (revision 125292)
5991 @@ -2055,11 +2055,11 @@
5993 (parallel [(const_int 0)
5995 - "TARGET_SSE3 && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
5996 + "TARGET_SSE3 && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
5998 movddup\t{%1, %0|%0, %1}
6000 - [(set_attr "type" "sselog,ssemov")
6001 + [(set_attr "type" "sselog1,ssemov")
6002 (set_attr "mode" "V2DF")])
6005 @@ -3494,9 +3494,10 @@
6006 "TARGET_SSE2 && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
6008 movhps\t{%1, %0|%0, %1}
6009 - psrldq\t{$4, %0|%0, 4}
6010 + psrldq\t{$8, %0|%0, 8}
6011 movq\t{%H1, %0|%0, %H1}"
6012 [(set_attr "type" "ssemov,sseishft,ssemov")
6013 + (set_attr "memory" "*,none,*")
6014 (set_attr "mode" "V2SF,TI,TI")])
6016 ;; Not sure this is ever used, but it doesn't hurt to have it. -aoliva
6017 Index: gcc/config/i386/i386.c
6018 ===================================================================
6019 --- gcc/config/i386/i386.c (.../tags/gcc_4_2_0_release) (revision 125292)
6020 +++ gcc/config/i386/i386.c (.../branches/gcc-4_2-branch) (revision 125292)
6021 @@ -15539,13 +15539,13 @@
6022 /* Access to the vec_extract patterns. */
6023 ftype = build_function_type_list (double_type_node, V2DF_type_node,
6024 integer_type_node, NULL_TREE);
6025 - def_builtin (MASK_SSE, "__builtin_ia32_vec_ext_v2df",
6026 + def_builtin (MASK_SSE2, "__builtin_ia32_vec_ext_v2df",
6027 ftype, IX86_BUILTIN_VEC_EXT_V2DF);
6029 ftype = build_function_type_list (long_long_integer_type_node,
6030 V2DI_type_node, integer_type_node,
6032 - def_builtin (MASK_SSE, "__builtin_ia32_vec_ext_v2di",
6033 + def_builtin (MASK_SSE2, "__builtin_ia32_vec_ext_v2di",
6034 ftype, IX86_BUILTIN_VEC_EXT_V2DI);
6036 ftype = build_function_type_list (float_type_node, V4SF_type_node,
6037 @@ -15555,12 +15555,12 @@
6039 ftype = build_function_type_list (intSI_type_node, V4SI_type_node,
6040 integer_type_node, NULL_TREE);
6041 - def_builtin (MASK_SSE, "__builtin_ia32_vec_ext_v4si",
6042 + def_builtin (MASK_SSE2, "__builtin_ia32_vec_ext_v4si",
6043 ftype, IX86_BUILTIN_VEC_EXT_V4SI);
6045 ftype = build_function_type_list (intHI_type_node, V8HI_type_node,
6046 integer_type_node, NULL_TREE);
6047 - def_builtin (MASK_SSE, "__builtin_ia32_vec_ext_v8hi",
6048 + def_builtin (MASK_SSE2, "__builtin_ia32_vec_ext_v8hi",
6049 ftype, IX86_BUILTIN_VEC_EXT_V8HI);
6051 ftype = build_function_type_list (intHI_type_node, V4HI_type_node,
6052 @@ -15577,7 +15577,7 @@
6053 ftype = build_function_type_list (V8HI_type_node, V8HI_type_node,
6055 integer_type_node, NULL_TREE);
6056 - def_builtin (MASK_SSE, "__builtin_ia32_vec_set_v8hi",
6057 + def_builtin (MASK_SSE2, "__builtin_ia32_vec_set_v8hi",
6058 ftype, IX86_BUILTIN_VEC_SET_V8HI);
6060 ftype = build_function_type_list (V4HI_type_node, V4HI_type_node,
6061 Index: gcc/config/sh/sh.c
6062 ===================================================================
6063 --- gcc/config/sh/sh.c (.../tags/gcc_4_2_0_release) (revision 125292)
6064 +++ gcc/config/sh/sh.c (.../branches/gcc-4_2-branch) (revision 125292)
6065 @@ -5295,7 +5295,13 @@
6066 temp = scavenge_reg (&temps);
6068 if (temp < 0 && live_regs_mask)
6069 - temp = scavenge_reg (live_regs_mask);
6071 + HARD_REG_SET temps;
6073 + COPY_HARD_REG_SET (temps, *live_regs_mask);
6074 + CLEAR_HARD_REG_BIT (temps, REGNO (reg));
6075 + temp = scavenge_reg (&temps);
6079 rtx adj_reg, tmp_reg, mem;
6080 @@ -5344,6 +5350,9 @@
6081 emit_move_insn (adj_reg, mem);
6082 mem = gen_tmp_stack_mem (Pmode, gen_rtx_POST_INC (Pmode, reg));
6083 emit_move_insn (tmp_reg, mem);
6084 + /* Tell flow the insns that pop r4/r5 aren't dead. */
6085 + emit_insn (gen_rtx_USE (VOIDmode, tmp_reg));
6086 + emit_insn (gen_rtx_USE (VOIDmode, adj_reg));
6089 const_reg = gen_rtx_REG (GET_MODE (reg), temp);
6090 @@ -8618,7 +8627,7 @@
6092 && get_attr_type (insn) == TYPE_DYN_SHIFT
6093 && get_attr_any_int_load (dep_insn) == ANY_INT_LOAD_YES
6094 - && reg_overlap_mentioned_p (SET_DEST (PATTERN (dep_insn)),
6095 + && reg_overlap_mentioned_p (SET_DEST (single_set (dep_insn)),
6096 XEXP (SET_SRC (single_set (insn)),
6099 Index: gcc/config/sh/sh.md
6100 ===================================================================
6101 --- gcc/config/sh/sh.md (.../tags/gcc_4_2_0_release) (revision 125292)
6102 +++ gcc/config/sh/sh.md (.../branches/gcc-4_2-branch) (revision 125292)
6103 @@ -413,10 +413,12 @@
6104 (eq_attr "type" "jump")
6105 (cond [(eq_attr "med_branch_p" "yes")
6107 - (and (eq (symbol_ref "GET_CODE (prev_nonnote_insn (insn))")
6108 - (symbol_ref "INSN"))
6109 - (eq (symbol_ref "INSN_CODE (prev_nonnote_insn (insn))")
6110 - (symbol_ref "code_for_indirect_jump_scratch")))
6111 + (and (ne (symbol_ref "prev_nonnote_insn (insn)")
6113 + (and (eq (symbol_ref "GET_CODE (prev_nonnote_insn (insn))")
6114 + (symbol_ref "INSN"))
6115 + (eq (symbol_ref "INSN_CODE (prev_nonnote_insn (insn))")
6116 + (symbol_ref "code_for_indirect_jump_scratch"))))
6117 (cond [(eq_attr "braf_branch_p" "yes")
6119 (eq (symbol_ref "flag_pic") (const_int 0))
6120 @@ -750,54 +752,6 @@
6121 (set_attr "type" "arith3")])
6123 (define_insn "cmpeqsi_media"
6124 - [(set (match_operand:DI 0 "register_operand" "=r")
6125 - (eq:DI (match_operand:SI 1 "logical_operand" "%r")
6126 - (match_operand:SI 2 "cmp_operand" "Nr")))]
6128 - "cmpeq %1, %N2, %0"
6129 - [(set_attr "type" "cmp_media")])
6131 -(define_insn "cmpeqdi_media"
6132 - [(set (match_operand:DI 0 "register_operand" "=r")
6133 - (eq:DI (match_operand:DI 1 "register_operand" "%r")
6134 - (match_operand:DI 2 "cmp_operand" "Nr")))]
6136 - "cmpeq %1, %N2, %0"
6137 - [(set_attr "type" "cmp_media")])
6139 -(define_insn "cmpgtsi_media"
6140 - [(set (match_operand:DI 0 "register_operand" "=r")
6141 - (gt:DI (match_operand:SI 1 "cmp_operand" "Nr")
6142 - (match_operand:SI 2 "cmp_operand" "rN")))]
6144 - "cmpgt %N1, %N2, %0"
6145 - [(set_attr "type" "cmp_media")])
6147 -(define_insn "cmpgtdi_media"
6148 - [(set (match_operand:DI 0 "register_operand" "=r")
6149 - (gt:DI (match_operand:DI 1 "arith_reg_or_0_operand" "Nr")
6150 - (match_operand:DI 2 "arith_reg_or_0_operand" "rN")))]
6152 - "cmpgt %N1, %N2, %0"
6153 - [(set_attr "type" "cmp_media")])
6155 -(define_insn "cmpgtusi_media"
6156 - [(set (match_operand:DI 0 "register_operand" "=r")
6157 - (gtu:DI (match_operand:SI 1 "cmp_operand" "Nr")
6158 - (match_operand:SI 2 "cmp_operand" "rN")))]
6160 - "cmpgtu %N1, %N2, %0"
6161 - [(set_attr "type" "cmp_media")])
6163 -(define_insn "cmpgtudi_media"
6164 - [(set (match_operand:DI 0 "register_operand" "=r")
6165 - (gtu:DI (match_operand:DI 1 "arith_reg_or_0_operand" "Nr")
6166 - (match_operand:DI 2 "arith_reg_or_0_operand" "rN")))]
6168 - "cmpgtu %N1, %N2, %0"
6169 - [(set_attr "type" "cmp_media")])
6171 -(define_insn "cmpsieqsi_media"
6172 [(set (match_operand:SI 0 "register_operand" "=r")
6173 (eq:SI (match_operand:SI 1 "logical_operand" "%r")
6174 (match_operand:SI 2 "cmp_operand" "Nr")))]
6177 [(set_attr "type" "cmp_media")])
6179 -(define_insn "cmpsieqdi_media"
6180 +(define_insn "cmpeqdi_media"
6181 [(set (match_operand:SI 0 "register_operand" "=r")
6182 (eq:SI (match_operand:DI 1 "register_operand" "%r")
6183 (match_operand:DI 2 "cmp_operand" "Nr")))]
6186 [(set_attr "type" "cmp_media")])
6188 -(define_insn "cmpsigtsi_media"
6189 +(define_insn "cmpgtsi_media"
6190 [(set (match_operand:SI 0 "register_operand" "=r")
6191 (gt:SI (match_operand:SI 1 "cmp_operand" "Nr")
6192 (match_operand:SI 2 "cmp_operand" "rN")))]
6194 "cmpgt %N1, %N2, %0"
6195 [(set_attr "type" "cmp_media")])
6197 -(define_insn "cmpsigtdi_media"
6198 +(define_insn "cmpgtdi_media"
6199 [(set (match_operand:SI 0 "register_operand" "=r")
6200 (gt:SI (match_operand:DI 1 "arith_reg_or_0_operand" "Nr")
6201 (match_operand:DI 2 "arith_reg_or_0_operand" "rN")))]
6203 "cmpgt %N1, %N2, %0"
6204 [(set_attr "type" "cmp_media")])
6206 -(define_insn "cmpsigtusi_media"
6207 +(define_insn "cmpgtusi_media"
6208 [(set (match_operand:SI 0 "register_operand" "=r")
6209 (gtu:SI (match_operand:SI 1 "cmp_operand" "Nr")
6210 (match_operand:SI 2 "cmp_operand" "rN")))]
6212 "cmpgtu %N1, %N2, %0"
6213 [(set_attr "type" "cmp_media")])
6215 -(define_insn "cmpsigtudi_media"
6216 +(define_insn "cmpgtudi_media"
6217 [(set (match_operand:SI 0 "register_operand" "=r")
6218 (gtu:SI (match_operand:DI 1 "arith_reg_or_0_operand" "Nr")
6219 (match_operand:DI 2 "arith_reg_or_0_operand" "rN")))]
6220 @@ -846,13 +800,6 @@
6221 [(set_attr "type" "cmp_media")])
6223 ; These two patterns are for combine.
6224 -(define_insn "*cmpne0si_media"
6225 - [(set (match_operand:DI 0 "register_operand" "=r")
6226 - (ne:DI (match_operand:SI 1 "arith_reg_operand" "r") (const_int 0)))]
6228 - "cmpgtu %1,r63,%0"
6229 - [(set_attr "type" "cmp_media")])
6231 (define_insn "*cmpne0sisi_media"
6232 [(set (match_operand:SI 0 "register_operand" "=r")
6233 (ne:SI (match_operand:SI 1 "arith_reg_operand" "r") (const_int 0)))]
6234 @@ -1177,7 +1124,7 @@
6236 emit_insn (gen_movsicc_false (operands[0], operands[1], operands[2],
6238 - emit_insn (gen_cmpsigtusi_media (operands[5], operands[4], operands[0]));
6239 + emit_insn (gen_cmpgtusi_media (operands[5], operands[4], operands[0]));
6240 emit_insn (gen_movsicc_false (operands[0], operands[5], operands[4],
6243 @@ -7200,7 +7147,7 @@
6246 (define_expand "bunordered"
6247 - [(set (match_dup 1) (unordered:DI (match_dup 2) (match_dup 3)))
6248 + [(set (match_dup 1) (unordered:SI (match_dup 2) (match_dup 3)))
6250 (if_then_else (ne (match_dup 1) (const_int 0))
6251 (match_operand 0 "" "")
6252 @@ -7209,7 +7156,7 @@
6255 operands[0] = gen_rtx_LABEL_REF (Pmode, operands[0]);
6256 - operands[1] = gen_reg_rtx (DImode);
6257 + operands[1] = gen_reg_rtx (SImode);
6258 operands[2] = force_reg (GET_MODE (sh_compare_op0), sh_compare_op0);
6259 operands[3] = force_reg (GET_MODE (sh_compare_op1), sh_compare_op1);
6261 @@ -9112,6 +9059,8 @@
6267 sh_compare_op0 = force_reg (GET_MODE (sh_compare_op0), sh_compare_op0);
6268 if (sh_compare_op1 != const0_rtx)
6269 sh_compare_op1 = force_reg (GET_MODE (sh_compare_op1) == VOIDmode
6270 @@ -9126,26 +9075,26 @@
6271 switch (GET_MODE (sh_compare_op0))
6274 - emit_insn (gen_cmpsieqsi_media (operands[0],
6275 + emit_insn (gen_cmpeqsi_media (operands[0],
6276 sh_compare_op0, sh_compare_op1));
6280 - emit_insn (gen_cmpsieqdi_media (operands[0],
6281 + emit_insn (gen_cmpeqdi_media (operands[0],
6282 sh_compare_op0, sh_compare_op1));
6286 if (! TARGET_SHMEDIA_FPU)
6288 - emit_insn (gen_cmpsieqsf_media (operands[0],
6289 + emit_insn (gen_cmpeqsf_media (operands[0],
6290 sh_compare_op0, sh_compare_op1));
6294 if (! TARGET_SHMEDIA_FPU)
6296 - emit_insn (gen_cmpsieqdf_media (operands[0],
6297 + emit_insn (gen_cmpeqdf_media (operands[0],
6298 sh_compare_op0, sh_compare_op1));
6301 @@ -9155,38 +9104,44 @@
6305 - if (GET_MODE (operands[0]) != DImode)
6306 - operands[0] = gen_rtx_SUBREG (DImode, operands[0], 0);
6307 + reg = operands[0];
6308 + if (GET_MODE (operands[0]) != SImode)
6309 + reg = no_new_pseudos ? gen_rtx_SUBREG (SImode, operands[0], 0)
6310 + : gen_reg_rtx (SImode);
6312 switch (GET_MODE (sh_compare_op0))
6315 - emit_insn (gen_cmpeqsi_media (operands[0],
6316 + emit_insn (gen_cmpeqsi_media (reg,
6317 sh_compare_op0, sh_compare_op1));
6321 - emit_insn (gen_cmpeqdi_media (operands[0],
6322 + emit_insn (gen_cmpeqdi_media (reg,
6323 sh_compare_op0, sh_compare_op1));
6327 if (! TARGET_SHMEDIA_FPU)
6329 - emit_insn (gen_cmpeqsf_media (operands[0],
6330 + emit_insn (gen_cmpeqsf_media (reg,
6331 sh_compare_op0, sh_compare_op1));
6335 if (! TARGET_SHMEDIA_FPU)
6337 - emit_insn (gen_cmpeqdf_media (operands[0],
6338 + emit_insn (gen_cmpeqdf_media (reg,
6339 sh_compare_op0, sh_compare_op1));
6346 + if (GET_MODE (operands[0]) == DImode)
6347 + emit_insn (gen_extendsidi2 (operands[0], reg));
6351 if (sh_expand_t_scc (EQ, operands[0]))
6352 @@ -9204,8 +9159,8 @@
6356 - if (GET_MODE (operands[0]) != DImode)
6357 - operands[0] = gen_rtx_SUBREG (DImode, operands[0], 0);
6360 sh_compare_op0 = force_reg (GET_MODE (sh_compare_op0), sh_compare_op0);
6361 if (sh_compare_op1 != const0_rtx)
6362 sh_compare_op1 = force_reg (GET_MODE (sh_compare_op1) == VOIDmode
6363 @@ -9213,35 +9168,44 @@
6364 : GET_MODE (sh_compare_op1),
6367 + reg = operands[0];
6368 + if (GET_MODE (operands[0]) != SImode)
6369 + reg = no_new_pseudos ? gen_rtx_SUBREG (SImode, operands[0], 0)
6370 + : gen_reg_rtx (SImode);
6372 switch (GET_MODE (sh_compare_op0))
6375 - emit_insn (gen_cmpgtsi_media (operands[0],
6376 + emit_insn (gen_cmpgtsi_media (reg,
6377 sh_compare_op1, sh_compare_op0));
6381 - emit_insn (gen_cmpgtdi_media (operands[0],
6382 + emit_insn (gen_cmpgtdi_media (reg,
6383 sh_compare_op1, sh_compare_op0));
6387 if (! TARGET_SHMEDIA_FPU)
6389 - emit_insn (gen_cmpgtsf_media (operands[0],
6390 + emit_insn (gen_cmpgtsf_media (reg,
6391 sh_compare_op1, sh_compare_op0));
6395 if (! TARGET_SHMEDIA_FPU)
6397 - emit_insn (gen_cmpgtdf_media (operands[0],
6398 + emit_insn (gen_cmpgtdf_media (reg,
6399 sh_compare_op1, sh_compare_op0));
6406 + if (GET_MODE (operands[0]) == DImode)
6407 + emit_insn (gen_extendsidi2 (operands[0], reg));
6411 if (! currently_expanding_to_rtl)
6412 @@ -9258,8 +9222,8 @@
6416 - if (GET_MODE (operands[0]) != DImode)
6417 - operands[0] = gen_rtx_SUBREG (DImode, operands[0], 0);
6420 sh_compare_op0 = force_reg (GET_MODE (sh_compare_op0), sh_compare_op0);
6421 if (sh_compare_op1 != const0_rtx)
6422 sh_compare_op1 = force_reg (GET_MODE (sh_compare_op1) == VOIDmode
6423 @@ -9267,45 +9231,54 @@
6424 : GET_MODE (sh_compare_op1),
6427 + reg = operands[0];
6428 + if (GET_MODE (operands[0]) != SImode)
6429 + reg = no_new_pseudos ? gen_rtx_SUBREG (SImode, operands[0], 0)
6430 + : gen_reg_rtx (SImode);
6432 switch (GET_MODE (sh_compare_op0))
6436 - tmp = no_new_pseudos ? operands[0] : gen_reg_rtx (DImode);
6437 + tmp = no_new_pseudos ? reg : gen_reg_rtx (SImode);
6439 emit_insn (gen_cmpgtsi_media (tmp,
6440 sh_compare_op0, sh_compare_op1));
6441 - emit_insn (gen_cmpeqdi_media (operands[0], tmp, const0_rtx));
6442 + emit_insn (gen_cmpeqdi_media (reg, tmp, const0_rtx));
6448 - tmp = no_new_pseudos ? operands[0] : gen_reg_rtx (DImode);
6449 + tmp = no_new_pseudos ? reg : gen_reg_rtx (SImode);
6451 emit_insn (gen_cmpgtdi_media (tmp,
6452 sh_compare_op0, sh_compare_op1));
6453 - emit_insn (gen_cmpeqdi_media (operands[0], tmp, const0_rtx));
6454 + emit_insn (gen_cmpeqdi_media (reg, tmp, const0_rtx));
6459 if (! TARGET_SHMEDIA_FPU)
6461 - emit_insn (gen_cmpgesf_media (operands[0],
6462 + emit_insn (gen_cmpgesf_media (reg,
6463 sh_compare_op1, sh_compare_op0));
6467 if (! TARGET_SHMEDIA_FPU)
6469 - emit_insn (gen_cmpgedf_media (operands[0],
6470 + emit_insn (gen_cmpgedf_media (reg,
6471 sh_compare_op1, sh_compare_op0));
6478 + if (GET_MODE (operands[0]) == DImode)
6479 + emit_insn (gen_extendsidi2 (operands[0], reg));
6484 @@ -9323,8 +9296,12 @@
6488 - if (GET_MODE (operands[0]) != DImode)
6489 - operands[0] = gen_rtx_SUBREG (DImode, operands[0], 0);
6492 + reg = operands[0];
6493 + if (GET_MODE (operands[0]) != SImode)
6494 + reg = no_new_pseudos ? gen_rtx_SUBREG (SImode, operands[0], 0)
6495 + : gen_reg_rtx (SImode);
6496 sh_compare_op0 = force_reg (GET_MODE (sh_compare_op0), sh_compare_op0);
6497 if (sh_compare_op1 != const0_rtx)
6498 sh_compare_op1 = force_reg (GET_MODE (sh_compare_op1) == VOIDmode
6499 @@ -9335,32 +9312,36 @@
6500 switch (GET_MODE (sh_compare_op0))
6503 - emit_insn (gen_cmpgtsi_media (operands[0],
6504 + emit_insn (gen_cmpgtsi_media (reg,
6505 sh_compare_op0, sh_compare_op1));
6509 - emit_insn (gen_cmpgtdi_media (operands[0],
6510 + emit_insn (gen_cmpgtdi_media (reg,
6511 sh_compare_op0, sh_compare_op1));
6515 if (! TARGET_SHMEDIA_FPU)
6517 - emit_insn (gen_cmpgtsf_media (operands[0],
6518 + emit_insn (gen_cmpgtsf_media (reg,
6519 sh_compare_op0, sh_compare_op1));
6523 if (! TARGET_SHMEDIA_FPU)
6525 - emit_insn (gen_cmpgtdf_media (operands[0],
6526 + emit_insn (gen_cmpgtdf_media (reg,
6527 sh_compare_op0, sh_compare_op1));
6534 + if (GET_MODE (operands[0]) == DImode)
6535 + emit_insn (gen_extendsidi2 (operands[0], reg));
6539 if (! currently_expanding_to_rtl)
6540 @@ -9376,12 +9357,15 @@
6545 enum machine_mode mode = GET_MODE (sh_compare_op0);
6547 if ((mode) == VOIDmode)
6548 mode = GET_MODE (sh_compare_op1);
6549 - if (GET_MODE (operands[0]) != DImode)
6550 - operands[0] = gen_rtx_SUBREG (DImode, operands[0], 0);
6551 + reg = operands[0];
6552 + if (GET_MODE (operands[0]) != SImode)
6553 + reg = no_new_pseudos ? gen_rtx_SUBREG (SImode, operands[0], 0)
6554 + : gen_reg_rtx (SImode);
6555 sh_compare_op0 = force_reg (mode, sh_compare_op0);
6556 if (sh_compare_op1 != const0_rtx)
6557 sh_compare_op1 = force_reg (mode, sh_compare_op1);
6558 @@ -9390,41 +9374,45 @@
6562 - rtx tmp = no_new_pseudos ? operands[0] : gen_reg_rtx (DImode);
6563 + rtx tmp = no_new_pseudos ? reg : gen_reg_rtx (SImode);
6565 emit_insn (gen_cmpgtsi_media (tmp,
6566 sh_compare_op1, sh_compare_op0));
6567 - emit_insn (gen_cmpeqdi_media (operands[0], tmp, const0_rtx));
6568 + emit_insn (gen_cmpeqdi_media (reg, tmp, const0_rtx));
6574 - rtx tmp = no_new_pseudos ? operands[0] : gen_reg_rtx (DImode);
6575 + rtx tmp = no_new_pseudos ? reg : gen_reg_rtx (SImode);
6577 emit_insn (gen_cmpgtdi_media (tmp,
6578 sh_compare_op1, sh_compare_op0));
6579 - emit_insn (gen_cmpeqdi_media (operands[0], tmp, const0_rtx));
6580 + emit_insn (gen_cmpeqdi_media (reg, tmp, const0_rtx));
6585 if (! TARGET_SHMEDIA_FPU)
6587 - emit_insn (gen_cmpgesf_media (operands[0],
6588 + emit_insn (gen_cmpgesf_media (reg,
6589 sh_compare_op0, sh_compare_op1));
6593 if (! TARGET_SHMEDIA_FPU)
6595 - emit_insn (gen_cmpgedf_media (operands[0],
6596 + emit_insn (gen_cmpgedf_media (reg,
6597 sh_compare_op0, sh_compare_op1));
6604 + if (GET_MODE (operands[0]) == DImode)
6605 + emit_insn (gen_extendsidi2 (operands[0], reg));
6610 @@ -9456,8 +9444,12 @@
6614 - if (GET_MODE (operands[0]) != DImode)
6615 - operands[0] = gen_rtx_SUBREG (DImode, operands[0], 0);
6618 + reg = operands[0];
6619 + if (GET_MODE (operands[0]) == DImode)
6620 + reg = no_new_pseudos ? gen_rtx_SUBREG (SImode, operands[0], 0)
6621 + : gen_reg_rtx (SImode);
6622 sh_compare_op0 = force_reg (GET_MODE (sh_compare_op0), sh_compare_op0);
6623 if (sh_compare_op1 != const0_rtx)
6624 sh_compare_op1 = force_reg (GET_MODE (sh_compare_op1) == VOIDmode
6625 @@ -9465,8 +9457,11 @@
6626 : GET_MODE (sh_compare_op1),
6629 - emit_insn (gen_cmpgtudi_media (operands[0],
6630 + emit_insn (gen_cmpgtudi_media (reg,
6631 sh_compare_op0, sh_compare_op1));
6632 + if (GET_MODE (operands[0]) == DImode)
6633 + emit_insn (gen_extendsidi2 (operands[0], reg));
6637 if (! currently_expanding_to_rtl)
6638 @@ -9482,8 +9477,12 @@
6642 - if (GET_MODE (operands[0]) != DImode)
6643 - operands[0] = gen_rtx_SUBREG (DImode, operands[0], 0);
6646 + reg = operands[0];
6647 + if (GET_MODE (operands[0]) == DImode)
6648 + reg = no_new_pseudos ? gen_rtx_SUBREG (SImode, operands[0], 0)
6649 + : gen_reg_rtx (SImode);
6650 sh_compare_op0 = force_reg (GET_MODE (sh_compare_op0), sh_compare_op0);
6651 if (sh_compare_op1 != const0_rtx)
6652 sh_compare_op1 = force_reg (GET_MODE (sh_compare_op1) == VOIDmode
6653 @@ -9491,8 +9490,11 @@
6654 : GET_MODE (sh_compare_op1),
6657 - emit_insn (gen_cmpgtudi_media (operands[0],
6658 + emit_insn (gen_cmpgtudi_media (reg,
6659 sh_compare_op1, sh_compare_op0));
6660 + if (GET_MODE (operands[0]) == DImode)
6661 + emit_insn (gen_extendsidi2 (operands[0], reg));
6665 if (! currently_expanding_to_rtl)
6666 @@ -9508,10 +9510,12 @@
6673 - if (GET_MODE (operands[0]) != DImode)
6674 - operands[0] = gen_rtx_SUBREG (DImode, operands[0], 0);
6675 + reg = operands[0];
6676 + if (GET_MODE (operands[0]) != SImode)
6677 + reg = no_new_pseudos ? gen_rtx_SUBREG (SImode, operands[0], 0)
6678 + : gen_reg_rtx (SImode);
6679 sh_compare_op0 = force_reg (GET_MODE (sh_compare_op0), sh_compare_op0);
6680 if (sh_compare_op1 != const0_rtx)
6681 sh_compare_op1 = force_reg (GET_MODE (sh_compare_op1) == VOIDmode
6682 @@ -9519,10 +9523,12 @@
6683 : GET_MODE (sh_compare_op1),
6686 - tmp = no_new_pseudos ? operands[0] : gen_reg_rtx (DImode);
6687 + tmp = no_new_pseudos ? reg : gen_reg_rtx (SImode);
6689 emit_insn (gen_cmpgtudi_media (tmp, sh_compare_op0, sh_compare_op1));
6690 - emit_insn (gen_cmpeqdi_media (operands[0], tmp, const0_rtx));
6691 + emit_insn (gen_cmpeqdi_media (reg, tmp, const0_rtx));
6692 + if (GET_MODE (operands[0]) == DImode)
6693 + emit_insn (gen_extendsidi2 (operands[0], reg));
6697 @@ -9539,10 +9545,12 @@
6704 - if (GET_MODE (operands[0]) != DImode)
6705 - operands[0] = gen_rtx_SUBREG (DImode, operands[0], 0);
6706 + reg = operands[0];
6707 + if (GET_MODE (operands[0]) != SImode)
6708 + reg = no_new_pseudos ? gen_rtx_SUBREG (SImode, operands[0], 0)
6709 + : gen_reg_rtx (SImode);
6710 sh_compare_op0 = force_reg (GET_MODE (sh_compare_op0), sh_compare_op0);
6711 if (sh_compare_op1 != const0_rtx)
6712 sh_compare_op1 = force_reg (GET_MODE (sh_compare_op1) == VOIDmode
6713 @@ -9550,10 +9558,12 @@
6714 : GET_MODE (sh_compare_op1),
6717 - tmp = no_new_pseudos ? operands[0] : gen_reg_rtx (DImode);
6718 + tmp = no_new_pseudos ? operands[0] : gen_reg_rtx (SImode);
6720 emit_insn (gen_cmpgtudi_media (tmp, sh_compare_op1, sh_compare_op0));
6721 - emit_insn (gen_cmpeqdi_media (operands[0], tmp, const0_rtx));
6722 + emit_insn (gen_cmpeqdi_media (reg, tmp, const0_rtx));
6723 + if (GET_MODE (operands[0]) == DImode)
6724 + emit_insn (gen_extendsidi2 (operands[0], reg));
6728 @@ -9584,11 +9594,12 @@
6735 - if (GET_MODE (operands[0]) != DImode)
6736 - operands[0] = gen_rtx_SUBREG (DImode, operands[0], 0);
6738 + reg = operands[0];
6739 + if (GET_MODE (operands[0]) != SImode)
6740 + reg = no_new_pseudos ? gen_rtx_SUBREG (SImode, operands[0], 0)
6741 + : gen_reg_rtx (SImode);
6742 if (! TARGET_SHMEDIA_FPU
6743 && GET_MODE (sh_compare_op0) != DImode
6744 && GET_MODE (sh_compare_op0) != SImode)
6745 @@ -9601,10 +9612,12 @@
6746 : GET_MODE (sh_compare_op1),
6749 - tmp = no_new_pseudos ? operands[0] : gen_reg_rtx (DImode);
6750 + tmp = no_new_pseudos ? reg : gen_reg_rtx (SImode);
6752 emit_insn (gen_seq (tmp));
6753 - emit_insn (gen_cmpeqdi_media (operands[0], tmp, const0_rtx));
6754 + emit_insn (gen_cmpeqdi_media (reg, tmp, const0_rtx));
6755 + if (GET_MODE (operands[0]) == DImode)
6756 + emit_insn (gen_extendsidi2 (operands[0], reg));
6760 @@ -9618,8 +9631,8 @@
6763 (define_expand "sunordered"
6764 - [(set (match_operand:DI 0 "arith_reg_operand" "")
6765 - (unordered:DI (match_dup 1) (match_dup 2)))]
6766 + [(set (match_operand:SI 0 "arith_reg_operand" "")
6767 + (unordered:SI (match_dup 1) (match_dup 2)))]
6768 "TARGET_SHMEDIA_FPU"
6771 @@ -10378,14 +10391,6 @@
6772 (set_attr "fp_mode" "single")])
6774 (define_insn "cmpeqsf_media"
6775 - [(set (match_operand:DI 0 "register_operand" "=r")
6776 - (eq:DI (match_operand:SF 1 "fp_arith_reg_operand" "f")
6777 - (match_operand:SF 2 "fp_arith_reg_operand" "f")))]
6778 - "TARGET_SHMEDIA_FPU"
6779 - "fcmpeq.s %1, %2, %0"
6780 - [(set_attr "type" "fcmp_media")])
6782 -(define_insn "cmpsieqsf_media"
6783 [(set (match_operand:SI 0 "register_operand" "=r")
6784 (eq:SI (match_operand:SF 1 "fp_arith_reg_operand" "f")
6785 (match_operand:SF 2 "fp_arith_reg_operand" "f")))]
6786 @@ -10394,24 +10399,24 @@
6787 [(set_attr "type" "fcmp_media")])
6789 (define_insn "cmpgtsf_media"
6790 - [(set (match_operand:DI 0 "register_operand" "=r")
6791 - (gt:DI (match_operand:SF 1 "fp_arith_reg_operand" "f")
6792 + [(set (match_operand:SI 0 "register_operand" "=r")
6793 + (gt:SI (match_operand:SF 1 "fp_arith_reg_operand" "f")
6794 (match_operand:SF 2 "fp_arith_reg_operand" "f")))]
6795 "TARGET_SHMEDIA_FPU"
6796 "fcmpgt.s %1, %2, %0"
6797 [(set_attr "type" "fcmp_media")])
6799 (define_insn "cmpgesf_media"
6800 - [(set (match_operand:DI 0 "register_operand" "=r")
6801 - (ge:DI (match_operand:SF 1 "fp_arith_reg_operand" "f")
6802 + [(set (match_operand:SI 0 "register_operand" "=r")
6803 + (ge:SI (match_operand:SF 1 "fp_arith_reg_operand" "f")
6804 (match_operand:SF 2 "fp_arith_reg_operand" "f")))]
6805 "TARGET_SHMEDIA_FPU"
6806 "fcmpge.s %1, %2, %0"
6807 [(set_attr "type" "fcmp_media")])
6809 (define_insn "cmpunsf_media"
6810 - [(set (match_operand:DI 0 "register_operand" "=r")
6811 - (unordered:DI (match_operand:SF 1 "fp_arith_reg_operand" "f")
6812 + [(set (match_operand:SI 0 "register_operand" "=r")
6813 + (unordered:SI (match_operand:SF 1 "fp_arith_reg_operand" "f")
6814 (match_operand:SF 2 "fp_arith_reg_operand" "f")))]
6815 "TARGET_SHMEDIA_FPU"
6816 "fcmpun.s %1, %2, %0"
6817 @@ -10884,14 +10889,6 @@
6818 (set_attr "fp_mode" "double")])
6820 (define_insn "cmpeqdf_media"
6821 - [(set (match_operand:DI 0 "register_operand" "=r")
6822 - (eq:DI (match_operand:DF 1 "fp_arith_reg_operand" "f")
6823 - (match_operand:DF 2 "fp_arith_reg_operand" "f")))]
6824 - "TARGET_SHMEDIA_FPU"
6825 - "fcmpeq.d %1,%2,%0"
6826 - [(set_attr "type" "fcmp_media")])
6828 -(define_insn "cmpsieqdf_media"
6829 [(set (match_operand:SI 0 "register_operand" "=r")
6830 (eq:SI (match_operand:DF 1 "fp_arith_reg_operand" "f")
6831 (match_operand:DF 2 "fp_arith_reg_operand" "f")))]
6832 @@ -10900,24 +10897,24 @@
6833 [(set_attr "type" "fcmp_media")])
6835 (define_insn "cmpgtdf_media"
6836 - [(set (match_operand:DI 0 "register_operand" "=r")
6837 - (gt:DI (match_operand:DF 1 "fp_arith_reg_operand" "f")
6838 + [(set (match_operand:SI 0 "register_operand" "=r")
6839 + (gt:SI (match_operand:DF 1 "fp_arith_reg_operand" "f")
6840 (match_operand:DF 2 "fp_arith_reg_operand" "f")))]
6841 "TARGET_SHMEDIA_FPU"
6843 [(set_attr "type" "fcmp_media")])
6845 (define_insn "cmpgedf_media"
6846 - [(set (match_operand:DI 0 "register_operand" "=r")
6847 - (ge:DI (match_operand:DF 1 "fp_arith_reg_operand" "f")
6848 + [(set (match_operand:SI 0 "register_operand" "=r")
6849 + (ge:SI (match_operand:DF 1 "fp_arith_reg_operand" "f")
6850 (match_operand:DF 2 "fp_arith_reg_operand" "f")))]
6851 "TARGET_SHMEDIA_FPU"
6853 [(set_attr "type" "fcmp_media")])
6855 (define_insn "cmpundf_media"
6856 - [(set (match_operand:DI 0 "register_operand" "=r")
6857 - (unordered:DI (match_operand:DF 1 "fp_arith_reg_operand" "f")
6858 + [(set (match_operand:SI 0 "register_operand" "=r")
6859 + (unordered:SI (match_operand:DF 1 "fp_arith_reg_operand" "f")
6860 (match_operand:DF 2 "fp_arith_reg_operand" "f")))]
6861 "TARGET_SHMEDIA_FPU"
6863 Index: gcc/config/score/predicates.md
6864 ===================================================================
6865 --- gcc/config/score/predicates.md (.../tags/gcc_4_2_0_release) (revision 125292)
6866 +++ gcc/config/score/predicates.md (.../branches/gcc-4_2-branch) (revision 125292)
6868 return IMM_IN_RANGE (INTVAL (op), 15, 1);
6871 -(define_predicate "const_pow2"
6872 - (match_code "const_int")
6874 - return IMM_IS_POW_OF_2 ((unsigned HOST_WIDE_INT) INTVAL (op), 0, 31);
6877 -(define_predicate "const_npow2"
6878 - (match_code "const_int")
6880 - return IMM_IS_POW_OF_2 (~(unsigned HOST_WIDE_INT) INTVAL (op), 0, 31);
6882 Index: gcc/config/score/misc.md
6883 ===================================================================
6884 --- gcc/config/score/misc.md (.../tags/gcc_4_2_0_release) (revision 125292)
6885 +++ gcc/config/score/misc.md (.../branches/gcc-4_2-branch) (revision 125292)
6886 @@ -380,38 +380,3 @@
6887 [(set_attr "type" "arith")
6888 (set_attr "mode" "SI")])
6890 -(define_insn "bitclr_c"
6891 - [(set (match_operand:SI 0 "register_operand" "=e,d")
6892 - (and:SI (match_operand:SI 1 "register_operand" "0,d")
6893 - (match_operand:SI 2 "const_npow2")))
6894 - (clobber (reg:CC CC_REGNUM))]
6898 - bitclr.c %0, %1, %F2"
6899 - [(set_attr "type" "arith")
6900 - (set_attr "mode" "SI")])
6902 -(define_insn "bitset_c"
6903 - [(set (match_operand:SI 0 "register_operand" "=e,d")
6904 - (ior:SI (match_operand:SI 1 "register_operand" "0,d")
6905 - (match_operand:SI 2 "const_pow2")))
6906 - (clobber (reg:CC CC_REGNUM))]
6910 - bitset.c %0, %1, %E2"
6911 - [(set_attr "type" "arith")
6912 - (set_attr "mode" "SI")])
6914 -(define_insn "bittgl_c"
6915 - [(set (match_operand:SI 0 "register_operand" "=e,d")
6916 - (xor:SI (match_operand:SI 1 "register_operand" "0,d")
6917 - (match_operand:SI 2 "const_pow2")))
6918 - (clobber (reg:CC CC_REGNUM))]
6922 - bittgl.c %0, %1, %E2"
6923 - [(set_attr "type" "arith")
6924 - (set_attr "mode" "SI")])
6925 Index: gcc/config/score/score.c
6926 ===================================================================
6927 --- gcc/config/score/score.c (.../tags/gcc_4_2_0_release) (revision 125292)
6928 +++ gcc/config/score/score.c (.../branches/gcc-4_2-branch) (revision 125292)
6929 @@ -1168,7 +1168,7 @@
6931 gcc_assert (code == CONST_INT);
6932 fprintf (file, HOST_WIDE_INT_PRINT_HEX,
6933 - (unsigned HOST_WIDE_INT) INTVAL (op) >> 16);
6934 + (INTVAL (op) >> 16) & 0xffff);
6938 @@ -1176,7 +1176,7 @@
6940 rtx temp = gen_lowpart (SImode, op);
6941 gcc_assert (GET_MODE (op) == SFmode);
6942 - fprintf (file, HOST_WIDE_INT_PRINT_HEX, INTVAL (temp));
6943 + fprintf (file, HOST_WIDE_INT_PRINT_HEX, INTVAL (temp) & 0xffffffff);
6946 output_addr_const (file, op);
6947 Index: gcc/config/score/score.h
6948 ===================================================================
6949 --- gcc/config/score/score.h (.../tags/gcc_4_2_0_release) (revision 125292)
6950 +++ gcc/config/score/score.h (.../branches/gcc-4_2-branch) (revision 125292)
6952 output anything and let undefined symbol become external. However
6953 the assembler uses length information on externals to allocate in
6954 data/sdata bss/sbss, thereby saving exec time. */
6955 +#undef ASM_OUTPUT_EXTERNAL
6956 #define ASM_OUTPUT_EXTERNAL(STREAM, DECL, NAME) \
6957 score_output_external (STREAM, DECL, NAME)
6959 Index: gcc/config/pa/pa.md
6960 ===================================================================
6961 --- gcc/config/pa/pa.md (.../tags/gcc_4_2_0_release) (revision 125292)
6962 +++ gcc/config/pa/pa.md (.../branches/gcc-4_2-branch) (revision 125292)
6964 (UNSPEC_TLSLDBASE 7)
6967 + (UNSPEC_TLSGD_PIC 10)
6968 + (UNSPEC_TLSLDM_PIC 11)
6969 + (UNSPEC_TLSIE_PIC 12)
6973 @@ -9890,33 +9893,55 @@
6974 (define_insn "tgd_load"
6975 [(set (match_operand:SI 0 "register_operand" "=r")
6976 (unspec:SI [(match_operand 1 "tgd_symbolic_operand" "")] UNSPEC_TLSGD))
6977 - (clobber (reg:SI 1))]
6978 + (clobber (reg:SI 1))
6979 + (use (reg:SI 27))]
6984 - return \"addil LT'%1-$tls_gdidx$,%%r19\;ldo RT'%1-$tls_gdidx$(%%r1),%0\";
6986 - return \"addil LR'%1-$tls_gdidx$,%%r27\;ldo RR'%1-$tls_gdidx$(%%r1),%0\";
6987 + return \"addil LR'%1-$tls_gdidx$,%%r27\;ldo RR'%1-$tls_gdidx$(%%r1),%0\";
6989 [(set_attr "type" "multi")
6990 (set_attr "length" "8")])
6992 +(define_insn "tgd_load_pic"
6993 + [(set (match_operand:SI 0 "register_operand" "=r")
6994 + (unspec:SI [(match_operand 1 "tgd_symbolic_operand" "")] UNSPEC_TLSGD_PIC))
6995 + (clobber (reg:SI 1))
6996 + (use (reg:SI 19))]
7000 + return \"addil LT'%1-$tls_gdidx$,%%r19\;ldo RT'%1-$tls_gdidx$(%%r1),%0\";
7002 + [(set_attr "type" "multi")
7003 + (set_attr "length" "8")])
7005 (define_insn "tld_load"
7006 [(set (match_operand:SI 0 "register_operand" "=r")
7007 (unspec:SI [(match_operand 1 "tld_symbolic_operand" "")] UNSPEC_TLSLDM))
7008 - (clobber (reg:SI 1))]
7009 + (clobber (reg:SI 1))
7010 + (use (reg:SI 27))]
7015 - return \"addil LT'%1-$tls_ldidx$,%%r19\;ldo RT'%1-$tls_ldidx$(%%r1),%0\";
7017 - return \"addil LR'%1-$tls_ldidx$,%%r27\;ldo RR'%1-$tls_ldidx$(%%r1),%0\";
7018 + return \"addil LR'%1-$tls_ldidx$,%%r27\;ldo RR'%1-$tls_ldidx$(%%r1),%0\";
7020 [(set_attr "type" "multi")
7021 (set_attr "length" "8")])
7023 +(define_insn "tld_load_pic"
7024 + [(set (match_operand:SI 0 "register_operand" "=r")
7025 + (unspec:SI [(match_operand 1 "tld_symbolic_operand" "")] UNSPEC_TLSLDM_PIC))
7026 + (clobber (reg:SI 1))
7027 + (use (reg:SI 19))]
7031 + return \"addil LT'%1-$tls_ldidx$,%%r19\;ldo RT'%1-$tls_ldidx$(%%r1),%0\";
7033 + [(set_attr "type" "multi")
7034 + (set_attr "length" "8")])
7036 (define_insn "tld_offset_load"
7037 [(set (match_operand:SI 0 "register_operand" "=r")
7038 (plus:SI (unspec:SI [(match_operand 1 "tld_symbolic_operand" "")]
7039 @@ -9942,18 +9967,29 @@
7040 (define_insn "tie_load"
7041 [(set (match_operand:SI 0 "register_operand" "=r")
7042 (unspec:SI [(match_operand 1 "tie_symbolic_operand" "")] UNSPEC_TLSIE))
7043 - (clobber (reg:SI 1))]
7044 + (clobber (reg:SI 1))
7045 + (use (reg:SI 27))]
7050 - return \"addil LT'%1-$tls_ieoff$,%%r19\;ldw RT'%1-$tls_ieoff$(%%r1),%0\";
7052 - return \"addil LR'%1-$tls_ieoff$,%%r27\;ldw RR'%1-$tls_ieoff$(%%r1),%0\";
7053 + return \"addil LR'%1-$tls_ieoff$,%%r27\;ldw RR'%1-$tls_ieoff$(%%r1),%0\";
7055 [(set_attr "type" "multi")
7056 (set_attr "length" "8")])
7058 +(define_insn "tie_load_pic"
7059 + [(set (match_operand:SI 0 "register_operand" "=r")
7060 + (unspec:SI [(match_operand 1 "tie_symbolic_operand" "")] UNSPEC_TLSIE_PIC))
7061 + (clobber (reg:SI 1))
7062 + (use (reg:SI 19))]
7066 + return \"addil LT'%1-$tls_ieoff$,%%r19\;ldw RT'%1-$tls_ieoff$(%%r1),%0\";
7068 + [(set_attr "type" "multi")
7069 + (set_attr "length" "8")])
7071 (define_insn "tle_load"
7072 [(set (match_operand:SI 0 "register_operand" "=r")
7073 (plus:SI (unspec:SI [(match_operand 1 "tle_symbolic_operand" "")]
7074 Index: gcc/config/pa/pa.c
7075 ===================================================================
7076 --- gcc/config/pa/pa.c (.../tags/gcc_4_2_0_release) (revision 125292)
7077 +++ gcc/config/pa/pa.c (.../branches/gcc-4_2-branch) (revision 125292)
7078 @@ -726,7 +726,10 @@
7080 case TLS_MODEL_GLOBAL_DYNAMIC:
7081 tmp = gen_reg_rtx (Pmode);
7082 - emit_insn (gen_tgd_load (tmp, addr));
7084 + emit_insn (gen_tgd_load_pic (tmp, addr));
7086 + emit_insn (gen_tgd_load (tmp, addr));
7087 ret = hppa_tls_call (tmp);
7090 @@ -734,7 +737,10 @@
7091 ret = gen_reg_rtx (Pmode);
7092 tmp = gen_reg_rtx (Pmode);
7094 - emit_insn (gen_tld_load (tmp, addr));
7096 + emit_insn (gen_tld_load_pic (tmp, addr));
7098 + emit_insn (gen_tld_load (tmp, addr));
7099 t1 = hppa_tls_call (tmp);
7100 insn = get_insns ();
7102 @@ -750,7 +756,10 @@
7103 tmp = gen_reg_rtx (Pmode);
7104 ret = gen_reg_rtx (Pmode);
7105 emit_insn (gen_tp_load (tp));
7106 - emit_insn (gen_tie_load (tmp, addr));
7108 + emit_insn (gen_tie_load_pic (tmp, addr));
7110 + emit_insn (gen_tie_load (tmp, addr));
7111 emit_move_insn (ret, gen_rtx_PLUS (Pmode, tp, tmp));
7114 Index: gcc/config/soft-fp/quad.h
7115 ===================================================================
7116 --- gcc/config/soft-fp/quad.h (.../tags/gcc_4_2_0_release) (revision 125292)
7117 +++ gcc/config/soft-fp/quad.h (.../branches/gcc-4_2-branch) (revision 125292)
7119 /* Software floating-point emulation.
7120 Definitions for IEEE Quad Precision.
7121 - Copyright (C) 1997,1998,1999,2006 Free Software Foundation, Inc.
7122 + Copyright (C) 1997,1998,1999,2006,2007 Free Software Foundation, Inc.
7123 This file is part of the GNU C Library.
7124 Contributed by Richard Henderson (rth@cygnus.com),
7125 Jakub Jelinek (jj@ultra.linux.cz),
7126 @@ -176,15 +176,15 @@
7129 #if __BYTE_ORDER == __BIG_ENDIAN
7130 - unsigned sign : 1;
7131 - unsigned exp : _FP_EXPBITS_Q;
7132 - unsigned long frac1 : _FP_FRACBITS_Q-(_FP_IMPLBIT_Q != 0)-_FP_W_TYPE_SIZE;
7133 - unsigned long frac0 : _FP_W_TYPE_SIZE;
7134 + unsigned sign : 1;
7135 + unsigned exp : _FP_EXPBITS_Q;
7136 + _FP_W_TYPE frac1 : _FP_FRACBITS_Q - (_FP_IMPLBIT_Q != 0) - _FP_W_TYPE_SIZE;
7137 + _FP_W_TYPE frac0 : _FP_W_TYPE_SIZE;
7139 - unsigned long frac0 : _FP_W_TYPE_SIZE;
7140 - unsigned long frac1 : _FP_FRACBITS_Q-(_FP_IMPLBIT_Q != 0)-_FP_W_TYPE_SIZE;
7141 - unsigned exp : _FP_EXPBITS_Q;
7142 - unsigned sign : 1;
7143 + _FP_W_TYPE frac0 : _FP_W_TYPE_SIZE;
7144 + _FP_W_TYPE frac1 : _FP_FRACBITS_Q - (_FP_IMPLBIT_Q != 0) - _FP_W_TYPE_SIZE;
7145 + unsigned exp : _FP_EXPBITS_Q;
7146 + unsigned sign : 1;
7150 Index: gcc/config/soft-fp/floatunsidf.c
7151 ===================================================================
7152 --- gcc/config/soft-fp/floatunsidf.c (.../tags/gcc_4_2_0_release) (revision 125292)
7153 +++ gcc/config/soft-fp/floatunsidf.c (.../branches/gcc-4_2-branch) (revision 125292)
7155 /* Software floating-point emulation.
7156 Convert a 32bit unsigned integer to IEEE double
7157 - Copyright (C) 1997,1999, 2006 Free Software Foundation, Inc.
7158 + Copyright (C) 1997, 1999, 2006, 2007 Free Software Foundation, Inc.
7159 This file is part of the GNU C Library.
7160 Contributed by Richard Henderson (rth@cygnus.com) and
7161 Jakub Jelinek (jj@ultra.linux.cz).
7163 #include "soft-fp.h"
7167 -__floatunsidf(USItype i)
7168 +DFtype __floatunsidf(USItype i)
7172 Index: gcc/config/soft-fp/floatundidf.c
7173 ===================================================================
7174 --- gcc/config/soft-fp/floatundidf.c (.../tags/gcc_4_2_0_release) (revision 125292)
7175 +++ gcc/config/soft-fp/floatundidf.c (.../branches/gcc-4_2-branch) (revision 125292)
7177 /* Software floating-point emulation.
7178 Convert a 64bit unsigned integer to IEEE double
7179 - Copyright (C) 1997,1999, 2006 Free Software Foundation, Inc.
7180 + Copyright (C) 1997, 1999, 2006, 2007 Free Software Foundation, Inc.
7181 This file is part of the GNU C Library.
7182 Contributed by Richard Henderson (rth@cygnus.com) and
7183 Jakub Jelinek (jj@ultra.linux.cz).
7185 #include "soft-fp.h"
7189 -__floatundidf(UDItype i)
7190 +DFtype __floatundidf(UDItype i)
7194 Index: gcc/config/soft-fp/extended.h
7195 ===================================================================
7196 --- gcc/config/soft-fp/extended.h (.../tags/gcc_4_2_0_release) (revision 125292)
7197 +++ gcc/config/soft-fp/extended.h (.../branches/gcc-4_2-branch) (revision 125292)
7199 /* Software floating-point emulation.
7200 Definitions for IEEE Extended Precision.
7201 - Copyright (C) 1999,2006 Free Software Foundation, Inc.
7202 + Copyright (C) 1999,2006,2007 Free Software Foundation, Inc.
7203 This file is part of the GNU C Library.
7204 Contributed by Jakub Jelinek (jj@ultra.linux.cz).
7207 X##_f[1] = _flo.bits.frac1; \
7208 X##_e = _flo.bits.exp; \
7209 X##_s = _flo.bits.sign; \
7210 - if (!X##_e && (X##_f[1] || X##_f[0]) \
7211 - && !(X##_f[1] & _FP_IMPLBIT_E)) \
7214 - FP_SET_EXCEPTION(FP_EX_DENORM); \
7218 #define FP_UNPACK_RAW_EP(X, val) \
7219 @@ -112,12 +106,6 @@
7220 X##_f[1] = _flo->bits.frac1; \
7221 X##_e = _flo->bits.exp; \
7222 X##_s = _flo->bits.sign; \
7223 - if (!X##_e && (X##_f[1] || X##_f[0]) \
7224 - && !(X##_f[1] & _FP_IMPLBIT_E)) \
7227 - FP_SET_EXCEPTION(FP_EX_DENORM); \
7231 #define FP_PACK_RAW_E(val, X) \
7232 @@ -164,13 +152,13 @@
7234 #define FP_UNPACK_SEMIRAW_E(X,val) \
7236 - _FP_UNPACK_RAW_E(X,val); \
7237 + FP_UNPACK_RAW_E(X,val); \
7238 _FP_UNPACK_SEMIRAW(E,4,X); \
7241 #define FP_UNPACK_SEMIRAW_EP(X,val) \
7243 - _FP_UNPACK_RAW_EP(X,val); \
7244 + FP_UNPACK_RAW_EP(X,val); \
7245 _FP_UNPACK_SEMIRAW(E,4,X); \
7248 @@ -189,13 +177,13 @@
7249 #define FP_PACK_SEMIRAW_E(val,X) \
7251 _FP_PACK_SEMIRAW(E,4,X); \
7252 - _FP_PACK_RAW_E(val,X); \
7253 + FP_PACK_RAW_E(val,X); \
7256 #define FP_PACK_SEMIRAW_EP(val,X) \
7258 _FP_PACK_SEMIRAW(E,4,X); \
7259 - _FP_PACK_RAW_EP(val,X); \
7260 + FP_PACK_RAW_EP(val,X); \
7263 #define FP_ISSIGNAN_E(X) _FP_ISSIGNAN(E,4,X)
7264 @@ -277,14 +265,14 @@
7267 #if __BYTE_ORDER == __BIG_ENDIAN
7268 - unsigned long pad : (_FP_W_TYPE_SIZE - 1 - _FP_EXPBITS_E);
7269 - unsigned sign : 1;
7270 - unsigned exp : _FP_EXPBITS_E;
7271 - unsigned long frac : _FP_W_TYPE_SIZE;
7272 + _FP_W_TYPE pad : (_FP_W_TYPE_SIZE - 1 - _FP_EXPBITS_E);
7273 + unsigned sign : 1;
7274 + unsigned exp : _FP_EXPBITS_E;
7275 + _FP_W_TYPE frac : _FP_W_TYPE_SIZE;
7277 - unsigned long frac : _FP_W_TYPE_SIZE;
7278 - unsigned exp : _FP_EXPBITS_E;
7279 - unsigned sign : 1;
7280 + _FP_W_TYPE frac : _FP_W_TYPE_SIZE;
7281 + unsigned exp : _FP_EXPBITS_E;
7282 + unsigned sign : 1;
7286 @@ -299,11 +287,6 @@
7288 X##_e = _flo.bits.exp; \
7289 X##_s = _flo.bits.sign; \
7290 - if (!X##_e && X##_f0 && !(X##_f0 & _FP_IMPLBIT_E)) \
7293 - FP_SET_EXCEPTION(FP_EX_DENORM); \
7297 #define FP_UNPACK_RAW_EP(X, val) \
7298 @@ -315,11 +298,6 @@
7300 X##_e = _flo->bits.exp; \
7301 X##_s = _flo->bits.sign; \
7302 - if (!X##_e && X##_f0 && !(X##_f0 & _FP_IMPLBIT_E)) \
7305 - FP_SET_EXCEPTION(FP_EX_DENORM); \
7309 #define FP_PACK_RAW_E(val, X) \
7310 @@ -365,13 +343,13 @@
7312 #define FP_UNPACK_SEMIRAW_E(X,val) \
7314 - _FP_UNPACK_RAW_E(X,val); \
7315 + FP_UNPACK_RAW_E(X,val); \
7316 _FP_UNPACK_SEMIRAW(E,2,X); \
7319 #define FP_UNPACK_SEMIRAW_EP(X,val) \
7321 - _FP_UNPACK_RAW_EP(X,val); \
7322 + FP_UNPACK_RAW_EP(X,val); \
7323 _FP_UNPACK_SEMIRAW(E,2,X); \
7326 @@ -390,13 +368,13 @@
7327 #define FP_PACK_SEMIRAW_E(val,X) \
7329 _FP_PACK_SEMIRAW(E,2,X); \
7330 - _FP_PACK_RAW_E(val,X); \
7331 + FP_PACK_RAW_E(val,X); \
7334 #define FP_PACK_SEMIRAW_EP(val,X) \
7336 _FP_PACK_SEMIRAW(E,2,X); \
7337 - _FP_PACK_RAW_EP(val,X); \
7338 + FP_PACK_RAW_EP(val,X); \
7341 #define FP_ISSIGNAN_E(X) _FP_ISSIGNAN(E,2,X)
7342 Index: gcc/config/soft-fp/floatunsisf.c
7343 ===================================================================
7344 --- gcc/config/soft-fp/floatunsisf.c (.../tags/gcc_4_2_0_release) (revision 125292)
7345 +++ gcc/config/soft-fp/floatunsisf.c (.../branches/gcc-4_2-branch) (revision 125292)
7347 /* Software floating-point emulation.
7348 Convert a 32bit unsigned integer to IEEE single
7349 - Copyright (C) 1997,1999, 2006 Free Software Foundation, Inc.
7350 + Copyright (C) 1997, 1999, 2006, 2007 Free Software Foundation, Inc.
7351 This file is part of the GNU C Library.
7352 Contributed by Richard Henderson (rth@cygnus.com) and
7353 Jakub Jelinek (jj@ultra.linux.cz).
7355 #include "soft-fp.h"
7359 -__floatunsisf(USItype i)
7360 +SFtype __floatunsisf(USItype i)
7364 Index: gcc/config/soft-fp/op-common.h
7365 ===================================================================
7366 --- gcc/config/soft-fp/op-common.h (.../tags/gcc_4_2_0_release) (revision 125292)
7367 +++ gcc/config/soft-fp/op-common.h (.../branches/gcc-4_2-branch) (revision 125292)
7368 @@ -1153,7 +1153,8 @@
7369 if (_FP_FRACBITS_##dfs < _FP_FRACBITS_##sfs \
7370 || (_FP_EXPMAX_##dfs - _FP_EXPBIAS_##dfs \
7371 < _FP_EXPMAX_##sfs - _FP_EXPBIAS_##sfs) \
7372 - || _FP_EXPBIAS_##dfs < _FP_EXPBIAS_##sfs + _FP_FRACBITS_##sfs - 1) \
7373 + || (_FP_EXPBIAS_##dfs < _FP_EXPBIAS_##sfs + _FP_FRACBITS_##sfs - 1 \
7374 + && _FP_EXPBIAS_##dfs != _FP_EXPBIAS_##sfs)) \
7377 _FP_FRAC_COPY_##dwc##_##swc(D, S); \
7378 @@ -1168,6 +1169,14 @@
7380 if (_FP_FRAC_ZEROP_##swc(S)) \
7382 + else if (_FP_EXPBIAS_##dfs \
7383 + < _FP_EXPBIAS_##sfs + _FP_FRACBITS_##sfs - 1) \
7385 + FP_SET_EXCEPTION(FP_EX_DENORM); \
7386 + _FP_FRAC_SLL_##dwc(D, (_FP_FRACBITS_##dfs \
7387 + - _FP_FRACBITS_##sfs)); \
7393 @@ -1199,7 +1208,8 @@
7394 #define FP_TRUNC(dfs,sfs,dwc,swc,D,S) \
7396 if (_FP_FRACBITS_##sfs < _FP_FRACBITS_##dfs \
7397 - || _FP_EXPBIAS_##sfs < _FP_EXPBIAS_##dfs + _FP_FRACBITS_##dfs - 1) \
7398 + || (_FP_EXPBIAS_##sfs < _FP_EXPBIAS_##dfs + _FP_FRACBITS_##dfs - 1 \
7399 + && _FP_EXPBIAS_##sfs != _FP_EXPBIAS_##dfs)) \
7402 if (_FP_EXP_NORMAL(sfs, swc, S)) \
7403 @@ -1211,8 +1221,11 @@
7407 - if (D##_e <= 1 - _FP_FRACBITS_##dfs) \
7408 - _FP_FRAC_SET_##swc(S, _FP_ZEROFRAC_##swc); \
7409 + if (D##_e < 1 - _FP_FRACBITS_##dfs) \
7411 + _FP_FRAC_SET_##swc(S, _FP_ZEROFRAC_##swc); \
7412 + _FP_FRAC_LOW_##swc(S) |= 1; \
7416 _FP_FRAC_HIGH_##sfs(S) |= _FP_IMPLBIT_SH_##sfs; \
7417 @@ -1234,11 +1247,24 @@
7421 - _FP_FRAC_SET_##dwc(D, _FP_ZEROFRAC_##dwc); \
7422 - if (!_FP_FRAC_ZEROP_##swc(S)) \
7423 + if (_FP_FRAC_ZEROP_##swc(S)) \
7424 + _FP_FRAC_SET_##dwc(D, _FP_ZEROFRAC_##dwc); \
7427 FP_SET_EXCEPTION(FP_EX_DENORM); \
7428 - FP_SET_EXCEPTION(FP_EX_INEXACT); \
7429 + if (_FP_EXPBIAS_##sfs \
7430 + < _FP_EXPBIAS_##dfs + _FP_FRACBITS_##dfs - 1) \
7432 + _FP_FRAC_SRS_##swc(S, (_FP_WFRACBITS_##sfs \
7433 + - _FP_WFRACBITS_##dfs), \
7434 + _FP_WFRACBITS_##sfs); \
7435 + _FP_FRAC_COPY_##dwc##_##swc(D, S); \
7439 + _FP_FRAC_SET_##dwc(D, _FP_ZEROFRAC_##dwc); \
7440 + _FP_FRAC_LOW_##dwc(D) |= 1; \
7445 Index: gcc/config/soft-fp/floatundisf.c
7446 ===================================================================
7447 --- gcc/config/soft-fp/floatundisf.c (.../tags/gcc_4_2_0_release) (revision 125292)
7448 +++ gcc/config/soft-fp/floatundisf.c (.../branches/gcc-4_2-branch) (revision 125292)
7450 /* Software floating-point emulation.
7451 Convert a 64bit unsigned integer to IEEE single
7452 - Copyright (C) 1997,1999, 2006 Free Software Foundation, Inc.
7453 + Copyright (C) 1997, 1999, 2006, 2007 Free Software Foundation, Inc.
7454 This file is part of the GNU C Library.
7455 Contributed by Richard Henderson (rth@cygnus.com) and
7456 Jakub Jelinek (jj@ultra.linux.cz).
7458 #include "soft-fp.h"
7462 -__floatundisf(UDItype i)
7463 +SFtype __floatundisf(UDItype i)
7467 Index: gcc/config/soft-fp/op-2.h
7468 ===================================================================
7469 --- gcc/config/soft-fp/op-2.h (.../tags/gcc_4_2_0_release) (revision 125292)
7470 +++ gcc/config/soft-fp/op-2.h (.../branches/gcc-4_2-branch) (revision 125292)
7472 /* Software floating-point emulation.
7473 Basic two-word fraction declaration and manipulation.
7474 - Copyright (C) 1997,1998,1999,2006 Free Software Foundation, Inc.
7475 + Copyright (C) 1997,1998,1999,2006,2007 Free Software Foundation, Inc.
7476 This file is part of the GNU C Library.
7477 Contributed by Richard Henderson (rth@cygnus.com),
7478 Jakub Jelinek (jj@ultra.linux.cz),
7480 #define _FP_FRAC_COPY_1_2(D, S) (D##_f = S##_f0)
7482 #define _FP_FRAC_COPY_2_1(D, S) ((D##_f0 = S##_f), (D##_f1 = 0))
7484 +#define _FP_FRAC_COPY_2_2(D,S) _FP_FRAC_COPY_2(D,S)
7485 Index: gcc/config/soft-fp/op-4.h
7486 ===================================================================
7487 --- gcc/config/soft-fp/op-4.h (.../tags/gcc_4_2_0_release) (revision 125292)
7488 +++ gcc/config/soft-fp/op-4.h (.../branches/gcc-4_2-branch) (revision 125292)
7490 /* Software floating-point emulation.
7491 Basic four-word fraction declaration and manipulation.
7492 - Copyright (C) 1997,1998,1999,2006 Free Software Foundation, Inc.
7493 + Copyright (C) 1997,1998,1999,2006,2007 Free Software Foundation, Inc.
7494 This file is part of the GNU C Library.
7495 Contributed by Richard Henderson (rth@cygnus.com),
7496 Jakub Jelinek (jj@ultra.linux.cz),
7498 D##_f[1] = S##_f1; \
7499 D##_f[2] = D##_f[3] = 0; \
7502 +#define _FP_FRAC_COPY_4_4(D,S) _FP_FRAC_COPY_4(D,S)
7503 Index: gcc/config/soft-fp/double.h
7504 ===================================================================
7505 --- gcc/config/soft-fp/double.h (.../tags/gcc_4_2_0_release) (revision 125292)
7506 +++ gcc/config/soft-fp/double.h (.../branches/gcc-4_2-branch) (revision 125292)
7508 /* Software floating-point emulation.
7509 Definitions for IEEE Double Precision
7510 - Copyright (C) 1997,1998,1999,2006 Free Software Foundation, Inc.
7511 + Copyright (C) 1997,1998,1999,2006,2007 Free Software Foundation, Inc.
7512 This file is part of the GNU C Library.
7513 Contributed by Richard Henderson (rth@cygnus.com),
7514 Jakub Jelinek (jj@ultra.linux.cz),
7515 @@ -168,13 +168,13 @@
7518 #if __BYTE_ORDER == __BIG_ENDIAN
7519 - unsigned sign : 1;
7520 - unsigned exp : _FP_EXPBITS_D;
7521 - unsigned long frac : _FP_FRACBITS_D - (_FP_IMPLBIT_D != 0);
7522 + unsigned sign : 1;
7523 + unsigned exp : _FP_EXPBITS_D;
7524 + _FP_W_TYPE frac : _FP_FRACBITS_D - (_FP_IMPLBIT_D != 0);
7526 - unsigned long frac : _FP_FRACBITS_D - (_FP_IMPLBIT_D != 0);
7527 - unsigned exp : _FP_EXPBITS_D;
7528 - unsigned sign : 1;
7529 + _FP_W_TYPE frac : _FP_FRACBITS_D - (_FP_IMPLBIT_D != 0);
7530 + unsigned exp : _FP_EXPBITS_D;
7531 + unsigned sign : 1;
7533 } bits __attribute__((packed));
7535 Index: libstdc++-v3/configure
7536 ===================================================================
7537 --- libstdc++-v3/configure (.../tags/gcc_4_2_0_release) (revision 125292)
7538 +++ libstdc++-v3/configure (.../branches/gcc-4_2-branch) (revision 125292)
7539 @@ -5764,8 +5764,6 @@
7543 - echo "$as_me:$LINENO: checking for C locale to use" >&5
7544 -echo $ECHO_N "checking for C locale to use... $ECHO_C" >&6
7545 # Check whether --enable-clocale or --disable-clocale was given.
7546 if test "${enable_clocale+set}" = set; then
7547 enableval="$enable_clocale"
7548 @@ -5782,32 +5780,53 @@
7552 - # If they didn't use this option switch, or if they specified --enable
7553 - # with no specific model, we'll have to look for one. If they
7554 - # specified --disable (???), do likewise.
7555 + # Deal with gettext issues. Default to not using it (=no) until we detect
7556 + # support for it later. Let the user turn it off via --e/d, but let that
7557 + # default to on for easier handling.
7559 + # Check whether --enable-nls or --disable-nls was given.
7560 +if test "${enable_nls+set}" = set; then
7561 + enableval="$enable_nls"
7567 + # Either a known packaage, or "auto"
7568 if test $enable_clocale = no || test $enable_clocale = yes; then
7572 - # Either a known package, or "auto"
7573 enable_clocale_flag=$enable_clocale
7575 - # Probe for locale support if no specific model is specified.
7576 + # Probe for locale model to use if none specified.
7577 # Default to "generic".
7578 if test $enable_clocale_flag = auto; then
7579 case ${target_os} in
7580 linux* | gnu* | kfreebsd*-gnu | knetbsd*-gnu)
7581 - cat >conftest.$ac_ext <<_ACEOF
7582 + enable_clocale_flag=gnu
7584 + darwin* | freebsd*)
7585 + enable_clocale_flag=darwin
7588 + enable_clocale_flag=generic
7593 + # Sanity check model, and test for special functionality.
7594 + if test $enable_clocale_flag = gnu; then
7595 + cat >conftest.$ac_ext <<_ACEOF
7598 cat confdefs.h >>conftest.$ac_ext
7599 cat >>conftest.$ac_ext <<_ACEOF
7600 /* end confdefs.h. */
7602 - #include <features.h>
7603 - #if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2)
7606 + #include <features.h>
7607 + #if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2)
7612 if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
7613 @@ -5819,9 +5838,8 @@
7617 - # Test for bugs early in glibc-2.2.x series
7618 - if test $enable_clocale_flag = gnu; then
7619 - if test "$cross_compiling" = yes; then
7620 + # Test for bugs early in glibc-2.2.x series
7621 + if test "$cross_compiling" = yes; then
7622 enable_clocale_flag=generic
7624 cat >conftest.$ac_ext <<_ACEOF
7625 @@ -5831,28 +5849,28 @@
7626 cat >>conftest.$ac_ext <<_ACEOF
7627 /* end confdefs.h. */
7629 - #define _GNU_SOURCE 1
7630 - #include <locale.h>
7631 - #include <string.h>
7632 - #if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2)
7633 - extern __typeof(newlocale) __newlocale;
7634 - extern __typeof(duplocale) __duplocale;
7635 - extern __typeof(strcoll_l) __strcoll_l;
7639 - const char __one[] = "Äuglein Augmen";
7640 - const char __two[] = "Äuglein";
7644 - __locale_t loc_dup;
7645 - loc = __newlocale(1 << LC_ALL, "de_DE", 0);
7646 - loc_dup = __duplocale(loc);
7647 - i = __strcoll_l(__one, __two, loc);
7648 - j = __strcoll_l(__one, __two, loc_dup);
7651 + #define _GNU_SOURCE 1
7652 + #include <locale.h>
7653 + #include <string.h>
7654 + #if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2)
7655 + extern __typeof(newlocale) __newlocale;
7656 + extern __typeof(duplocale) __duplocale;
7657 + extern __typeof(strcoll_l) __strcoll_l;
7661 + const char __one[] = "Äuglein Augmen";
7662 + const char __two[] = "Äuglein";
7666 + __locale_t loc_dup;
7667 + loc = __newlocale(1 << LC_ALL, "de_DE", 0);
7668 + loc_dup = __duplocale(loc);
7669 + i = __strcoll_l(__one, __two, loc);
7670 + j = __strcoll_l(__one, __two, loc_dup);
7675 rm -f conftest$ac_exeext
7676 @@ -5877,32 +5895,176 @@
7678 rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
7682 - # ... at some point put __strxfrm_l tests in as well.
7684 - darwin* | freebsd*)
7685 - enable_clocale_flag=darwin
7688 - enable_clocale_flag=generic
7691 + # Set it to scream when it hurts.
7692 + ac_save_CFLAGS="$CFLAGS"
7693 + CFLAGS="-Wimplicit-function-declaration -Werror"
7695 + # Use strxfrm_l if available.
7696 + cat >conftest.$ac_ext <<_ACEOF
7699 +cat confdefs.h >>conftest.$ac_ext
7700 +cat >>conftest.$ac_ext <<_ACEOF
7701 +/* end confdefs.h. */
7702 +#define _GNU_SOURCE 1
7703 + #include <string.h>
7704 + #include <locale.h>
7708 +char s[128]; __locale_t loc; strxfrm_l(s, "C", 5, loc);
7713 +rm -f conftest.$ac_objext
7714 +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
7715 + (eval $ac_compile) 2>conftest.er1
7717 + grep -v '^ *+' conftest.er1 >conftest.err
7718 + rm -f conftest.er1
7719 + cat conftest.err >&5
7720 + echo "$as_me:$LINENO: \$? = $ac_status" >&5
7721 + (exit $ac_status); } &&
7722 + { ac_try='test -z "$ac_c_werror_flag"
7723 + || test ! -s conftest.err'
7724 + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
7725 + (eval $ac_try) 2>&5
7727 + echo "$as_me:$LINENO: \$? = $ac_status" >&5
7728 + (exit $ac_status); }; } &&
7729 + { ac_try='test -s conftest.$ac_objext'
7730 + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
7731 + (eval $ac_try) 2>&5
7733 + echo "$as_me:$LINENO: \$? = $ac_status" >&5
7734 + (exit $ac_status); }; }; then
7736 +cat >>confdefs.h <<\_ACEOF
7737 +#define HAVE_STRXFRM_L 1
7741 + echo "$as_me: failed program was:" >&5
7742 +sed 's/^/| /' conftest.$ac_ext >&5
7745 +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
7747 + # Use strerror_l if available.
7748 + cat >conftest.$ac_ext <<_ACEOF
7751 +cat confdefs.h >>conftest.$ac_ext
7752 +cat >>conftest.$ac_ext <<_ACEOF
7753 +/* end confdefs.h. */
7754 +#define _GNU_SOURCE 1
7755 + #include <string.h>
7756 + #include <locale.h>
7760 +__locale_t loc; strerror_l(5, loc);
7765 +rm -f conftest.$ac_objext
7766 +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
7767 + (eval $ac_compile) 2>conftest.er1
7769 + grep -v '^ *+' conftest.er1 >conftest.err
7770 + rm -f conftest.er1
7771 + cat conftest.err >&5
7772 + echo "$as_me:$LINENO: \$? = $ac_status" >&5
7773 + (exit $ac_status); } &&
7774 + { ac_try='test -z "$ac_c_werror_flag"
7775 + || test ! -s conftest.err'
7776 + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
7777 + (eval $ac_try) 2>&5
7779 + echo "$as_me:$LINENO: \$? = $ac_status" >&5
7780 + (exit $ac_status); }; } &&
7781 + { ac_try='test -s conftest.$ac_objext'
7782 + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
7783 + (eval $ac_try) 2>&5
7785 + echo "$as_me:$LINENO: \$? = $ac_status" >&5
7786 + (exit $ac_status); }; }; then
7788 +cat >>confdefs.h <<\_ACEOF
7789 +#define HAVE_STRERROR_L 1
7793 + echo "$as_me: failed program was:" >&5
7794 +sed 's/^/| /' conftest.$ac_ext >&5
7797 +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
7799 + CFLAGS="$ac_save_CFLAGS"
7802 - # Deal with gettext issues. Default to not using it (=no) until we detect
7803 - # support for it later. Let the user turn it off via --e/d, but let that
7804 - # default to on for easier handling.
7806 - # Check whether --enable-nls or --disable-nls was given.
7807 -if test "${enable_nls+set}" = set; then
7808 - enableval="$enable_nls"
7809 + # Perhaps use strerror_r if available, and strerror_l isn't.
7810 + ac_save_CFLAGS="$CFLAGS"
7811 + CFLAGS="-Wimplicit-function-declaration -Werror"
7812 + cat >conftest.$ac_ext <<_ACEOF
7815 +cat confdefs.h >>conftest.$ac_ext
7816 +cat >>conftest.$ac_ext <<_ACEOF
7817 +/* end confdefs.h. */
7818 +#define _GNU_SOURCE 1
7819 + #include <string.h>
7820 + #include <locale.h>
7824 +char s[128]; strerror_r(5, s, 128);
7829 +rm -f conftest.$ac_objext
7830 +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
7831 + (eval $ac_compile) 2>conftest.er1
7833 + grep -v '^ *+' conftest.er1 >conftest.err
7834 + rm -f conftest.er1
7835 + cat conftest.err >&5
7836 + echo "$as_me:$LINENO: \$? = $ac_status" >&5
7837 + (exit $ac_status); } &&
7838 + { ac_try='test -z "$ac_c_werror_flag"
7839 + || test ! -s conftest.err'
7840 + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
7841 + (eval $ac_try) 2>&5
7843 + echo "$as_me:$LINENO: \$? = $ac_status" >&5
7844 + (exit $ac_status); }; } &&
7845 + { ac_try='test -s conftest.$ac_objext'
7846 + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
7847 + (eval $ac_try) 2>&5
7849 + echo "$as_me:$LINENO: \$? = $ac_status" >&5
7850 + (exit $ac_status); }; }; then
7852 +cat >>confdefs.h <<\_ACEOF
7853 +#define HAVE_STRERROR_R 1
7859 + echo "$as_me: failed program was:" >&5
7860 +sed 's/^/| /' conftest.$ac_ext >&5
7863 +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
7864 + CFLAGS="$ac_save_CFLAGS"
7866 # Set configure bits for specified locale package
7867 + echo "$as_me:$LINENO: checking for C locale to use" >&5
7868 +echo $ECHO_N "checking for C locale to use... $ECHO_C" >&6
7869 case ${enable_clocale_flag} in
7871 echo "$as_me:$LINENO: result: generic" >&5
7872 @@ -8015,7 +8177,7 @@
7874 # Fake what AC_TRY_COMPILE does. XXX Look at redoing this new-style.
7875 cat > conftest.$ac_ext << EOF
7876 -#line 8018 "configure"
7877 +#line 8180 "configure"
7880 // NB: _Atomic_word not necessarily int.
7881 @@ -8395,11 +8557,9 @@
7882 # NB: This flag only works reliably after 2.16.1. Configure tests
7883 # for this are difficult, so hard wire a value that should work.
7885 - # All these tests are for C++, but run with the "C" compiler driver.
7886 - # Need to do this so that g++ won't try to link in libstdc++/libsupc++.
7887 ac_test_CFLAGS="${CFLAGS+set}"
7888 ac_save_CFLAGS="$CFLAGS"
7889 - CFLAGS='-x c++ -Wl,--gc-sections'
7890 + CFLAGS='-Wl,--gc-sections'
7892 # Check for -Wl,--gc-sections
7893 echo "$as_me:$LINENO: checking for ld that supports -Wl,--gc-sections" >&5
7894 @@ -54307,11 +54467,9 @@
7895 # NB: This flag only works reliably after 2.16.1. Configure tests
7896 # for this are difficult, so hard wire a value that should work.
7898 - # All these tests are for C++, but run with the "C" compiler driver.
7899 - # Need to do this so that g++ won't try to link in libstdc++/libsupc++.
7900 ac_test_CFLAGS="${CFLAGS+set}"
7901 ac_save_CFLAGS="$CFLAGS"
7902 - CFLAGS='-x c++ -Wl,--gc-sections'
7903 + CFLAGS='-Wl,--gc-sections'
7905 # Check for -Wl,--gc-sections
7906 echo "$as_me:$LINENO: checking for ld that supports -Wl,--gc-sections" >&5
7907 @@ -75669,11 +75827,9 @@
7908 # NB: This flag only works reliably after 2.16.1. Configure tests
7909 # for this are difficult, so hard wire a value that should work.
7911 - # All these tests are for C++, but run with the "C" compiler driver.
7912 - # Need to do this so that g++ won't try to link in libstdc++/libsupc++.
7913 ac_test_CFLAGS="${CFLAGS+set}"
7914 ac_save_CFLAGS="$CFLAGS"
7915 - CFLAGS='-x c++ -Wl,--gc-sections'
7916 + CFLAGS='-Wl,--gc-sections'
7918 # Check for -Wl,--gc-sections
7919 echo "$as_me:$LINENO: checking for ld that supports -Wl,--gc-sections" >&5
7920 @@ -77194,11 +77350,9 @@
7921 # NB: This flag only works reliably after 2.16.1. Configure tests
7922 # for this are difficult, so hard wire a value that should work.
7924 - # All these tests are for C++, but run with the "C" compiler driver.
7925 - # Need to do this so that g++ won't try to link in libstdc++/libsupc++.
7926 ac_test_CFLAGS="${CFLAGS+set}"
7927 ac_save_CFLAGS="$CFLAGS"
7928 - CFLAGS='-x c++ -Wl,--gc-sections'
7929 + CFLAGS='-Wl,--gc-sections'
7931 # Check for -Wl,--gc-sections
7932 echo "$as_me:$LINENO: checking for ld that supports -Wl,--gc-sections" >&5
7933 @@ -78687,11 +78841,9 @@
7934 # NB: This flag only works reliably after 2.16.1. Configure tests
7935 # for this are difficult, so hard wire a value that should work.
7937 - # All these tests are for C++, but run with the "C" compiler driver.
7938 - # Need to do this so that g++ won't try to link in libstdc++/libsupc++.
7939 ac_test_CFLAGS="${CFLAGS+set}"
7940 ac_save_CFLAGS="$CFLAGS"
7941 - CFLAGS='-x c++ -Wl,--gc-sections'
7942 + CFLAGS='-Wl,--gc-sections'
7944 # Check for -Wl,--gc-sections
7945 echo "$as_me:$LINENO: checking for ld that supports -Wl,--gc-sections" >&5
7946 @@ -100579,11 +100731,9 @@
7947 # NB: This flag only works reliably after 2.16.1. Configure tests
7948 # for this are difficult, so hard wire a value that should work.
7950 - # All these tests are for C++, but run with the "C" compiler driver.
7951 - # Need to do this so that g++ won't try to link in libstdc++/libsupc++.
7952 ac_test_CFLAGS="${CFLAGS+set}"
7953 ac_save_CFLAGS="$CFLAGS"
7954 - CFLAGS='-x c++ -Wl,--gc-sections'
7955 + CFLAGS='-Wl,--gc-sections'
7957 # Check for -Wl,--gc-sections
7958 echo "$as_me:$LINENO: checking for ld that supports -Wl,--gc-sections" >&5
7959 @@ -101426,11 +101576,9 @@
7960 # NB: This flag only works reliably after 2.16.1. Configure tests
7961 # for this are difficult, so hard wire a value that should work.
7963 - # All these tests are for C++, but run with the "C" compiler driver.
7964 - # Need to do this so that g++ won't try to link in libstdc++/libsupc++.
7965 ac_test_CFLAGS="${CFLAGS+set}"
7966 ac_save_CFLAGS="$CFLAGS"
7967 - CFLAGS='-x c++ -Wl,--gc-sections'
7968 + CFLAGS='-Wl,--gc-sections'
7970 # Check for -Wl,--gc-sections
7971 echo "$as_me:$LINENO: checking for ld that supports -Wl,--gc-sections" >&5
7972 @@ -102829,11 +102977,9 @@
7973 # NB: This flag only works reliably after 2.16.1. Configure tests
7974 # for this are difficult, so hard wire a value that should work.
7976 - # All these tests are for C++, but run with the "C" compiler driver.
7977 - # Need to do this so that g++ won't try to link in libstdc++/libsupc++.
7978 ac_test_CFLAGS="${CFLAGS+set}"
7979 ac_save_CFLAGS="$CFLAGS"
7980 - CFLAGS='-x c++ -Wl,--gc-sections'
7981 + CFLAGS='-Wl,--gc-sections'
7983 # Check for -Wl,--gc-sections
7984 echo "$as_me:$LINENO: checking for ld that supports -Wl,--gc-sections" >&5
7985 @@ -104624,11 +104770,9 @@
7986 # NB: This flag only works reliably after 2.16.1. Configure tests
7987 # for this are difficult, so hard wire a value that should work.
7989 - # All these tests are for C++, but run with the "C" compiler driver.
7990 - # Need to do this so that g++ won't try to link in libstdc++/libsupc++.
7991 ac_test_CFLAGS="${CFLAGS+set}"
7992 ac_save_CFLAGS="$CFLAGS"
7993 - CFLAGS='-x c++ -Wl,--gc-sections'
7994 + CFLAGS='-Wl,--gc-sections'
7996 # Check for -Wl,--gc-sections
7997 echo "$as_me:$LINENO: checking for ld that supports -Wl,--gc-sections" >&5
7998 @@ -105869,11 +106013,9 @@
7999 # NB: This flag only works reliably after 2.16.1. Configure tests
8000 # for this are difficult, so hard wire a value that should work.
8002 - # All these tests are for C++, but run with the "C" compiler driver.
8003 - # Need to do this so that g++ won't try to link in libstdc++/libsupc++.
8004 ac_test_CFLAGS="${CFLAGS+set}"
8005 ac_save_CFLAGS="$CFLAGS"
8006 - CFLAGS='-x c++ -Wl,--gc-sections'
8007 + CFLAGS='-Wl,--gc-sections'
8009 # Check for -Wl,--gc-sections
8010 echo "$as_me:$LINENO: checking for ld that supports -Wl,--gc-sections" >&5
8011 @@ -106898,11 +107040,9 @@
8012 # NB: This flag only works reliably after 2.16.1. Configure tests
8013 # for this are difficult, so hard wire a value that should work.
8015 - # All these tests are for C++, but run with the "C" compiler driver.
8016 - # Need to do this so that g++ won't try to link in libstdc++/libsupc++.
8017 ac_test_CFLAGS="${CFLAGS+set}"
8018 ac_save_CFLAGS="$CFLAGS"
8019 - CFLAGS='-x c++ -Wl,--gc-sections'
8020 + CFLAGS='-Wl,--gc-sections'
8022 # Check for -Wl,--gc-sections
8023 echo "$as_me:$LINENO: checking for ld that supports -Wl,--gc-sections" >&5
8024 Index: libstdc++-v3/include/bits/ostream.tcc
8025 ===================================================================
8026 --- libstdc++-v3/include/bits/ostream.tcc (.../tags/gcc_4_2_0_release) (revision 125292)
8027 +++ libstdc++-v3/include/bits/ostream.tcc (.../branches/gcc-4_2-branch) (revision 125292)
8029 extern template ostream& operator<<(ostream&, const char*);
8030 extern template ostream& operator<<(ostream&, const unsigned char*);
8031 extern template ostream& operator<<(ostream&, const signed char*);
8032 - extern template ostream& __ostream_insert(ostream&, const char*, streamsize);
8034 extern template ostream& ostream::_M_insert(long);
8035 extern template ostream& ostream::_M_insert(unsigned long);
8037 extern template wostream& operator<<(wostream&, char);
8038 extern template wostream& operator<<(wostream&, const wchar_t*);
8039 extern template wostream& operator<<(wostream&, const char*);
8040 - extern template wostream& __ostream_insert(wostream&, const wchar_t*,
8043 extern template wostream& wostream::_M_insert(long);
8044 extern template wostream& wostream::_M_insert(unsigned long);
8045 Index: libstdc++-v3/include/bits/ostream_insert.h
8046 ===================================================================
8047 --- libstdc++-v3/include/bits/ostream_insert.h (.../tags/gcc_4_2_0_release) (revision 125292)
8048 +++ libstdc++-v3/include/bits/ostream_insert.h (.../branches/gcc-4_2-branch) (revision 125292)
8049 @@ -109,6 +109,18 @@
8053 + // Inhibit implicit instantiations for required instantiations,
8054 + // which are defined via explicit instantiations elsewhere.
8055 + // NB: This syntax is a GNU extension.
8056 +#if _GLIBCXX_EXTERN_TEMPLATE
8057 + extern template ostream& __ostream_insert(ostream&, const char*, streamsize);
8059 +#ifdef _GLIBCXX_USE_WCHAR_T
8060 + extern template wostream& __ostream_insert(wostream&, const wchar_t*,
8065 _GLIBCXX_END_NAMESPACE
8067 #endif /* _OSTREAM_INSERT_H */
8068 Index: libstdc++-v3/ChangeLog
8069 ===================================================================
8070 --- libstdc++-v3/ChangeLog (.../tags/gcc_4_2_0_release) (revision 125292)
8071 +++ libstdc++-v3/ChangeLog (.../branches/gcc-4_2-branch) (revision 125292)
8073 +2007-05-28 Benjamin Kosnik <bkoz@redhat.com>
8075 + PR libstdc++/31717
8076 + * acinclude.m4 (GLIBCXX_ENABLE_CLOCALE): Re-organize. Sanity check
8077 + gnu locale model requests to make sure it will work for the requested
8078 + target. Add checks for strxfrm_l, strerror_l when in gnu locale,
8079 + and strerror_r everywhere.
8080 + * aclocal.m4: Regenerated.
8081 + * configure: Regenerated.
8082 + * config.h.in: Regenerated.
8084 +2007-05-24 Paolo Carlini <pcarlini@suse.de>
8086 + * include/bits/ostream.tcc: Do not inhibit implicit instantiation
8087 + of __ostream_insert here...
8088 + * include/bits/ostream_insert.h: ... do it here.
8090 +2007-05-21 Paolo Carlini <pcarlini@suse.de>
8092 + PR libstdc++/31621
8093 + * acinclude.m4 ([GLIBCXX_CHECK_LINKER_FEATURES]): Use the C compiler.
8094 + * configure: Regenerate.
8096 2007-05-13 Release Manager
8098 * GCC 4.2.0 released.
8099 Index: libstdc++-v3/config.h.in
8100 ===================================================================
8101 --- libstdc++-v3/config.h.in (.../tags/gcc_4_2_0_release) (revision 125292)
8102 +++ libstdc++-v3/config.h.in (.../branches/gcc-4_2-branch) (revision 125292)
8103 @@ -298,6 +298,12 @@
8104 /* Define to 1 if you have the <stdlib.h> header file. */
8105 #undef HAVE_STDLIB_H
8107 +/* Define if strerror_l is available in <string.h>. */
8108 +#undef HAVE_STRERROR_L
8110 +/* Define if strerror_r is available in <string.h>. */
8111 +#undef HAVE_STRERROR_R
8113 /* Define to 1 if you have the <strings.h> header file. */
8114 #undef HAVE_STRINGS_H
8117 /* Define to 1 if you have the `strtold' function. */
8120 +/* Define if strxfrm_l is available in <string.h>. */
8121 +#undef HAVE_STRXFRM_L
8123 /* Define to 1 if you have the <sys/filio.h> header file. */
8124 #undef HAVE_SYS_FILIO_H
8126 Index: libstdc++-v3/acinclude.m4
8127 ===================================================================
8128 --- libstdc++-v3/acinclude.m4 (.../tags/gcc_4_2_0_release) (revision 125292)
8129 +++ libstdc++-v3/acinclude.m4 (.../branches/gcc-4_2-branch) (revision 125292)
8130 @@ -251,11 +251,9 @@
8131 # NB: This flag only works reliably after 2.16.1. Configure tests
8132 # for this are difficult, so hard wire a value that should work.
8134 - # All these tests are for C++, but run with the "C" compiler driver.
8135 - # Need to do this so that g++ won't try to link in libstdc++/libsupc++.
8136 ac_test_CFLAGS="${CFLAGS+set}"
8137 ac_save_CFLAGS="$CFLAGS"
8138 - CFLAGS='-x c++ -Wl,--gc-sections'
8139 + CFLAGS='-Wl,--gc-sections'
8141 # Check for -Wl,--gc-sections
8142 AC_MSG_CHECKING([for ld that supports -Wl,--gc-sections])
8143 @@ -1334,64 +1332,31 @@
8144 dnl Default is generic.
8146 AC_DEFUN([GLIBCXX_ENABLE_CLOCALE], [
8147 - AC_MSG_CHECKING([for C locale to use])
8148 GLIBCXX_ENABLE(clocale,auto,[@<:@=MODEL@:>@],
8149 [use MODEL for target locale package],
8150 [permit generic|gnu|ieee_1003.1-2001|yes|no|auto])
8152 + # Deal with gettext issues. Default to not using it (=no) until we detect
8153 + # support for it later. Let the user turn it off via --e/d, but let that
8154 + # default to on for easier handling.
8156 + AC_ARG_ENABLE(nls,
8157 + AC_HELP_STRING([--enable-nls],[use Native Language Support (default)]),
8161 - # If they didn't use this option switch, or if they specified --enable
8162 - # with no specific model, we'll have to look for one. If they
8163 - # specified --disable (???), do likewise.
8164 + # Either a known packaage, or "auto"
8165 if test $enable_clocale = no || test $enable_clocale = yes; then
8169 - # Either a known package, or "auto"
8170 enable_clocale_flag=$enable_clocale
8172 - # Probe for locale support if no specific model is specified.
8173 + # Probe for locale model to use if none specified.
8174 # Default to "generic".
8175 if test $enable_clocale_flag = auto; then
8176 case ${target_os} in
8177 linux* | gnu* | kfreebsd*-gnu | knetbsd*-gnu)
8178 - AC_EGREP_CPP([_GLIBCXX_ok], [
8179 - #include <features.h>
8180 - #if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2)
8183 - ], enable_clocale_flag=gnu, enable_clocale_flag=generic)
8185 - # Test for bugs early in glibc-2.2.x series
8186 - if test $enable_clocale_flag = gnu; then
8188 - #define _GNU_SOURCE 1
8189 - #include <locale.h>
8190 - #include <string.h>
8191 - #if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2)
8192 - extern __typeof(newlocale) __newlocale;
8193 - extern __typeof(duplocale) __duplocale;
8194 - extern __typeof(strcoll_l) __strcoll_l;
8198 - const char __one[] = "Äuglein Augmen";
8199 - const char __two[] = "Äuglein";
8203 - __locale_t loc_dup;
8204 - loc = __newlocale(1 << LC_ALL, "de_DE", 0);
8205 - loc_dup = __duplocale(loc);
8206 - i = __strcoll_l(__one, __two, loc);
8207 - j = __strcoll_l(__one, __two, loc_dup);
8211 - [enable_clocale_flag=gnu],[enable_clocale_flag=generic],
8212 - [enable_clocale_flag=generic])
8215 - # ... at some point put __strxfrm_l tests in as well.
8216 + enable_clocale_flag=gnu
8219 enable_clocale_flag=darwin
8220 @@ -1402,16 +1367,79 @@
8224 - # Deal with gettext issues. Default to not using it (=no) until we detect
8225 - # support for it later. Let the user turn it off via --e/d, but let that
8226 - # default to on for easier handling.
8228 - AC_ARG_ENABLE(nls,
8229 - AC_HELP_STRING([--enable-nls],[use Native Language Support (default)]),
8232 + # Sanity check model, and test for special functionality.
8233 + if test $enable_clocale_flag = gnu; then
8234 + AC_EGREP_CPP([_GLIBCXX_ok], [
8235 + #include <features.h>
8236 + #if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2)
8239 + ], enable_clocale_flag=gnu, enable_clocale_flag=generic)
8241 + # Test for bugs early in glibc-2.2.x series
8243 + #define _GNU_SOURCE 1
8244 + #include <locale.h>
8245 + #include <string.h>
8246 + #if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2)
8247 + extern __typeof(newlocale) __newlocale;
8248 + extern __typeof(duplocale) __duplocale;
8249 + extern __typeof(strcoll_l) __strcoll_l;
8253 + const char __one[] = "Äuglein Augmen";
8254 + const char __two[] = "Äuglein";
8258 + __locale_t loc_dup;
8259 + loc = __newlocale(1 << LC_ALL, "de_DE", 0);
8260 + loc_dup = __duplocale(loc);
8261 + i = __strcoll_l(__one, __two, loc);
8262 + j = __strcoll_l(__one, __two, loc_dup);
8266 + [enable_clocale_flag=gnu],[enable_clocale_flag=generic],
8267 + [enable_clocale_flag=generic])
8269 + # Set it to scream when it hurts.
8270 + ac_save_CFLAGS="$CFLAGS"
8271 + CFLAGS="-Wimplicit-function-declaration -Werror"
8273 + # Use strxfrm_l if available.
8274 + AC_TRY_COMPILE([#define _GNU_SOURCE 1
8275 + #include <string.h>
8276 + #include <locale.h>],
8277 + [char s[128]; __locale_t loc; strxfrm_l(s, "C", 5, loc);],
8278 + AC_DEFINE(HAVE_STRXFRM_L, 1,
8279 + [Define if strxfrm_l is available in <string.h>.]),)
8281 + # Use strerror_l if available.
8282 + AC_TRY_COMPILE([#define _GNU_SOURCE 1
8283 + #include <string.h>
8284 + #include <locale.h>],
8285 + [__locale_t loc; strerror_l(5, loc);],
8286 + AC_DEFINE(HAVE_STRERROR_L, 1,
8287 + [Define if strerror_l is available in <string.h>.]),)
8289 + CFLAGS="$ac_save_CFLAGS"
8292 + # Perhaps use strerror_r if available, and strerror_l isn't.
8293 + ac_save_CFLAGS="$CFLAGS"
8294 + CFLAGS="-Wimplicit-function-declaration -Werror"
8295 + AC_TRY_COMPILE([#define _GNU_SOURCE 1
8296 + #include <string.h>
8297 + #include <locale.h>],
8298 + [char s[128]; strerror_r(5, s, 128);],
8299 + AC_DEFINE(HAVE_STRERROR_R, 1,
8300 + [Define if strerror_r is available in <string.h>.]),)
8301 + CFLAGS="$ac_save_CFLAGS"
8303 # Set configure bits for specified locale package
8304 + AC_MSG_CHECKING([for C locale to use])
8305 case ${enable_clocale_flag} in
8307 AC_MSG_RESULT(generic)
8308 Index: libgfortran/runtime/environ.c
8309 ===================================================================
8310 --- libgfortran/runtime/environ.c (.../tags/gcc_4_2_0_release) (revision 125292)
8311 +++ libgfortran/runtime/environ.c (.../branches/gcc-4_2-branch) (revision 125292)
8312 @@ -861,14 +861,13 @@
8327 /* Parse the string. First, let's look for a default. */
8336 @@ -939,6 +939,18 @@
8337 tok = next_token ();
8341 + if (next_token () != ':')
8343 + endian = CONVERT_NATIVE;
8347 + if (next_token () != ':')
8349 + endian = CONVERT_SWAP;
8353 if (next_token () != ':')
8355 Index: libgfortran/intrinsics/reshape_generic.c
8356 ===================================================================
8357 --- libgfortran/intrinsics/reshape_generic.c (.../tags/gcc_4_2_0_release) (revision 125292)
8358 +++ libgfortran/intrinsics/reshape_generic.c (.../branches/gcc-4_2-branch) (revision 125292)
8363 - sptr += sstride[n] * size;
8364 + src += sstride[n] * size;
8368 Index: libgfortran/intrinsics/ishftc.c
8369 ===================================================================
8370 --- libgfortran/intrinsics/ishftc.c (.../tags/gcc_4_2_0_release) (revision 125292)
8371 +++ libgfortran/intrinsics/ishftc.c (.../branches/gcc-4_2-branch) (revision 125292)
8374 ishftc4 (GFC_INTEGER_4 i, GFC_INTEGER_4 shift, GFC_INTEGER_4 size)
8376 - GFC_INTEGER_4 mask;
8377 - GFC_UINTEGER_4 bits;
8378 + GFC_UINTEGER_4 mask, bits;
8381 shift = shift + size;
8383 if (shift == 0 || shift == size)
8386 - mask = (~(GFC_INTEGER_4)0) << size;
8388 - return (i & mask) | (bits >> (size - shift)) | ((i << shift) & ~mask);
8389 + /* In C, the result of the shift operator is undefined if the right operand
8390 + is greater than or equal to the number of bits in the left operand. So we
8391 + have to special case it for fortran. */
8392 + mask = ~((size == 32) ? 0 : (~0 << size));
8396 + return (i & ~mask) | ((bits << shift) & mask) | (bits >> (size - shift));
8399 extern GFC_INTEGER_8 ishftc8 (GFC_INTEGER_8, GFC_INTEGER_4, GFC_INTEGER_4);
8402 ishftc8 (GFC_INTEGER_8 i, GFC_INTEGER_4 shift, GFC_INTEGER_4 size)
8404 - GFC_INTEGER_8 mask;
8405 - GFC_UINTEGER_8 bits;
8406 + GFC_UINTEGER_8 mask, bits;
8409 shift = shift + size;
8411 if (shift == 0 || shift == size)
8414 - mask = (~(GFC_INTEGER_8)0) << size;
8416 - return (i & mask) | (bits >> (size - shift)) | ((i << shift) & ~mask);
8417 + /* In C, the result of the shift operator is undefined if the right operand
8418 + is greater than or equal to the number of bits in the left operand. So we
8419 + have to special case it for fortran. */
8420 + mask = ~((size == 64) ? 0 : (~0 << size));
8424 + return (i & ~mask) | ((bits << shift) & mask) | (bits >> (size - shift));
8427 #ifdef HAVE_GFC_INTEGER_16
8430 ishftc16 (GFC_INTEGER_16 i, GFC_INTEGER_4 shift, GFC_INTEGER_4 size)
8432 - GFC_INTEGER_16 mask;
8433 - GFC_UINTEGER_16 bits;
8434 + GFC_UINTEGER_16 mask, bits;
8437 shift = shift + size;
8439 if (shift == 0 || shift == size)
8442 - mask = (~(GFC_INTEGER_16)0) << size;
8444 - return (i & mask) | (bits >> (size - shift)) | ((i << shift) & ~mask);
8445 + /* In C, the result of the shift operator is undefined if the right operand
8446 + is greater than or equal to the number of bits in the left operand. So we
8447 + have to special case it for fortran. */
8448 + mask = ~((size == 128) ? 0 : (~0 << size));
8452 + return (i & ~mask) | ((bits << shift) & mask) | (bits >> (size - shift));
8455 Index: libgfortran/ChangeLog
8456 ===================================================================
8457 --- libgfortran/ChangeLog (.../tags/gcc_4_2_0_release) (revision 125292)
8458 +++ libgfortran/ChangeLog (.../branches/gcc-4_2-branch) (revision 125292)
8460 +2007-05-23 Jerry DeLisle <jvdelisle@gcc.gnu.org>
8462 + PR libfortran/31964
8463 + Backport from trunk.
8464 + * intrinsics/ishftc.c (ishftc4, ishftc8, ishftc16): Fix mask to handle
8465 + shift of bit-size number of bits.
8467 +2007-05-23 Tobias Burnus <burnus@net-b.de>
8470 + Backport from trunk.
8471 + * runtime/environ.c (mark_range): Fix setting default convert unit.
8473 +2007-05-22 Jerry DeLisle <jvdelisle@gcc.gnu.org>
8475 + PR libfortran/31051
8476 + Backport from trunk.
8477 + * io/transfer.c (formatted_transfer_scalar): Adjust position for pending
8478 + spaces when in writing mode. Clean up some formatting.
8480 +2007-05-22 Tobias Burnus <burnus@net-b.de>
8482 + PR libfortran/31915
8483 + Backport from trunk.
8484 + * io/transfer.c (unformatted_read): Use proper size for real(10).
8485 + (unformatted_write): Ditto.
8487 +2007-05-20 Jerry DeLisle <jvdelisle@gcc.gnu.org>
8489 + PR libfortran/31395
8490 + Backport from 4.3.
8491 + * io/format.c (parse_format_list): Fix parsing. Regression against g77.
8493 +2007-05-20 Thomas Koenig <tkoenig@gcc.gnu.org>
8496 + Backport from trunk.
8497 + * io/transfer.c (read_block_direct): Instead of calling us_read,
8498 + set dtp->u.p.current_unit->current_record = 0 so that pre_position
8499 + will read the record marker.
8500 + (data_transfer_init): For different error conditions, call
8501 + generate_error, then return.
8503 +2007-05-20 Thomas Koenig <tkoenig@gcc.gnu.org>
8505 + PR libfortran/31196
8506 + Backport from trunk.
8507 + * intrinsics/reshape_generic.c (reshape_internal): Increment
8510 2007-05-13 Release Manager
8512 * GCC 4.2.0 released.
8513 Index: libgfortran/io/transfer.c
8514 ===================================================================
8515 --- libgfortran/io/transfer.c (.../tags/gcc_4_2_0_release) (revision 125292)
8516 +++ libgfortran/io/transfer.c (.../branches/gcc-4_2-branch) (revision 125292)
8517 @@ -493,11 +493,11 @@
8521 - /* Let's make sure the file position is correctly set for the
8522 - next read statement. */
8523 + /* Let's make sure the file position is correctly pre-positioned
8524 + for the next read statement. */
8526 + dtp->u.p.current_unit->current_record = 0;
8527 next_record_r_unf (dtp, 0);
8529 generate_error (&dtp->common, ERROR_SHORT_RECORD, NULL);
8532 @@ -722,7 +722,11 @@
8533 of the padding. If we hit a short record, then sz is
8534 adjusted accordingly, making later reads no-ops. */
8537 + if (type == BT_REAL || type == BT_COMPLEX)
8538 + sz = size_from_real_kind (kind);
8542 for (i=0; i<nelems; i++)
8544 read_block_direct (dtp, buffer, &sz);
8545 @@ -767,7 +771,11 @@
8546 read kind bytes. We don't care about the contents
8550 + if (type == BT_REAL || type == BT_COMPLEX)
8551 + sz = size_from_real_kind (kind);
8555 for (i=0; i<nelems; i++)
8557 reverse_memcpy(buffer, p, size);
8558 @@ -1144,7 +1152,7 @@
8559 /* Format codes that don't transfer data. */
8562 - consume_data_flag = 0 ;
8563 + consume_data_flag = 0;
8565 pos = bytes_used + f->u.n + dtp->u.p.skips;
8566 dtp->u.p.skips = f->u.n + dtp->u.p.skips;
8567 @@ -1160,6 +1168,7 @@
8568 write_x (dtp, dtp->u.p.skips, dtp->u.p.pending_spaces);
8569 dtp->u.p.skips = dtp->u.p.pending_spaces = 0;
8572 if (dtp->u.p.mode == READING)
8573 read_x (dtp, f->u.n);
8575 @@ -1167,6 +1176,8 @@
8579 + consume_data_flag = 0;
8581 if (f->format == FMT_TL)
8584 @@ -1185,8 +1196,10 @@
8588 - consume_data_flag = 0;
8590 + if (dtp->u.p.mode == READING)
8593 + pos = f->u.n - dtp->u.p.pending_spaces - 1;
8596 /* Standard 10.6.1.1: excessive left tabbing is reset to the
8597 @@ -1753,16 +1766,19 @@
8598 /* Check the action. */
8600 if (read_flag && dtp->u.p.current_unit->flags.action == ACTION_WRITE)
8601 - generate_error (&dtp->common, ERROR_BAD_ACTION,
8602 - "Cannot read from file opened for WRITE");
8604 + generate_error (&dtp->common, ERROR_BAD_ACTION,
8605 + "Cannot read from file opened for WRITE");
8609 if (!read_flag && dtp->u.p.current_unit->flags.action == ACTION_READ)
8610 - generate_error (&dtp->common, ERROR_BAD_ACTION,
8611 - "Cannot write to file opened for READ");
8613 + generate_error (&dtp->common, ERROR_BAD_ACTION,
8614 + "Cannot write to file opened for READ");
8618 - if ((dtp->common.flags & IOPARM_LIBRETURN_MASK) != IOPARM_LIBRETURN_OK)
8621 dtp->u.p.first_item = 1;
8623 /* Check the format. */
8624 @@ -1770,14 +1786,14 @@
8625 if ((cf & IOPARM_DT_HAS_FORMAT) != 0)
8628 - if ((dtp->common.flags & IOPARM_LIBRETURN_MASK) != IOPARM_LIBRETURN_OK)
8631 if (dtp->u.p.current_unit->flags.form == FORM_UNFORMATTED
8632 && (cf & (IOPARM_DT_HAS_FORMAT | IOPARM_DT_LIST_FORMAT))
8634 - generate_error (&dtp->common, ERROR_OPTION_CONFLICT,
8635 - "Format present for UNFORMATTED data transfer");
8637 + generate_error (&dtp->common, ERROR_OPTION_CONFLICT,
8638 + "Format present for UNFORMATTED data transfer");
8642 if ((cf & IOPARM_DT_HAS_NAMELIST_NAME) != 0 && dtp->u.p.ionml != NULL)
8644 @@ -1787,13 +1803,19 @@
8646 else if (dtp->u.p.current_unit->flags.form == FORM_FORMATTED &&
8647 !(cf & (IOPARM_DT_HAS_FORMAT | IOPARM_DT_LIST_FORMAT)))
8648 - generate_error (&dtp->common, ERROR_OPTION_CONFLICT,
8649 - "Missing format for FORMATTED data transfer");
8651 + generate_error (&dtp->common, ERROR_OPTION_CONFLICT,
8652 + "Missing format for FORMATTED data transfer");
8655 if (is_internal_unit (dtp)
8656 && dtp->u.p.current_unit->flags.form == FORM_UNFORMATTED)
8657 - generate_error (&dtp->common, ERROR_OPTION_CONFLICT,
8658 - "Internal file cannot be accessed by UNFORMATTED data transfer");
8660 + generate_error (&dtp->common, ERROR_OPTION_CONFLICT,
8661 + "Internal file cannot be accessed by UNFORMATTED "
8666 /* Check the record or position number. */
8668 @@ -1823,49 +1845,71 @@
8669 if (dtp->u.p.advance_status != ADVANCE_UNSPECIFIED)
8671 if (dtp->u.p.current_unit->flags.access == ACCESS_DIRECT)
8672 - generate_error (&dtp->common, ERROR_OPTION_CONFLICT,
8673 - "ADVANCE specification conflicts with sequential access");
8675 + generate_error (&dtp->common, ERROR_OPTION_CONFLICT,
8676 + "ADVANCE specification conflicts with sequential access");
8680 if (is_internal_unit (dtp))
8681 - generate_error (&dtp->common, ERROR_OPTION_CONFLICT,
8682 - "ADVANCE specification conflicts with internal file");
8684 + generate_error (&dtp->common, ERROR_OPTION_CONFLICT,
8685 + "ADVANCE specification conflicts with internal file");
8689 if ((cf & (IOPARM_DT_HAS_FORMAT | IOPARM_DT_LIST_FORMAT))
8690 != IOPARM_DT_HAS_FORMAT)
8691 - generate_error (&dtp->common, ERROR_OPTION_CONFLICT,
8692 - "ADVANCE specification requires an explicit format");
8694 + generate_error (&dtp->common, ERROR_OPTION_CONFLICT,
8695 + "ADVANCE specification requires an explicit format");
8702 if ((cf & IOPARM_EOR) != 0 && dtp->u.p.advance_status != ADVANCE_NO)
8703 - generate_error (&dtp->common, ERROR_MISSING_OPTION,
8704 - "EOR specification requires an ADVANCE specification of NO");
8706 + generate_error (&dtp->common, ERROR_MISSING_OPTION,
8707 + "EOR specification requires an ADVANCE specification "
8712 if ((cf & IOPARM_DT_HAS_SIZE) != 0 && dtp->u.p.advance_status != ADVANCE_NO)
8713 - generate_error (&dtp->common, ERROR_MISSING_OPTION,
8714 - "SIZE specification requires an ADVANCE specification of NO");
8717 + generate_error (&dtp->common, ERROR_MISSING_OPTION,
8718 + "SIZE specification requires an ADVANCE specification of NO");
8723 { /* Write constraints. */
8724 if ((cf & IOPARM_END) != 0)
8725 - generate_error (&dtp->common, ERROR_OPTION_CONFLICT,
8726 - "END specification cannot appear in a write statement");
8728 + generate_error (&dtp->common, ERROR_OPTION_CONFLICT,
8729 + "END specification cannot appear in a write statement");
8733 if ((cf & IOPARM_EOR) != 0)
8734 - generate_error (&dtp->common, ERROR_OPTION_CONFLICT,
8735 - "EOR specification cannot appear in a write statement");
8737 + generate_error (&dtp->common, ERROR_OPTION_CONFLICT,
8738 + "EOR specification cannot appear in a write statement");
8742 if ((cf & IOPARM_DT_HAS_SIZE) != 0)
8743 - generate_error (&dtp->common, ERROR_OPTION_CONFLICT,
8744 - "SIZE specification cannot appear in a write statement");
8746 + generate_error (&dtp->common, ERROR_OPTION_CONFLICT,
8747 + "SIZE specification cannot appear in a write statement");
8752 if (dtp->u.p.advance_status == ADVANCE_UNSPECIFIED)
8753 dtp->u.p.advance_status = ADVANCE_YES;
8754 - if ((dtp->common.flags & IOPARM_LIBRETURN_MASK) != IOPARM_LIBRETURN_OK)
8757 /* Sanity checks on the record number. */
8758 if ((cf & IOPARM_DT_HAS_REC) != 0)
8759 Index: libgfortran/io/format.c
8760 ===================================================================
8761 --- libgfortran/io/format.c (.../tags/gcc_4_2_0_release) (revision 125292)
8762 +++ libgfortran/io/format.c (.../branches/gcc-4_2-branch) (revision 125292)
8763 @@ -860,10 +860,11 @@
8765 get_fnode (fmt, &head, &tail, FMT_SLASH);
8767 + goto optional_comma;
8769 - /* Fall Through */
8772 + get_fnode (fmt, &head, &tail, FMT_COLON);
8774 goto optional_comma;
8777 Index: boehm-gc/darwin_stop_world.c
8778 ===================================================================
8779 --- boehm-gc/darwin_stop_world.c (.../tags/gcc_4_2_0_release) (revision 125292)
8780 +++ boehm-gc/darwin_stop_world.c (.../branches/gcc-4_2-branch) (revision 125292)
8782 be allocated, is called the red zone. This area as shown in Figure 3-2 may
8783 be used for any purpose as long as a new stack frame does not need to be
8784 added to the stack."
8787 Page 50: "If a leaf procedure's red zone usage would exceed 224 bytes, then
8788 it must set up a stack frame just like routines that call other routines."
8791 # define PPC_RED_ZONE_SIZE 320
8794 -/* Try to work out the right way to access thread state structure members.
8795 - The structure has changed its definition in different Darwin versions. */
8796 -#if defined(__ppc__)
8797 -# define THREAD_STATE ppc_thread_state_t
8798 -# if defined (HAS_PPC_THREAD_STATE_R0)
8799 -# define THREAD_FLD(x) x
8800 -# elif defined (HAS_PPC_THREAD_STATE___R0)
8801 -# define THREAD_FLD(x) __ ## x
8803 -# error can not work out how to access fields of ppc_thread_state_t
8805 -#elif defined(__ppc64__)
8806 -# define THREAD_STATE ppc_thread_state64_t
8807 -# if defined (HAS_PPC_THREAD_STATE64_R0)
8808 -# define THREAD_FLD(x) x
8809 -# elif defined (HAS_PPC_THREAD_STATE64___R0)
8810 -# define THREAD_FLD(x) __ ## x
8812 -# error can not work out how to access fields of ppc_thread_state64_t
8814 -#elif defined(__i386__)
8815 -# define THREAD_STATE i386_thread_state_t
8816 -# if defined (HAS_I386_THREAD_STATE_EAX)
8817 -# define THREAD_FLD(x) x
8818 -# elif defined (HAS_I386_THREAD_STATE___EAX)
8819 -# define THREAD_FLD(x) __ ## x
8821 -# error can not work out how to access fields of i386_thread_state_t
8823 -#elif defined(__x86_64__)
8824 -# define THREAD_STATE i386_thread_state_t
8825 -# if defined (HAS_I386_THREAD_STATE_EAX)
8826 -# define THREAD_FLD(x) x
8827 -# elif defined (HAS_I386_THREAD_STATE___EAX)
8828 -# define THREAD_FLD(x) __ ## x
8830 -# error can not work out how to access fields of i386_thread_state_t
8833 -# error unknown architecture
8836 typedef struct StackFrame {
8837 unsigned long savedSP;
8838 unsigned long savedCR;
8843 - THREAD_STATE state;
8844 - mach_msg_type_number_t thread_state_count = MACHINE_THREAD_STATE_COUNT;
8845 + GC_THREAD_STATE_T state;
8846 + mach_msg_type_number_t thread_state_count = GC_MACH_THREAD_STATE_COUNT;
8848 me = pthread_self();
8849 if (!GC_thr_initialized) GC_thr_init();
8851 lo = GC_approx_sp();
8853 /* Get the thread state (registers, etc) */
8854 - r = thread_get_state(
8855 - p->stop_info.mach_thread,
8856 - MACHINE_THREAD_STATE,
8857 - (natural_t*)&state,
8858 - &thread_state_count);
8859 + r = thread_get_state(p->stop_info.mach_thread, GC_MACH_THREAD_STATE,
8860 + (natural_t*)&state, &thread_state_count);
8861 if(r != KERN_SUCCESS) ABORT("thread_get_state failed");
8865 GC_push_one(state . THREAD_FLD (edx));
8866 GC_push_one(state . THREAD_FLD (edi));
8867 GC_push_one(state . THREAD_FLD (esi));
8868 - GC_push_one(state . THREAD_FLD (ebp));
8869 + GC_push_one(state . THREAD_FLD (ebp));
8871 +#elif defined(X86_64)
8872 + lo = (void*)state . THREAD_FLD (rsp);
8874 + GC_push_one(state . THREAD_FLD (rax));
8875 + GC_push_one(state . THREAD_FLD (rbx));
8876 + GC_push_one(state . THREAD_FLD (rcx));
8877 + GC_push_one(state . THREAD_FLD (rdx));
8878 + GC_push_one(state . THREAD_FLD (rdi));
8879 + GC_push_one(state . THREAD_FLD (rsi));
8880 + GC_push_one(state . THREAD_FLD (rbp));
8881 + GC_push_one(state . THREAD_FLD (rsp));
8882 + GC_push_one(state . THREAD_FLD (r8));
8883 + GC_push_one(state . THREAD_FLD (r9));
8884 + GC_push_one(state . THREAD_FLD (r10));
8885 + GC_push_one(state . THREAD_FLD (r11));
8886 + GC_push_one(state . THREAD_FLD (r12));
8887 + GC_push_one(state . THREAD_FLD (r13));
8888 + GC_push_one(state . THREAD_FLD (r14));
8889 + GC_push_one(state . THREAD_FLD (r15));
8890 + GC_push_one(state . THREAD_FLD (rip));
8891 + GC_push_one(state . THREAD_FLD (rflags));
8892 + GC_push_one(state . THREAD_FLD (cs));
8893 + GC_push_one(state . THREAD_FLD (fs));
8894 + GC_push_one(state . THREAD_FLD (gs));
8896 #elif defined(POWERPC)
8897 lo = (void*)(state . THREAD_FLD (r1) - PPC_RED_ZONE_SIZE);
8900 hi = (ptr_t)FindTopOfStack(0);
8902 # if defined(__ppc__) || defined(__ppc64__)
8903 - THREAD_STATE info;
8904 + GC_THREAD_STATE_T info;
8905 mach_msg_type_number_t outCount = THREAD_STATE_MAX;
8906 - r = thread_get_state(thread, MACHINE_THREAD_STATE,
8907 + r = thread_get_state(thread, GC_MACH_THREAD_STATE,
8908 (natural_t *)&info, &outCount);
8909 if(r != KERN_SUCCESS) ABORT("task_get_state failed");
8911 @@ -264,10 +245,10 @@
8913 /* FIXME: Remove after testing: */
8914 WARN("This is completely untested and likely will not work\n", 0);
8915 - THREAD_STATE info;
8916 + GC_THREAD_STATE_T info;
8917 mach_msg_type_number_t outCount = THREAD_STATE_MAX;
8918 - r = thread_get_state(thread, MACHINE_THREAD_STATE,
8919 - (natural_t *)&info, &outCount);
8920 + r = thread_get_state(thread, GC_MACH_THREAD_STATE, (natural_t *)&info,
8922 if(r != KERN_SUCCESS) ABORT("task_get_state failed");
8924 lo = (void*)info . THREAD_FLD (esp);
8925 Index: boehm-gc/Makefile.in
8926 ===================================================================
8927 --- boehm-gc/Makefile.in (.../tags/gcc_4_2_0_release) (revision 125292)
8928 +++ boehm-gc/Makefile.in (.../branches/gcc-4_2-branch) (revision 125292)
8930 build_vendor = @build_vendor@
8932 exec_prefix = @exec_prefix@
8933 +extra_ldflags_libgc = @extra_ldflags_libgc@
8935 host_alias = @host_alias@
8936 host_cpu = @host_cpu@
8938 # linuxthread semaphore functions get linked:
8939 libgcjgc_la_LIBADD = @addobjs@ $(THREADLIBS) $(UNWINDLIBS)
8940 libgcjgc_la_DEPENDENCIES = @addobjs@
8941 -libgcjgc_la_LDFLAGS = -version-info 1:2:0 -rpath $(toolexeclibdir)
8942 +libgcjgc_la_LDFLAGS = $(extra_ldflags_libgc) -version-info 1:2:0 -rpath $(toolexeclibdir)
8943 libgcjgc_convenience_la_LIBADD = @addobjs@
8944 libgcjgc_convenience_la_DEPENDENCIES = @addobjs@
8945 AM_CXXFLAGS = @GC_CFLAGS@
8946 Index: boehm-gc/configure.ac
8947 ===================================================================
8948 --- boehm-gc/configure.ac (.../tags/gcc_4_2_0_release) (revision 125292)
8949 +++ boehm-gc/configure.ac (.../branches/gcc-4_2-branch) (revision 125292)
8950 @@ -248,33 +248,46 @@
8953 AC_CHECK_MEMBER(ppc_thread_state_t.r0,
8954 - AC_DEFINE(HAS_PPC_THREAD_STATE_R0,,[ppc_thread_state_t has field r0]),,
8955 + AC_DEFINE(HAS_PPC_THREAD_STATE_R0,1,
8956 + [ppc_thread_state_t has field r0]),,
8957 [#include <mach/thread_status.h>])
8958 AC_CHECK_MEMBER(ppc_thread_state_t.__r0,
8959 - AC_DEFINE(HAS_PPC_THREAD_STATE___R0,,dnl
8960 - [ppc_thread_state_t has field __r0]),,
8961 + AC_DEFINE(HAS_PPC_THREAD_STATE___R0,1,dnl
8962 + [ppc_thread_state_t has field __r0]),,
8963 [#include <mach/thread_status.h>])
8964 AC_CHECK_MEMBER(ppc_thread_state64_t.r0,
8965 - AC_DEFINE(HAS_PPC_THREAD_STATE64_R0,,dnl
8966 - [ppc_thread_state64_t has field r0]),,
8967 + AC_DEFINE(HAS_PPC_THREAD_STATE64_R0,1,dnl
8968 + [ppc_thread_state64_t has field r0]),,
8969 [#include <mach/thread_status.h>])
8970 AC_CHECK_MEMBER(ppc_thread_state64_t.__r0,
8971 - AC_DEFINE(HAS_PPC_THREAD_STATE64___R0,,dnl
8972 - [ppc_thread_state64_t has field __r0]),,
8973 + AC_DEFINE(HAS_PPC_THREAD_STATE64___R0,1,dnl
8974 + [ppc_thread_state64_t has field __r0]),,
8975 [#include <mach/thread_status.h>])
8978 - AC_CHECK_MEMBER(i386_thread_state_t.eax,
8979 - AC_DEFINE(HAS_I386_THREAD_STATE_EAX,,dnl
8980 - [i386_thread_state_t has field eax]),,
8981 + AC_CHECK_MEMBER(x86_thread_state32_t.eax,
8982 + AC_DEFINE(HAS_X86_THREAD_STATE32_EAX,1,dnl
8983 + [x86_thread_state32_t has field eax]),,
8984 [#include <sys/cdefs.h>
8985 -#include <mach/thread_status.h>])
8986 - AC_CHECK_MEMBER(i386_thread_state_t.__eax,
8987 - AC_DEFINE(HAS_I386_THREAD_STATE___EAX,,dnl
8988 - [i386_thread_state_t has field __eax]),,
8989 + #include <mach/thread_status.h>])
8990 + AC_CHECK_MEMBER(x86_thread_state32_t.__eax,
8991 + AC_DEFINE(HAS_X86_THREAD_STATE32___EAX,1,dnl
8992 + [x86_thread_state32_t has field __eax]),,
8993 [#include <sys/cdefs.h>
8994 -#include <mach/thread_status.h>])
8995 + #include <mach/thread_status.h>])
8998 + AC_CHECK_MEMBER(x86_thread_state64_t.rax,
8999 + AC_DEFINE(HAS_X86_THREAD_STATE64_RAX,1,dnl
9000 + [x86_thread_state64_t has field rax]),,
9001 + [#include <sys/cdefs.h>
9002 + #include <mach/thread_status.h>])
9003 + AC_CHECK_MEMBER(x86_thread_state64_t.__rax,
9004 + AC_DEFINE(HAS_X86_THREAD_STATE64___RAX,1,dnl
9005 + [x86_thread_state64_t has field __rax]),,
9006 + [#include <sys/cdefs.h>
9007 + #include <mach/thread_status.h>])
9012 @@ -287,6 +300,14 @@
9016 +# extra LD Flags which are required for targets
9019 + extra_ldflags_libgc=-Wl,-single_module
9022 +AC_SUBST(extra_ldflags_libgc)
9024 AC_SUBST(EXTRA_TEST_LIBS)
9026 target_all=libgcjgc.la
9027 Index: boehm-gc/include/Makefile.in
9028 ===================================================================
9029 --- boehm-gc/include/Makefile.in (.../tags/gcc_4_2_0_release) (revision 125292)
9030 +++ boehm-gc/include/Makefile.in (.../branches/gcc-4_2-branch) (revision 125292)
9032 build_vendor = @build_vendor@
9034 exec_prefix = @exec_prefix@
9035 +extra_ldflags_libgc = @extra_ldflags_libgc@
9037 host_alias = @host_alias@
9038 host_cpu = @host_cpu@
9039 Index: boehm-gc/include/gc_config.h.in
9040 ===================================================================
9041 --- boehm-gc/include/gc_config.h.in (.../tags/gcc_4_2_0_release) (revision 125292)
9042 +++ boehm-gc/include/gc_config.h.in (.../branches/gcc-4_2-branch) (revision 125292)
9044 /* support for win32 threads */
9045 #undef GC_WIN32_THREADS
9047 -/* i386_thread_state_t has field eax */
9048 -#undef HAS_I386_THREAD_STATE_EAX
9050 -/* i386_thread_state_t has field __eax */
9051 -#undef HAS_I386_THREAD_STATE___EAX
9053 /* ppc_thread_state64_t has field r0 */
9054 #undef HAS_PPC_THREAD_STATE64_R0
9057 /* ppc_thread_state_t has field __r0 */
9058 #undef HAS_PPC_THREAD_STATE___R0
9060 +/* x86_thread_state32_t has field eax */
9061 +#undef HAS_X86_THREAD_STATE32_EAX
9063 +/* x86_thread_state32_t has field __eax */
9064 +#undef HAS_X86_THREAD_STATE32___EAX
9066 +/* x86_thread_state64_t has field rax */
9067 +#undef HAS_X86_THREAD_STATE64_RAX
9069 +/* x86_thread_state64_t has field __rax */
9070 +#undef HAS_X86_THREAD_STATE64___RAX
9072 /* Define to 1 if you have the <inttypes.h> header file. */
9073 #undef HAVE_INTTYPES_H
9075 Index: boehm-gc/include/private/gc_priv.h
9076 ===================================================================
9077 --- boehm-gc/include/private/gc_priv.h (.../tags/gcc_4_2_0_release) (revision 125292)
9078 +++ boehm-gc/include/private/gc_priv.h (.../branches/gcc-4_2-branch) (revision 125292)
9079 @@ -286,6 +286,53 @@
9083 +#if defined(DARWIN)
9084 +# if defined(POWERPC)
9085 +# if CPP_WORDSZ == 32
9086 +# define GC_THREAD_STATE_T ppc_thread_state_t
9087 +# define GC_MACH_THREAD_STATE PPC_THREAD_STATE
9088 +# define GC_MACH_THREAD_STATE_COUNT PPC_THREAD_STATE_COUNT
9089 +# define GC_MACH_HEADER mach_header
9090 +# define GC_MACH_SECTION section
9092 +# define GC_THREAD_STATE_T ppc_thread_state64_t
9093 +# define GC_MACH_THREAD_STATE PPC_THREAD_STATE64
9094 +# define GC_MACH_THREAD_STATE_COUNT PPC_THREAD_STATE64_COUNT
9095 +# define GC_MACH_HEADER mach_header_64
9096 +# define GC_MACH_SECTION section_64
9098 +# elif defined(I386) || defined(X86_64)
9099 +# if CPP_WORDSZ == 32
9100 +# define GC_THREAD_STATE_T x86_thread_state32_t
9101 +# define GC_MACH_THREAD_STATE x86_THREAD_STATE32
9102 +# define GC_MACH_THREAD_STATE_COUNT x86_THREAD_STATE32_COUNT
9103 +# define GC_MACH_HEADER mach_header
9104 +# define GC_MACH_SECTION section
9106 +# define GC_THREAD_STATE_T x86_thread_state64_t
9107 +# define GC_MACH_THREAD_STATE x86_THREAD_STATE64
9108 +# define GC_MACH_THREAD_STATE_COUNT x86_THREAD_STATE64_COUNT
9109 +# define GC_MACH_HEADER mach_header_64
9110 +# define GC_MACH_SECTION section_64
9113 +# error define GC_THREAD_STATE_T
9114 +# define GC_MACH_THREAD_STATE MACHINE_THREAD_STATE
9115 +# define GC_MACH_THREAD_STATE_COUNT MACHINE_THREAD_STATE_COUNT
9117 +/* Try to work out the right way to access thread state structure members.
9118 + The structure has changed its definition in different Darwin versions.
9119 + This now defaults to the (older) names without __, thus hopefully,
9120 + not breaking any existing Makefile.direct builds. */
9121 +# if defined (HAS_PPC_THREAD_STATE___R0) \
9122 + || defined (HAS_PPC_THREAD_STATE64___R0) \
9123 + || defined (HAS_X86_THREAD_STATE32___EAX) \
9124 + || defined (HAS_X86_THREAD_STATE64___RAX)
9125 +# define THREAD_FLD(x) __ ## x
9127 +# define THREAD_FLD(x) x
9130 /*********************************/
9132 /* OS interface routines */
9133 @@ -468,6 +515,53 @@
9134 # define GETENV(name) 0
9137 +#if defined(DARWIN)
9138 +# if defined(POWERPC)
9139 +# if CPP_WORDSZ == 32
9140 +# define GC_THREAD_STATE_T ppc_thread_state_t
9141 +# define GC_MACH_THREAD_STATE PPC_THREAD_STATE
9142 +# define GC_MACH_THREAD_STATE_COUNT PPC_THREAD_STATE_COUNT
9143 +# define GC_MACH_HEADER mach_header
9144 +# define GC_MACH_SECTION section
9146 +# define GC_THREAD_STATE_T ppc_thread_state64_t
9147 +# define GC_MACH_THREAD_STATE PPC_THREAD_STATE64
9148 +# define GC_MACH_THREAD_STATE_COUNT PPC_THREAD_STATE64_COUNT
9149 +# define GC_MACH_HEADER mach_header_64
9150 +# define GC_MACH_SECTION section_64
9152 +# elif defined(I386) || defined(X86_64)
9153 +# if CPP_WORDSZ == 32
9154 +# define GC_THREAD_STATE_T x86_thread_state32_t
9155 +# define GC_MACH_THREAD_STATE x86_THREAD_STATE32
9156 +# define GC_MACH_THREAD_STATE_COUNT x86_THREAD_STATE32_COUNT
9157 +# define GC_MACH_HEADER mach_header
9158 +# define GC_MACH_SECTION section
9160 +# define GC_THREAD_STATE_T x86_thread_state64_t
9161 +# define GC_MACH_THREAD_STATE x86_THREAD_STATE64
9162 +# define GC_MACH_THREAD_STATE_COUNT x86_THREAD_STATE64_COUNT
9163 +# define GC_MACH_HEADER mach_header_64
9164 +# define GC_MACH_SECTION section_64
9167 +# error define GC_THREAD_STATE_T
9168 +# define GC_MACH_THREAD_STATE MACHINE_THREAD_STATE
9169 +# define GC_MACH_THREAD_STATE_COUNT MACHINE_THREAD_STATE_COUNT
9171 +/* Try to work out the right way to access thread state structure members.
9172 + The structure has changed its definition in different Darwin versions.
9173 + This now defaults to the (older) names without __, thus hopefully,
9174 + not breaking any existing Makefile.direct builds. */
9175 +# if defined (HAS_PPC_THREAD_STATE___R0) \
9176 + || defined (HAS_PPC_THREAD_STATE64___R0) \
9177 + || defined (HAS_X86_THREAD_STATE32___EAX) \
9178 + || defined (HAS_X86_THREAD_STATE64___RAX)
9179 +# define THREAD_FLD(x) __ ## x
9181 +# define THREAD_FLD(x) x
9184 /*********************************/
9186 /* Word-size-dependent defines */
9187 Index: boehm-gc/include/private/gcconfig.h
9188 ===================================================================
9189 --- boehm-gc/include/private/gcconfig.h (.../tags/gcc_4_2_0_release) (revision 125292)
9190 +++ boehm-gc/include/private/gcconfig.h (.../branches/gcc-4_2-branch) (revision 125292)
9191 @@ -302,7 +302,10 @@
9192 # if defined(__ppc__) || defined(__ppc64__)
9194 # define mach_type_known
9195 -# elif defined(__i386__) || defined(__x86_64)
9196 +# elif defined(__x86_64__)
9198 +# define mach_type_known
9199 +# elif defined(__i386__)
9201 # define mach_type_known
9203 @@ -791,26 +794,29 @@
9204 # define DATAEND (_end)
9207 -# if defined(__ppc64__) || defined(__x86_64)
9208 +# define OS_TYPE "DARWIN"
9209 +# define DYNAMIC_LOADING
9210 +# if defined(__ppc64__)
9211 # define ALIGNMENT 8
9212 # define CPP_WORDSZ 64
9213 +# define STACKBOTTOM ((ptr_t) 0x7fff5fc00000)
9214 +# define CACHE_LINE_SIZE 64
9216 +# define HBLKSIZE 4096
9219 # define ALIGNMENT 4
9220 +# define STACKBOTTOM ((ptr_t) 0xc0000000)
9222 -# define OS_TYPE "DARWIN"
9223 -# define DYNAMIC_LOADING
9224 /* XXX: see get_end(3), get_etext() and get_end() should not be used.
9225 - These aren't used when dyld support is enabled (it is by default) */
9226 + These aren't used when dyld support is enabled (it is by default) */
9227 # define DATASTART ((ptr_t) get_etext())
9228 # define DATAEND ((ptr_t) get_end())
9229 -# define STACKBOTTOM ((ptr_t) 0xc0000000)
9231 # define USE_MMAP_ANON
9232 # define USE_ASM_PUSH_REGS
9233 - /* This is potentially buggy. It needs more testing. See the comments in
9234 - os_dep.c. It relies on threads to track writes. */
9235 # ifdef GC_DARWIN_THREADS
9236 -/* # define MPROTECT_VDB -- diabled for now. May work for some apps. */
9237 +# define MPROTECT_VDB
9239 # include <unistd.h>
9240 # define GETPAGESIZE() getpagesize()
9242 __asm__ __volatile__ ("dcbtst 0,%0" : : "r" ((const void *) (x)))
9244 /* There seems to be some issues with trylock hanging on darwin. This
9245 - should be looked into some more */
9246 + should be looked into some more */
9247 # define NO_PTHREAD_TRYLOCK
9250 @@ -1317,23 +1323,21 @@
9251 # define DARWIN_DONT_PARSE_STACK
9252 # define DYNAMIC_LOADING
9253 /* XXX: see get_end(3), get_etext() and get_end() should not be used.
9254 - These aren't used when dyld support is enabled (it is by default) */
9255 + These aren't used when dyld support is enabled (it is by default) */
9256 # define DATASTART ((ptr_t) get_etext())
9257 # define DATAEND ((ptr_t) get_end())
9258 # define STACKBOTTOM ((ptr_t) 0xc0000000)
9260 # define USE_MMAP_ANON
9261 # define USE_ASM_PUSH_REGS
9262 - /* This is potentially buggy. It needs more testing. See the comments in
9263 - os_dep.c. It relies on threads to track writes. */
9264 # ifdef GC_DARWIN_THREADS
9265 -/* # define MPROTECT_VDB -- disabled for now. May work for some apps. */
9266 +# define MPROTECT_VDB
9268 # include <unistd.h>
9269 # define GETPAGESIZE() getpagesize()
9270 /* There seems to be some issues with trylock hanging on darwin. This
9271 - should be looked into some more */
9272 -# define NO_PTHREAD_TRYLOCK
9273 + should be looked into some more */
9274 +# define NO_PTHREAD_TRYLOCK
9275 # endif /* DARWIN */
9278 @@ -1986,6 +1990,26 @@
9279 # define PREFETCH_FOR_WRITE(x) __builtin_prefetch((x), 1)
9283 +# define OS_TYPE "DARWIN"
9284 +# define DARWIN_DONT_PARSE_STACK
9285 +# define DYNAMIC_LOADING
9286 + /* XXX: see get_end(3), get_etext() and get_end() should not be used.
9287 + These aren't used when dyld support is enabled (it is by default) */
9288 +# define DATASTART ((ptr_t) get_etext())
9289 +# define DATAEND ((ptr_t) get_end())
9290 +# define STACKBOTTOM ((ptr_t) 0x7fff5fc00000)
9292 +# define USE_MMAP_ANON
9293 +# ifdef GC_DARWIN_THREADS
9294 +# define MPROTECT_VDB
9296 +# include <unistd.h>
9297 +# define GETPAGESIZE() getpagesize()
9298 + /* There seems to be some issues with trylock hanging on darwin. This
9299 + should be looked into some more */
9300 +# define NO_PTHREAD_TRYLOCK
9303 # define OS_TYPE "FREEBSD"
9304 # ifndef GC_FREEBSD_THREADS
9305 Index: boehm-gc/ChangeLog
9306 ===================================================================
9307 --- boehm-gc/ChangeLog (.../tags/gcc_4_2_0_release) (revision 125292)
9308 +++ boehm-gc/ChangeLog (.../branches/gcc-4_2-branch) (revision 125292)
9310 +2007-05-22 Andreas Tobler <a.tobler@schweiz.org>
9312 + * Backport r124870 from main.
9314 + 2007-05-20 Andreas Tobler <a.tobler@schweiz.org>
9316 + * configure.ac: Introduce extra_ldflags_libgc. Use it for Darwin.
9317 + * configure: Regenerate.
9318 + * Makefile.am (libgc_la_LDFLAGS): Use extra_ldflags_libgc.
9319 + * Makefile.in: Regenerate.
9320 + * include/Makefile.in: Regenerate.
9321 + * include/private/gcconfig.h: Enable MPROTECT_VDB for all Darwin
9322 + targets. Remove comments. Prepare ppc64 support for Darwin.
9324 +2007-05-19 Andreas Tobler <a.tobler@schweiz.org>
9326 + * Backport r120684, 120801, 120853, 120874 and 120977 from main.
9328 + 2007-01-19 Andreas Tobler <a.tobler@schweiz.org>
9330 + * os_dep.c (defined(MPROTECT_VDB) && defined(DARWIN)): Moved recently
9331 + added defines to include/private/gc_priv.h
9332 + * darwin_stop_world.c: Removed the above defines.
9333 + (catch_exception_raise): Added THREAD_FLD in exc_state for POWERPC too.
9334 + * include/private/gc_priv.h: Moved definitions from darwin_stop_world.c
9335 + and os_dep.c to here. Fixed THREAD definition fixes for ppc64.
9337 + 2007-01-17 Mike Stump <mrs@apple.com>
9339 + * os_dep.c: Fix i686-apple-darwin9 builds.
9341 + 2007-01-17 Andreas Tobler <a.tobler@schweiz.org>
9343 + * include/gc_config.h.in: Regenerate.
9345 + 2007-01-15 Andreas Tobler <a.tobler@schweiz.org>
9347 + * os_dep.c (defined(MPROTECT_VDB) && defined(DARWIN)): Adjust mail
9349 + (catch_exception_raise): Fix typo in the I386 exc_state.
9351 + 2007-01-11 Andreas Tobler <a.tobler@schweiz.org>
9353 + * configure.ac: Replaced HAS_I386_THREAD_STATE_* with
9354 + HAS_X86_THREAD_STATE32_* and HAS_X86_THREAD_STATE64_* respectively.
9355 + * configure: Regenerated.
9356 + * include/private/gcconfig.h (DARWIN): Added X86_64 define for Darwin.
9357 + Added base definitions for the X86_64 Darwin port.
9358 + * include/private/gc_priv.h: Added definitions for Darwin MACH thread
9359 + operations. Moved existing THREAD_STATE info from darwin_stop_world.c.
9360 + * darwin_stop_world.c: Removed THREAD_STATE info. Added
9361 + HAS_X86_THREAD_STATE64___RAX. And replaced HAS_I386_THREAD_STATE___EAX
9362 + with HAS_X86_THREAD_STATE32___EAX.
9363 + (GC_push_all_stacks): Use GC_MACH_THREAD_STATE_COUNT. Add code for
9365 + * dyn_load.c (GC_dyld_name_for_hdr): Use GC_MACH_HEADER.
9366 + (GC_dyld_image_add): Use GC_MACH_HEADER and GC_MACH_SECTION.
9367 + Distinguish between getsectbynamefromheader_64 and
9368 + getsectbynamefromheader.
9369 + (GC_dyld_image_remove): Likewise.
9370 + * os_dep.c (GC_dirty_init): Use GC_MACH_THREAD_STATE.
9371 + (catch_exception_raise): Introduce exception information for I386 and
9372 + X86_64 Darwin. Add X86_64 for exc_state.faultvaddr.
9374 2007-05-13 Release Manager
9376 * GCC 4.2.0 released.
9377 Index: boehm-gc/configure
9378 ===================================================================
9379 --- boehm-gc/configure (.../tags/gcc_4_2_0_release) (revision 125292)
9380 +++ boehm-gc/configure (.../branches/gcc-4_2-branch) (revision 125292)
9382 # include <unistd.h>
9385 -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'
9386 +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'
9389 # Initialize some variables set by options.
9390 @@ -5741,7 +5741,7 @@
9391 if test $ac_cv_member_ppc_thread_state_t_r0 = yes; then
9393 cat >>confdefs.h <<\_ACEOF
9394 -#define HAS_PPC_THREAD_STATE_R0
9395 +#define HAS_PPC_THREAD_STATE_R0 1
9399 @@ -5852,7 +5852,7 @@
9400 if test $ac_cv_member_ppc_thread_state_t___r0 = yes; then
9402 cat >>confdefs.h <<\_ACEOF
9403 -#define HAS_PPC_THREAD_STATE___R0
9404 +#define HAS_PPC_THREAD_STATE___R0 1
9408 @@ -5963,7 +5963,7 @@
9409 if test $ac_cv_member_ppc_thread_state64_t_r0 = yes; then
9411 cat >>confdefs.h <<\_ACEOF
9412 -#define HAS_PPC_THREAD_STATE64_R0
9413 +#define HAS_PPC_THREAD_STATE64_R0 1
9417 @@ -6074,16 +6074,16 @@
9418 if test $ac_cv_member_ppc_thread_state64_t___r0 = yes; then
9420 cat >>confdefs.h <<\_ACEOF
9421 -#define HAS_PPC_THREAD_STATE64___R0
9422 +#define HAS_PPC_THREAD_STATE64___R0 1
9429 - echo "$as_me:$LINENO: checking for i386_thread_state_t.eax" >&5
9430 -echo $ECHO_N "checking for i386_thread_state_t.eax... $ECHO_C" >&6
9431 -if test "${ac_cv_member_i386_thread_state_t_eax+set}" = set; then
9432 + echo "$as_me:$LINENO: checking for x86_thread_state32_t.eax" >&5
9433 +echo $ECHO_N "checking for x86_thread_state32_t.eax... $ECHO_C" >&6
9434 +if test "${ac_cv_member_x86_thread_state32_t_eax+set}" = set; then
9435 echo $ECHO_N "(cached) $ECHO_C" >&6
9437 cat >conftest.$ac_ext <<_ACEOF
9438 @@ -6093,12 +6093,12 @@
9439 cat >>conftest.$ac_ext <<_ACEOF
9440 /* end confdefs.h. */
9441 #include <sys/cdefs.h>
9442 -#include <mach/thread_status.h>
9443 + #include <mach/thread_status.h>
9448 -static i386_thread_state_t ac_aggr;
9449 +static x86_thread_state32_t ac_aggr;
9453 @@ -6127,7 +6127,7 @@
9455 echo "$as_me:$LINENO: \$? = $ac_status" >&5
9456 (exit $ac_status); }; }; then
9457 - ac_cv_member_i386_thread_state_t_eax=yes
9458 + ac_cv_member_x86_thread_state32_t_eax=yes
9460 echo "$as_me: failed program was:" >&5
9461 sed 's/^/| /' conftest.$ac_ext >&5
9462 @@ -6139,12 +6139,12 @@
9463 cat >>conftest.$ac_ext <<_ACEOF
9464 /* end confdefs.h. */
9465 #include <sys/cdefs.h>
9466 -#include <mach/thread_status.h>
9467 + #include <mach/thread_status.h>
9472 -static i386_thread_state_t ac_aggr;
9473 +static x86_thread_state32_t ac_aggr;
9474 if (sizeof ac_aggr.eax)
9477 @@ -6173,30 +6173,30 @@
9479 echo "$as_me:$LINENO: \$? = $ac_status" >&5
9480 (exit $ac_status); }; }; then
9481 - ac_cv_member_i386_thread_state_t_eax=yes
9482 + ac_cv_member_x86_thread_state32_t_eax=yes
9484 echo "$as_me: failed program was:" >&5
9485 sed 's/^/| /' conftest.$ac_ext >&5
9487 -ac_cv_member_i386_thread_state_t_eax=no
9488 +ac_cv_member_x86_thread_state32_t_eax=no
9490 rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
9492 rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
9494 -echo "$as_me:$LINENO: result: $ac_cv_member_i386_thread_state_t_eax" >&5
9495 -echo "${ECHO_T}$ac_cv_member_i386_thread_state_t_eax" >&6
9496 -if test $ac_cv_member_i386_thread_state_t_eax = yes; then
9497 +echo "$as_me:$LINENO: result: $ac_cv_member_x86_thread_state32_t_eax" >&5
9498 +echo "${ECHO_T}$ac_cv_member_x86_thread_state32_t_eax" >&6
9499 +if test $ac_cv_member_x86_thread_state32_t_eax = yes; then
9501 cat >>confdefs.h <<\_ACEOF
9502 -#define HAS_I386_THREAD_STATE_EAX
9503 +#define HAS_X86_THREAD_STATE32_EAX 1
9508 - echo "$as_me:$LINENO: checking for i386_thread_state_t.__eax" >&5
9509 -echo $ECHO_N "checking for i386_thread_state_t.__eax... $ECHO_C" >&6
9510 -if test "${ac_cv_member_i386_thread_state_t___eax+set}" = set; then
9511 + echo "$as_me:$LINENO: checking for x86_thread_state32_t.__eax" >&5
9512 +echo $ECHO_N "checking for x86_thread_state32_t.__eax... $ECHO_C" >&6
9513 +if test "${ac_cv_member_x86_thread_state32_t___eax+set}" = set; then
9514 echo $ECHO_N "(cached) $ECHO_C" >&6
9516 cat >conftest.$ac_ext <<_ACEOF
9517 @@ -6206,12 +6206,12 @@
9518 cat >>conftest.$ac_ext <<_ACEOF
9519 /* end confdefs.h. */
9520 #include <sys/cdefs.h>
9521 -#include <mach/thread_status.h>
9522 + #include <mach/thread_status.h>
9527 -static i386_thread_state_t ac_aggr;
9528 +static x86_thread_state32_t ac_aggr;
9532 @@ -6240,7 +6240,7 @@
9534 echo "$as_me:$LINENO: \$? = $ac_status" >&5
9535 (exit $ac_status); }; }; then
9536 - ac_cv_member_i386_thread_state_t___eax=yes
9537 + ac_cv_member_x86_thread_state32_t___eax=yes
9539 echo "$as_me: failed program was:" >&5
9540 sed 's/^/| /' conftest.$ac_ext >&5
9541 @@ -6252,12 +6252,12 @@
9542 cat >>conftest.$ac_ext <<_ACEOF
9543 /* end confdefs.h. */
9544 #include <sys/cdefs.h>
9545 -#include <mach/thread_status.h>
9546 + #include <mach/thread_status.h>
9551 -static i386_thread_state_t ac_aggr;
9552 +static x86_thread_state32_t ac_aggr;
9553 if (sizeof ac_aggr.__eax)
9556 @@ -6286,28 +6286,256 @@
9558 echo "$as_me:$LINENO: \$? = $ac_status" >&5
9559 (exit $ac_status); }; }; then
9560 - ac_cv_member_i386_thread_state_t___eax=yes
9561 + ac_cv_member_x86_thread_state32_t___eax=yes
9563 echo "$as_me: failed program was:" >&5
9564 sed 's/^/| /' conftest.$ac_ext >&5
9566 -ac_cv_member_i386_thread_state_t___eax=no
9567 +ac_cv_member_x86_thread_state32_t___eax=no
9569 rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
9571 rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
9573 -echo "$as_me:$LINENO: result: $ac_cv_member_i386_thread_state_t___eax" >&5
9574 -echo "${ECHO_T}$ac_cv_member_i386_thread_state_t___eax" >&6
9575 -if test $ac_cv_member_i386_thread_state_t___eax = yes; then
9576 +echo "$as_me:$LINENO: result: $ac_cv_member_x86_thread_state32_t___eax" >&5
9577 +echo "${ECHO_T}$ac_cv_member_x86_thread_state32_t___eax" >&6
9578 +if test $ac_cv_member_x86_thread_state32_t___eax = yes; then
9580 cat >>confdefs.h <<\_ACEOF
9581 -#define HAS_I386_THREAD_STATE___EAX
9582 +#define HAS_X86_THREAD_STATE32___EAX 1
9589 + echo "$as_me:$LINENO: checking for x86_thread_state64_t.rax" >&5
9590 +echo $ECHO_N "checking for x86_thread_state64_t.rax... $ECHO_C" >&6
9591 +if test "${ac_cv_member_x86_thread_state64_t_rax+set}" = set; then
9592 + echo $ECHO_N "(cached) $ECHO_C" >&6
9594 + cat >conftest.$ac_ext <<_ACEOF
9597 +cat confdefs.h >>conftest.$ac_ext
9598 +cat >>conftest.$ac_ext <<_ACEOF
9599 +/* end confdefs.h. */
9600 +#include <sys/cdefs.h>
9601 + #include <mach/thread_status.h>
9606 +static x86_thread_state64_t ac_aggr;
9613 +rm -f conftest.$ac_objext
9614 +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
9615 + (eval $ac_compile) 2>conftest.er1
9617 + grep -v '^ *+' conftest.er1 >conftest.err
9618 + rm -f conftest.er1
9619 + cat conftest.err >&5
9620 + echo "$as_me:$LINENO: \$? = $ac_status" >&5
9621 + (exit $ac_status); } &&
9622 + { ac_try='test -z "$ac_c_werror_flag"
9623 + || test ! -s conftest.err'
9624 + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
9625 + (eval $ac_try) 2>&5
9627 + echo "$as_me:$LINENO: \$? = $ac_status" >&5
9628 + (exit $ac_status); }; } &&
9629 + { ac_try='test -s conftest.$ac_objext'
9630 + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
9631 + (eval $ac_try) 2>&5
9633 + echo "$as_me:$LINENO: \$? = $ac_status" >&5
9634 + (exit $ac_status); }; }; then
9635 + ac_cv_member_x86_thread_state64_t_rax=yes
9637 + echo "$as_me: failed program was:" >&5
9638 +sed 's/^/| /' conftest.$ac_ext >&5
9640 +cat >conftest.$ac_ext <<_ACEOF
9643 +cat confdefs.h >>conftest.$ac_ext
9644 +cat >>conftest.$ac_ext <<_ACEOF
9645 +/* end confdefs.h. */
9646 +#include <sys/cdefs.h>
9647 + #include <mach/thread_status.h>
9652 +static x86_thread_state64_t ac_aggr;
9653 +if (sizeof ac_aggr.rax)
9659 +rm -f conftest.$ac_objext
9660 +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
9661 + (eval $ac_compile) 2>conftest.er1
9663 + grep -v '^ *+' conftest.er1 >conftest.err
9664 + rm -f conftest.er1
9665 + cat conftest.err >&5
9666 + echo "$as_me:$LINENO: \$? = $ac_status" >&5
9667 + (exit $ac_status); } &&
9668 + { ac_try='test -z "$ac_c_werror_flag"
9669 + || test ! -s conftest.err'
9670 + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
9671 + (eval $ac_try) 2>&5
9673 + echo "$as_me:$LINENO: \$? = $ac_status" >&5
9674 + (exit $ac_status); }; } &&
9675 + { ac_try='test -s conftest.$ac_objext'
9676 + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
9677 + (eval $ac_try) 2>&5
9679 + echo "$as_me:$LINENO: \$? = $ac_status" >&5
9680 + (exit $ac_status); }; }; then
9681 + ac_cv_member_x86_thread_state64_t_rax=yes
9683 + echo "$as_me: failed program was:" >&5
9684 +sed 's/^/| /' conftest.$ac_ext >&5
9686 +ac_cv_member_x86_thread_state64_t_rax=no
9688 +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
9690 +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
9692 +echo "$as_me:$LINENO: result: $ac_cv_member_x86_thread_state64_t_rax" >&5
9693 +echo "${ECHO_T}$ac_cv_member_x86_thread_state64_t_rax" >&6
9694 +if test $ac_cv_member_x86_thread_state64_t_rax = yes; then
9696 +cat >>confdefs.h <<\_ACEOF
9697 +#define HAS_X86_THREAD_STATE64_RAX 1
9702 + echo "$as_me:$LINENO: checking for x86_thread_state64_t.__rax" >&5
9703 +echo $ECHO_N "checking for x86_thread_state64_t.__rax... $ECHO_C" >&6
9704 +if test "${ac_cv_member_x86_thread_state64_t___rax+set}" = set; then
9705 + echo $ECHO_N "(cached) $ECHO_C" >&6
9707 + cat >conftest.$ac_ext <<_ACEOF
9710 +cat confdefs.h >>conftest.$ac_ext
9711 +cat >>conftest.$ac_ext <<_ACEOF
9712 +/* end confdefs.h. */
9713 +#include <sys/cdefs.h>
9714 + #include <mach/thread_status.h>
9719 +static x86_thread_state64_t ac_aggr;
9726 +rm -f conftest.$ac_objext
9727 +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
9728 + (eval $ac_compile) 2>conftest.er1
9730 + grep -v '^ *+' conftest.er1 >conftest.err
9731 + rm -f conftest.er1
9732 + cat conftest.err >&5
9733 + echo "$as_me:$LINENO: \$? = $ac_status" >&5
9734 + (exit $ac_status); } &&
9735 + { ac_try='test -z "$ac_c_werror_flag"
9736 + || test ! -s conftest.err'
9737 + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
9738 + (eval $ac_try) 2>&5
9740 + echo "$as_me:$LINENO: \$? = $ac_status" >&5
9741 + (exit $ac_status); }; } &&
9742 + { ac_try='test -s conftest.$ac_objext'
9743 + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
9744 + (eval $ac_try) 2>&5
9746 + echo "$as_me:$LINENO: \$? = $ac_status" >&5
9747 + (exit $ac_status); }; }; then
9748 + ac_cv_member_x86_thread_state64_t___rax=yes
9750 + echo "$as_me: failed program was:" >&5
9751 +sed 's/^/| /' conftest.$ac_ext >&5
9753 +cat >conftest.$ac_ext <<_ACEOF
9756 +cat confdefs.h >>conftest.$ac_ext
9757 +cat >>conftest.$ac_ext <<_ACEOF
9758 +/* end confdefs.h. */
9759 +#include <sys/cdefs.h>
9760 + #include <mach/thread_status.h>
9765 +static x86_thread_state64_t ac_aggr;
9766 +if (sizeof ac_aggr.__rax)
9772 +rm -f conftest.$ac_objext
9773 +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
9774 + (eval $ac_compile) 2>conftest.er1
9776 + grep -v '^ *+' conftest.er1 >conftest.err
9777 + rm -f conftest.er1
9778 + cat conftest.err >&5
9779 + echo "$as_me:$LINENO: \$? = $ac_status" >&5
9780 + (exit $ac_status); } &&
9781 + { ac_try='test -z "$ac_c_werror_flag"
9782 + || test ! -s conftest.err'
9783 + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
9784 + (eval $ac_try) 2>&5
9786 + echo "$as_me:$LINENO: \$? = $ac_status" >&5
9787 + (exit $ac_status); }; } &&
9788 + { ac_try='test -s conftest.$ac_objext'
9789 + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
9790 + (eval $ac_try) 2>&5
9792 + echo "$as_me:$LINENO: \$? = $ac_status" >&5
9793 + (exit $ac_status); }; }; then
9794 + ac_cv_member_x86_thread_state64_t___rax=yes
9796 + echo "$as_me: failed program was:" >&5
9797 +sed 's/^/| /' conftest.$ac_ext >&5
9799 +ac_cv_member_x86_thread_state64_t___rax=no
9801 +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
9803 +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
9805 +echo "$as_me:$LINENO: result: $ac_cv_member_x86_thread_state64_t___rax" >&5
9806 +echo "${ECHO_T}$ac_cv_member_x86_thread_state64_t___rax" >&6
9807 +if test $ac_cv_member_x86_thread_state64_t___rax = yes; then
9809 +cat >>confdefs.h <<\_ACEOF
9810 +#define HAS_X86_THREAD_STATE64___RAX 1
9819 @@ -6392,8 +6620,16 @@
9823 +# extra LD Flags which are required for targets
9826 + extra_ldflags_libgc=-Wl,-single_module
9833 target_all=libgcjgc.la
9836 @@ -8246,6 +8482,7 @@
9837 s,@THREADLIBS@,$THREADLIBS,;t t
9838 s,@POWERPC_DARWIN_TRUE@,$POWERPC_DARWIN_TRUE,;t t
9839 s,@POWERPC_DARWIN_FALSE@,$POWERPC_DARWIN_FALSE,;t t
9840 +s,@extra_ldflags_libgc@,$extra_ldflags_libgc,;t t
9841 s,@EXTRA_TEST_LIBS@,$EXTRA_TEST_LIBS,;t t
9842 s,@target_all@,$target_all,;t t
9843 s,@CPLUSPLUS_TRUE@,$CPLUSPLUS_TRUE,;t t
9844 Index: boehm-gc/os_dep.c
9845 ===================================================================
9846 --- boehm-gc/os_dep.c (.../tags/gcc_4_2_0_release) (revision 125292)
9847 +++ boehm-gc/os_dep.c (.../branches/gcc-4_2-branch) (revision 125292)
9848 @@ -3371,7 +3371,7 @@
9849 1. Apple's mach/xnu documentation
9850 2. Timothy J. Wood's "Mach Exception Handlers 101" post to the
9851 omnigroup's macosx-dev list.
9852 - www.omnigroup.com/mailman/archive/macosx-dev/2000-June/002030.html
9853 + www.omnigroup.com/mailman/archive/macosx-dev/2000-June/014178.html
9854 3. macosx-nat.c from Apple's GDB source code.
9857 @@ -3683,7 +3683,7 @@
9861 - MACHINE_THREAD_STATE
9862 + GC_MACH_THREAD_STATE
9864 if(r != KERN_SUCCESS) ABORT("task_set_exception_ports failed");
9866 @@ -3802,10 +3802,16 @@
9867 mach_msg_type_number_t exc_state_count = PPC_EXCEPTION_STATE64_COUNT;
9868 ppc_exception_state64_t exc_state;
9870 -# elif defined(I386)
9871 - thread_state_flavor_t flavor = i386_EXCEPTION_STATE;
9872 - mach_msg_type_number_t exc_state_count = i386_EXCEPTION_STATE_COUNT;
9873 - i386_exception_state_t exc_state;
9874 +# elif defined(I386) || defined(X86_64)
9875 +# if CPP_WORDSZ == 32
9876 + thread_state_flavor_t flavor = x86_EXCEPTION_STATE32;
9877 + mach_msg_type_number_t exc_state_count = x86_EXCEPTION_STATE32_COUNT;
9878 + x86_exception_state32_t exc_state;
9880 + thread_state_flavor_t flavor = x86_EXCEPTION_STATE64;
9881 + mach_msg_type_number_t exc_state_count = x86_EXCEPTION_STATE64_COUNT;
9882 + x86_exception_state64_t exc_state;
9885 # error FIXME for non-ppc darwin
9887 @@ -3838,9 +3844,9 @@
9889 /* This is the address that caused the fault */
9890 #if defined(POWERPC)
9891 - addr = (char*) exc_state.dar;
9892 -#elif defined (I386)
9893 - addr = (char*) exc_state.faultvaddr;
9894 + addr = (char*) exc_state. THREAD_FLD(dar);
9895 +#elif defined (I386) || defined (X86_64)
9896 + addr = (char*) exc_state. THREAD_FLD(faultvaddr);
9898 # error FIXME for non POWERPC/I386
9900 Index: boehm-gc/Makefile.am
9901 ===================================================================
9902 --- boehm-gc/Makefile.am (.../tags/gcc_4_2_0_release) (revision 125292)
9903 +++ boehm-gc/Makefile.am (.../branches/gcc-4_2-branch) (revision 125292)
9905 rs6000_mach_dep.s sparc_mach_dep.S sparc_netbsd_mach_dep.s \
9906 sparc_sunos4_mach_dep.s ia64_save_regs_in_stack.s
9908 +extra_ldflags_libgc = @extra_ldflags_libgc@
9910 # Include THREADLIBS here to ensure that the correct versions of
9911 # linuxthread semaphore functions get linked:
9912 libgcjgc_la_LIBADD = @addobjs@ $(THREADLIBS) $(UNWINDLIBS)
9913 libgcjgc_la_DEPENDENCIES = @addobjs@
9914 -libgcjgc_la_LDFLAGS = -version-info 1:2:0 -rpath $(toolexeclibdir)
9915 +libgcjgc_la_LDFLAGS = $(extra_ldflags_libgc) -version-info 1:2:0 -rpath $(toolexeclibdir)
9917 libgcjgc_convenience_la_LIBADD = @addobjs@
9918 libgcjgc_convenience_la_DEPENDENCIES = @addobjs@
9919 Index: boehm-gc/dyn_load.c
9920 ===================================================================
9921 --- boehm-gc/dyn_load.c (.../tags/gcc_4_2_0_release) (revision 125292)
9922 +++ boehm-gc/dyn_load.c (.../branches/gcc-4_2-branch) (revision 125292)
9923 @@ -1152,7 +1152,7 @@
9927 -static const char *GC_dyld_name_for_hdr(struct mach_header *hdr) {
9928 +static const char *GC_dyld_name_for_hdr(const struct GC_MACH_HEADER *hdr) {
9930 c = _dyld_image_count();
9931 for(i=0;i<c;i++) if(_dyld_get_image_header(i) == hdr)
9932 @@ -1162,12 +1162,17 @@
9935 /* This should never be called by a thread holding the lock */
9936 -static void GC_dyld_image_add(struct mach_header* hdr, unsigned long slide) {
9937 +static void GC_dyld_image_add(const struct GC_MACH_HEADER *hdr, intptr_t slide)
9939 unsigned long start,end,i;
9940 - const struct section *sec;
9941 + const struct GC_MACH_SECTION *sec;
9942 if (GC_no_dls) return;
9943 for(i=0;i<sizeof(GC_dyld_sections)/sizeof(GC_dyld_sections[0]);i++) {
9944 - sec = getsectbynamefromheader(
9945 +# if defined (__LP64__)
9946 + sec = getsectbynamefromheader_64(
9948 + sec = getsectbynamefromheader(
9950 hdr,GC_dyld_sections[i].seg,GC_dyld_sections[i].sect);
9951 if(sec == NULL || sec->size == 0) continue;
9952 start = slide + sec->addr;
9953 @@ -1184,11 +1189,16 @@
9956 /* This should never be called by a thread holding the lock */
9957 -static void GC_dyld_image_remove(struct mach_header* hdr, unsigned long slide) {
9958 +static void GC_dyld_image_remove(const struct GC_MACH_HEADER *hdr,
9960 unsigned long start,end,i;
9961 - const struct section *sec;
9962 + const struct GC_MACH_SECTION *sec;
9963 for(i=0;i<sizeof(GC_dyld_sections)/sizeof(GC_dyld_sections[0]);i++) {
9964 - sec = getsectbynamefromheader(
9965 +# if defined (__LP64__)
9966 + sec = getsectbynamefromheader_64(
9968 + sec = getsectbynamefromheader(
9970 hdr,GC_dyld_sections[i].seg,GC_dyld_sections[i].sect);
9971 if(sec == NULL || sec->size == 0) continue;
9972 start = slide + sec->addr;
9974 ===================================================================
9975 --- configure.in (.../tags/gcc_4_2_0_release) (revision 125292)
9976 +++ configure.in (.../branches/gcc-4_2-branch) (revision 125292)
9977 @@ -2419,7 +2419,13 @@
9978 # Pass -fkeep-inline-functions for stage 1 if the GCC version supports it.
9979 CFLAGS="$CFLAGS -fkeep-inline-functions"
9980 AC_MSG_CHECKING([whether -fkeep-inline-functions is supported])
9983 +#if (__GNUC__ < 3) \
9984 + || (__GNUC__ == 3 && (__GNUC_MINOR__ < 3 \
9985 + || (__GNUC_MINOR__ == 3 && __GNUC_PATCHLEVEL__ < 1)))
9986 +#error http://gcc.gnu.org/PR29382
9989 [AC_MSG_RESULT([yes]); stage1_cflags="$stage1_cflags -fkeep-inline-functions"],
9990 [AC_MSG_RESULT([no])])
9993 ===================================================================
9994 --- ChangeLog (.../tags/gcc_4_2_0_release) (revision 125292)
9995 +++ ChangeLog (.../branches/gcc-4_2-branch) (revision 125292)
9997 +2007-05-30 Jakub Jelinek <jakub@redhat.com>
9999 + PR bootstrap/29382
10000 + * configure.in: Don't use -fkeep-inline-functions for GCC < 3.3.1.
10001 + * configure: Rebuilt.
10003 2007-05-13 Release Manager
10005 * GCC 4.2.0 released.
10006 Index: libjava/java/lang/natClassLoader.cc
10007 ===================================================================
10008 --- libjava/java/lang/natClassLoader.cc (.../tags/gcc_4_2_0_release) (revision 125292)
10009 +++ libjava/java/lang/natClassLoader.cc (.../branches/gcc-4_2-branch) (revision 125292)
10010 @@ -235,6 +235,15 @@
10012 new_class->engine = &_Jv_soleIndirectCompiledEngine;
10014 + /* FIXME: Way back before the dawn of time, we overloaded the
10015 + SYNTHETIC class access modifier to mean INTERPRETED. This was a
10016 + Bad Thing, but it didn't matter then because classes were never
10017 + marked synthetic. However, it is possible to redeem the
10018 + situation: _Jv_NewClassFromInitializer is only called from
10019 + compiled classes, so we clear the INTERPRETED flag. This is a
10021 + new_class->accflags &= ~java::lang::reflect::Modifier::INTERPRETED;
10023 if (_Jv_CheckABIVersion ((unsigned long) new_class->next_or_version))
10024 (*_Jv_RegisterClassHook) (new_class);
10026 Index: libjava/ChangeLog
10027 ===================================================================
10028 --- libjava/ChangeLog (.../tags/gcc_4_2_0_release) (revision 125292)
10029 +++ libjava/ChangeLog (.../branches/gcc-4_2-branch) (revision 125292)
10031 +2007-05-31 Andrew Haley <aph@redhat.com>
10033 + * java/lang/natClassLoader.cc (_Jv_NewClassFromInitializer): Clear
10034 + INTERPRETED access modifier.
10036 2007-05-13 Release Manager
10038 * GCC 4.2.0 released.
10039 Index: maintainer-scripts/ChangeLog
10040 ===================================================================
10041 --- maintainer-scripts/ChangeLog (.../tags/gcc_4_2_0_release) (revision 125292)
10042 +++ maintainer-scripts/ChangeLog (.../branches/gcc-4_2-branch) (revision 125292)
10044 +2007-05-28 Mark Mitchell <mark@codesourcery.com>
10046 + * gcc_release: Adjust placement of release candidates.
10048 2007-05-13 Release Manager
10050 * GCC 4.2.0 released.
10051 Index: maintainer-scripts/gcc_release
10052 ===================================================================
10053 --- maintainer-scripts/gcc_release (.../tags/gcc_4_2_0_release) (revision 125292)
10054 +++ maintainer-scripts/gcc_release (.../branches/gcc-4_2-branch) (revision 125292)
10055 @@ -699,10 +699,10 @@
10056 # and minor release numbers.
10057 SVNBRANCH="branches/gcc-${RELEASE_MAJOR}_${RELEASE_MINOR}-branch"
10059 - # If this is not a final release, set various parameters acordingly.
10060 + # If this is not a final release, set various parameters accordingly.
10061 if [ ${FINAL} -ne 1 ]; then
10062 - RELEASE="${RELEASE}-${DATE}"
10063 - FTP_PATH="${FTP_PATH}/prerelease-${RELEASE}/"
10064 + RELEASE="${RELEASE}-RC-${DATE}"
10065 + FTP_PATH="${SNAPSHOTS_DIR}/${RELEASE}"
10067 FTP_PATH="${FTP_PATH}/releases/gcc-${RELEASE}/"