]> git.pld-linux.org Git - packages/compat-gcc-34.git/blob - compat-gcc-34-pr-rh.patch
- updated gettext BR
[packages/compat-gcc-34.git] / compat-gcc-34-pr-rh.patch
1 2006-02-17  Jakub Jelinek  <jakub@redhat.com>
2
3         PR libstdc++/11953
4         * gthr-posix.h (_REENTRANT): Only define if __osf__ is defined.
5
6         * config/ia64/linux.h (CPP_SPEC): Define.
7         * config/s390/linux.h (CPP_SPEC): Define.
8  
9 --- gcc/gthr-posix.h    (revision 111211)
10 +++ gcc/gthr-posix.h    (revision 111212)
11 @@ -36,7 +36,7 @@ Software Foundation, 51 Franklin Street,
12  #define __GTHREADS 1
13  
14  /* Some implementations of <pthread.h> require this to be defined.  */
15 -#ifndef _REENTRANT
16 +#if !defined(_REENTRANT) && defined(__osf__)
17  #define _REENTRANT 1
18  #endif
19  
20 --- gcc/config/s390/linux.h     (revision 111211)
21 +++ gcc/config/s390/linux.h     (revision 111212)
22 @@ -89,6 +89,7 @@ Software Foundation, 51 Franklin Street,
23            %{m31:-dynamic-linker /lib/ld.so.1} \
24            %{m64:-dynamic-linker /lib64/ld64.so.1}}}}"
25  
26 +#define CPP_SPEC "%{posix:-D_POSIX_SOURCE} %{pthread:-D_REENTRANT}"
27  
28  #define TARGET_ASM_FILE_END file_end_indicate_exec_stack
29  
30 --- gcc/config/ia64/linux.h     (revision 111211)
31 +++ gcc/config/ia64/linux.h     (revision 111212)
32 @@ -48,6 +48,7 @@ do {                                          \
33        %{!dynamic-linker:-dynamic-linker /lib/ld-linux-ia64.so.2}} \
34        %{static:-static}}"
35  
36 +#define CPP_SPEC "%{posix:-D_POSIX_SOURCE} %{pthread:-D_REENTRANT}"
37  
38  #define JMP_BUF_SIZE  76
39  
40 2004-05-27  Josef Zlomek  <zlomekj@suse.cz>
41
42         PR middle-end/14084
43         * emit-rtl.c (gen_rtx_REG_offset): Adjust the offset according
44         to size of decl.
45
46 --- gcc/emit-rtl.c      25 May 2004 12:04:15 -0000      1.391
47 +++ gcc/emit-rtl.c      27 May 2004 04:28:12 -0000      1.392
48 @@ -746,13 +746,96 @@ gen_reg_rtx (enum machine_mode mode)
49    return val;
50  }
51  
52 -/* Generate a register with same attributes as REG,
53 -   but offsetted by OFFSET.  */
54 +/* Generate a register with same attributes as REG, but offsetted by OFFSET.
55 +   Do the big endian correction if needed.  */
56  
57  rtx
58  gen_rtx_REG_offset (rtx reg, enum machine_mode mode, unsigned int regno, int offset)
59  {
60    rtx new = gen_rtx_REG (mode, regno);
61 +  tree decl;
62 +  HOST_WIDE_INT var_size;
63 +
64 +  /* PR middle-end/14084
65 +     The problem appears when a variable is stored in a larger register
66 +     and later it is used in the original mode or some mode in between
67 +     or some part of variable is accessed.
68 +
69 +     On little endian machines there is no problem because
70 +     the REG_OFFSET of the start of the variable is the same when
71 +     accessed in any mode (it is 0).
72 +
73 +     However, this is not true on big endian machines.
74 +     The offset of the start of the variable is different when accessed
75 +     in different modes.
76 +     When we are taking a part of the REG we have to change the OFFSET
77 +     from offset WRT size of mode of REG to offset WRT size of variable.
78 +
79 +     If we would not do the big endian correction the resulting REG_OFFSET
80 +     would be larger than the size of the DECL.
81 +
82 +     Examples of correction, for BYTES_BIG_ENDIAN WORDS_BIG_ENDIAN machine:
83 +
84 +     REG.mode  MODE  DECL size  old offset  new offset  description
85 +     DI        SI    4          4           0           int32 in SImode
86 +     DI        SI    1          4           0           char in SImode
87 +     DI        QI    1          7           0           char in QImode
88 +     DI        QI    4          5           1           1st element in QImode
89 +                                                        of char[4]
90 +     DI        HI    4          6           2           1st element in HImode
91 +                                                        of int16[2]
92 +
93 +     If the size of DECL is equal or greater than the size of REG
94 +     we can't do this correction because the register holds the
95 +     whole variable or a part of the variable and thus the REG_OFFSET
96 +     is already correct.  */
97 +
98 +  decl = REG_EXPR (reg);
99 +  if ((BYTES_BIG_ENDIAN || WORDS_BIG_ENDIAN)
100 +      && decl != NULL
101 +      && offset > 0
102 +      && GET_MODE_SIZE (GET_MODE (reg)) > GET_MODE_SIZE (mode)
103 +      && ((var_size = int_size_in_bytes (TREE_TYPE (decl))) > 0
104 +         && var_size < GET_MODE_SIZE (GET_MODE (reg))))
105 +    {
106 +      int offset_le;
107 +
108 +      /* Convert machine endian to little endian WRT size of mode of REG.  */
109 +      if (WORDS_BIG_ENDIAN)
110 +       offset_le = ((GET_MODE_SIZE (GET_MODE (reg)) - 1 - offset)
111 +                    / UNITS_PER_WORD) * UNITS_PER_WORD;
112 +      else
113 +       offset_le = (offset / UNITS_PER_WORD) * UNITS_PER_WORD;
114 +
115 +      if (BYTES_BIG_ENDIAN)
116 +       offset_le += ((GET_MODE_SIZE (GET_MODE (reg)) - 1 - offset)
117 +                     % UNITS_PER_WORD);
118 +      else
119 +       offset_le += offset % UNITS_PER_WORD;
120 +
121 +      if (offset_le >= var_size)
122 +       {
123 +         /* MODE is wider than the variable so the new reg will cover
124 +            the whole variable so the resulting OFFSET should be 0.  */
125 +         offset = 0;
126 +       }
127 +      else
128 +       {
129 +         /* Convert little endian to machine endian WRT size of variable.  */
130 +         if (WORDS_BIG_ENDIAN)
131 +           offset = ((var_size - 1 - offset_le)
132 +                     / UNITS_PER_WORD) * UNITS_PER_WORD;
133 +         else
134 +           offset = (offset_le / UNITS_PER_WORD) * UNITS_PER_WORD;
135 +
136 +         if (BYTES_BIG_ENDIAN)
137 +           offset += ((var_size - 1 - offset_le)
138 +                      % UNITS_PER_WORD);
139 +         else
140 +           offset += offset_le % UNITS_PER_WORD;
141 +       }
142 +    }
143 +
144    REG_ATTRS (new) = get_reg_attrs (REG_EXPR (reg),
145                                    REG_OFFSET (reg) + offset);
146    return new;
147 2005-01-13  Jakub Jelinek  <jakub@redhat.com>
148
149         PR rtl-optimization/16104
150         * expr.c (convert_move): Handle vector from resp. to if mode
151         sizes differ.
152
153         * gcc.c-torture/execute/20050113-1.c: New test.
154
155 --- gcc/expr.c.jj       2004-12-27 21:31:08.000000000 +0100
156 +++ gcc/expr.c  2005-01-13 15:56:31.229253647 +0100
157 @@ -590,7 +590,26 @@ convert_move (rtx to, rtx from, int unsi
158    if (VECTOR_MODE_P (to_mode) || VECTOR_MODE_P (from_mode))
159      {
160        if (GET_MODE_BITSIZE (from_mode) != GET_MODE_BITSIZE (to_mode))
161 -       abort ();
162 +        {
163 +          if (VECTOR_MODE_P (from_mode))
164 +            {
165 +              enum machine_mode new_mode;
166 +
167 +              new_mode = mode_for_size (GET_MODE_BITSIZE (from_mode),
168 +                                        MODE_INT, 0);
169 +              from = simplify_gen_subreg (new_mode, from, from_mode, 0);
170 +            }
171 +          if (VECTOR_MODE_P (to_mode))
172 +            {
173 +              enum machine_mode new_mode;
174 +
175 +              new_mode = mode_for_size (GET_MODE_BITSIZE (to_mode),
176 +                                        MODE_INT, 0);
177 +              to = simplify_gen_subreg (new_mode, to, to_mode, 0);
178 +            }
179 +          convert_move (to, from, unsignedp);
180 +          return;
181 +        }
182  
183        if (VECTOR_MODE_P (to_mode))
184         from = simplify_gen_subreg (to_mode, from, GET_MODE (from), 0);
185 --- gcc/testsuite/gcc.c-torture/execute/20050113-1.c.jj 2005-01-13 15:51:09.194383356 +0100
186 +++ gcc/testsuite/gcc.c-torture/execute/20050113-1.c    2005-01-13 15:37:22.000000000 +0100
187 @@ -0,0 +1,56 @@
188 +/* PR rtl-optimization/16104 */
189 +
190 +extern void abort (void);
191 +
192 +typedef int V2SI __attribute__ ((vector_size (8)));
193 +typedef short V2HI __attribute__ ((vector_size (4)));
194 +
195 +int
196 +test1 (void)
197 +{
198 +  return (long long) (V2SI) 0LL;
199 +}
200 +
201 +int
202 +test2 (V2SI x)
203 +{
204 +  return (long long) x;
205 +}
206 +
207 +V2SI
208 +test3 (void)
209 +{
210 +  return (V2SI) (long long) (int) (V2HI) 0;
211 +}
212 +
213 +V2SI
214 +test4 (V2HI x)
215 +{
216 +  return (V2SI) (long long) (int) x;
217 +}
218 +
219 +int
220 +main (void)
221 +{
222 +  if (sizeof (short) != 2 || sizeof (int) != 4 || sizeof (long long) != 8)
223 +    return 0;
224 +
225 +  if (test1 () != 0)
226 +    abort ();
227 +
228 +  V2SI x = { 2, 2 };
229 +  if (test2 (x) != 2)
230 +    abort ();
231 +
232 +  union { V2SI x; int y[2]; } u;
233 +  u.x = test3 ();
234 +  if (u.y[0] != 0 || u.y[1] != 0)
235 +    abort ();
236 +
237 +  V2HI y = { 4, 4 };
238 +  union { V2SI x; long long y; } v;
239 +  v.x = test4 (y);
240 +  if (v.y != 0x40004)
241 +    abort ();
242 +  return 0;
243 +}
244 2005-09-07  Jakub Jelinek  <jakub@redhat.com>
245
246         PR target/18300
247         * config/i386/i386.c (classify_argument): Only use different
248         iterators for nested loops if nested loops sharing the same
249         iterator would hang.
250
251 2004-11-13  Zak Kipling  <zak@transversal.com>
252
253         PR target/18300
254         * config/i386/i386.c (classify_argument): Fix infinite loop when
255         passing object with 3 or more base classes by value.
256
257 --- gcc/config/i386/i386.c.jj   2005-07-21 11:01:36.000000000 +0200
258 +++ gcc/config/i386/i386.c      2005-09-07 14:22:19.000000000 +0200
259 @@ -2028,8 +2028,17 @@ classify_argument (enum machine_mode mod
260             {
261               tree bases = TYPE_BINFO_BASETYPES (type);
262               int n_bases = TREE_VEC_LENGTH (bases);
263 -             int i;
264 -
265 +             int i, basenum;
266 +             enum x86_64_reg_class saveclasses[MAX_CLASSES];
267 +             bool seen[MAX_CLASSES];
268 +
269 +             /* PR target/18300: The following code mistakenly uses the same
270 +                iterator variable in both nested for loops.  But to preserve
271 +                binary compatibility, do whatever this code used to do before
272 +                unless old GCC would hang in an infinite loop.  In that case
273 +                use whatever GCC 4.0+ does.  */
274 +             memset (seen, 0, sizeof (seen));
275 +             memcpy (saveclasses, classes, sizeof (saveclasses));
276               for (i = 0; i < n_bases; ++i)
277                 {
278                    tree binfo = TREE_VEC_ELT (bases, i);
279 @@ -2037,6 +2046,12 @@ classify_argument (enum machine_mode mod
280                    int offset = tree_low_cst (BINFO_OFFSET (binfo), 0) * 8;
281                    tree type = BINFO_TYPE (binfo);
282  
283 +                  if (i < MAX_CLASSES)
284 +                    {
285 +                      if (seen[i])
286 +                        break;
287 +                      seen[i] = true;
288 +                    }
289                    num = classify_argument (TYPE_MODE (type),
290                                             type, subclasses,
291                                             (offset + bit_offset) % 256);
292 @@ -2049,6 +2064,32 @@ classify_argument (enum machine_mode mod
293                          merge_classes (subclasses[i], classes[i + pos]);
294                      }
295                 }
296 +             if (i < n_bases)
297 +               {
298 +                 /* Older GCC 3.[0-4].x would hang in the above loop, so
299 +                    don't worry about backwards compatibility and
300 +                    just DTRT.  */
301 +                 memcpy (classes, saveclasses, sizeof (saveclasses));
302 +                 for (basenum = 0; basenum < n_bases; ++basenum)
303 +                   {
304 +                     tree binfo = TREE_VEC_ELT (bases, basenum);
305 +                     int num;
306 +                     int offset = tree_low_cst (BINFO_OFFSET (binfo), 0) * 8;
307 +                     tree type = BINFO_TYPE (binfo);
308 +
309 +                     num = classify_argument (TYPE_MODE (type),
310 +                                              type, subclasses,
311 +                                              (offset + bit_offset) % 256);
312 +                     if (!num)
313 +                       return 0;
314 +                     for (i = 0; i < num; i++)
315 +                       {
316 +                         int pos = (offset + (bit_offset % 64)) / 8 / 8;
317 +                         classes[i + pos] =
318 +                           merge_classes (subclasses[i], classes[i + pos]);
319 +                       }
320 +                   }
321 +               }
322             }
323           /* And now merge the fields of structure.  */
324           for (field = TYPE_FIELDS (type); field; field = TREE_CHAIN (field))
325 @@ -2116,8 +2157,17 @@ classify_argument (enum machine_mode mod
326             {
327               tree bases = TYPE_BINFO_BASETYPES (type);
328               int n_bases = TREE_VEC_LENGTH (bases);
329 -             int i;
330 -
331 +             int i, basenum;
332 +             enum x86_64_reg_class saveclasses[MAX_CLASSES];
333 +             bool seen[MAX_CLASSES];
334 +
335 +             /* PR target/18300: The following code mistakenly uses the same
336 +                iterator variable in both nested for loops.  But to preserve
337 +                binary compatibility, do whatever this code used to do before
338 +                unless old GCC would hang in an infinite loop.  In that case
339 +                use whatever GCC 4.0+ does.  */
340 +             memset (seen, 0, sizeof (seen));
341 +             memcpy (saveclasses, classes, sizeof (saveclasses));
342               for (i = 0; i < n_bases; ++i)
343                 {
344                    tree binfo = TREE_VEC_ELT (bases, i);
345 @@ -2125,6 +2175,12 @@ classify_argument (enum machine_mode mod
346                    int offset = tree_low_cst (BINFO_OFFSET (binfo), 0) * 8;
347                    tree type = BINFO_TYPE (binfo);
348  
349 +                  if (i < MAX_CLASSES)
350 +                    {
351 +                      if (seen[i])
352 +                        break;
353 +                      seen[i] = true;
354 +                    }
355                    num = classify_argument (TYPE_MODE (type),
356                                             type, subclasses,
357                                             (offset + (bit_offset % 64)) % 256);
358 @@ -2137,6 +2193,32 @@ classify_argument (enum machine_mode mod
359                          merge_classes (subclasses[i], classes[i + pos]);
360                      }
361                 }
362 +             if (i < n_bases)
363 +               {
364 +                 /* Older GCC 3.[0-4].x would hang in the above loop, so
365 +                    don't worry about backwards compatibility and
366 +                    just DTRT.  */
367 +                 memcpy (classes, saveclasses, sizeof (saveclasses));
368 +                 for (basenum = 0; basenum < n_bases; ++basenum)
369 +                   {
370 +                     tree binfo = TREE_VEC_ELT (bases, basenum);
371 +                     int num;
372 +                     int offset = tree_low_cst (BINFO_OFFSET (binfo), 0) * 8;
373 +                     tree type = BINFO_TYPE (binfo);
374 +
375 +                     num = classify_argument (TYPE_MODE (type),
376 +                                              type, subclasses,
377 +                                              (offset + (bit_offset % 64)) % 256);
378 +                     if (!num)
379 +                       return 0;
380 +                     for (i = 0; i < num; i++)
381 +                       {
382 +                         int pos = (offset + (bit_offset % 64)) / 8 / 8;
383 +                         classes[i + pos] =
384 +                           merge_classes (subclasses[i], classes[i + pos]);
385 +                       }
386 +                   }
387 +               }
388             }
389           for (field = TYPE_FIELDS (type); field; field = TREE_CHAIN (field))
390             {
391 --- gcc/testsuite/g++.dg/other/infloop-1.C 1 Jan 1970 00:00:00 -0000
392 +++ gcc/testsuite/g++.dg/other/infloop-1.C      13 Nov 2004 23:09:08 -0000      1.1
393 @@ -0,0 +1,16 @@
394 +// PR 18300: This sends old compilers into an infinite loop on x86_64
395 +// Testcase and patch contributed by Zak Kipling <zak@transversal.com>
396 +
397 +struct base1 { };
398 +struct base2 { };
399 +struct base3 { };
400 +
401 +struct derived : base1, base2, base3 { };
402 +
403 +void foo(derived);
404 +
405 +int main()
406 +{
407 +  foo(derived());
408 +}
409 +
410 --- gcc/testsuite/g++.dg/ext/visibility/staticdatamem.C 1 Jan 1970 00:00:00 -0000
411 +++ gcc/testsuite/g++.dg/ext/visibility/staticdatamem.C 14 Dec 2004 02:15:55 -0000      1.1
412 @@ -0,0 +1,20 @@
413 +// PR c++/18925
414 +// { dg-do compile { target ia64-*-linux* } }
415 +// { dg-options "-fPIC -fvisibility=hidden" }
416 +// { dg-final { scan-assembler-not "gprel" } }
417 +
418 +class __attribute__ ((visibility("default"))) Type 
419 +{ 
420 + private: 
421 +  static long _staticTypeCount; 
422 + public: 
423 +  Type() { _staticTypeCount++; } 
424 +  ~Type(); 
425 +}; 
426
427 +long Type::_staticTypeCount = 0; 
428
429 +Type::~Type() 
430 +{ 
431 + _staticTypeCount--; 
432 +} 
433 2005-05-07  Richard Henderson  <rth@redhat.com>
434
435         PR target/21412
436         * config/rs6000/rs6000.c (rs6000_emit_move): Look for tls addresses
437         with constant offsets.
438
439 2004-07-11  Ulrich Weigand  <uweigand@de.ibm.com>
440
441         * config/s390/s390.c (legitimize_tls_address): Handle constant offsets
442         added to TLS symbol addresses.
443
444 2004-07-06  Richard Henderson  <rth@redhat.com>
445
446         * config/i386/i386.c (legitimize_address): Handle CONST with TLS
447         operand.
448         (ix86_expand_move): Don't call legitimize_pic_address directly.
449
450 2006-05-05  Jakub Jelinek  <jakub@redhat.com>
451
452         * gcc.dg/tls/opt-12.c: New test.
453
454 --- gcc/config/s390/s390.c      (revision 84404)
455 +++ gcc/config/s390/s390.c      (revision 84535)
456 @@ -2913,6 +2913,18 @@ legitimize_tls_address (rtx addr, rtx re
457         }
458      }
459  
460 +  else if (GET_CODE (addr) == CONST && GET_CODE (XEXP (addr, 0)) == PLUS
461 +          && GET_CODE (XEXP (XEXP (addr, 0), 1)) == CONST_INT)
462 +    {
463 +      new = XEXP (XEXP (addr, 0), 0);
464 +      if (GET_CODE (new) != SYMBOL_REF)
465 +       new = gen_rtx_CONST (Pmode, new);
466 +
467 +      new = legitimize_tls_address (new, reg);
468 +      new = plus_constant (new, INTVAL (XEXP (XEXP (addr, 0), 1)));
469 +      new = force_operand (new, 0);
470 +    }
471 +
472    else
473      abort ();  /* for now ... */
474  
475 --- gcc/config/i386/i386.c      2005-11-21 14:56:49.000000000 +0100
476 +++ gcc/config/i386/i386.c      2006-05-05 11:21:54.000000000 +0200
477 @@ -6604,6 +6604,13 @@ legitimize_address (rtx x, rtx oldx ATTR
478    log = tls_symbolic_operand (x, mode);
479    if (log)
480      return legitimize_tls_address (x, log, false);
481 +  if (GET_CODE (x) == CONST
482 +      && GET_CODE (XEXP (x, 0)) == PLUS
483 +      && (log = tls_symbolic_operand (XEXP (XEXP (x, 0), 0), Pmode)))
484 +    {
485 +      rtx t = legitimize_tls_address (XEXP (XEXP (x, 0), 0), log, false);
486 +      return gen_rtx_PLUS (Pmode, t, XEXP (XEXP (x, 0), 1));
487 +    }
488  
489    if (flag_pic && SYMBOLIC_CONST (x))
490      return legitimize_pic_address (x, 0);
491 @@ -8395,6 +8402,10 @@ ix86_expand_move (enum machine_mode mode
492  #else
493        if (GET_CODE (op0) == MEM)
494         op1 = force_reg (Pmode, op1);
495 +      else if (GET_CODE (op1) == CONST
496 +              && GET_CODE (XEXP (op1, 0)) == PLUS
497 +              && tls_symbolic_operand (XEXP (XEXP (op1, 0), 0), Pmode))
498 +       op1 = legitimize_address (op1, op1, Pmode);
499        else
500         {
501           rtx temp = op0;
502 --- gcc/config/rs6000/rs6000.c  (revision 99334)
503 +++ gcc/config/rs6000/rs6000.c  (revision 99367)
504 @@ -4436,11 +4436,31 @@ rs6000_emit_move (rtx dest, rtx source, 
505  
506    /* Recognize the case where operand[1] is a reference to thread-local
507       data and load its address to a register.  */
508 -  if (GET_CODE (operands[1]) == SYMBOL_REF)
509 +  if (rs6000_tls_referenced_p (operands[1]))
510      {
511 -      enum tls_model model = SYMBOL_REF_TLS_MODEL (operands[1]);
512 -      if (model != 0)
513 -       operands[1] = rs6000_legitimize_tls_address (operands[1], model);
514 +      enum tls_model model;
515 +      rtx tmp = operands[1];
516 +      rtx addend = NULL;
517 +
518 +      if (GET_CODE (tmp) == CONST && GET_CODE (XEXP (tmp, 0)) == PLUS)
519 +       {
520 +          addend = XEXP (XEXP (tmp, 0), 1);
521 +         tmp = XEXP (XEXP (tmp, 0), 0);
522 +       }
523 +
524 +      if (GET_CODE (tmp) != SYMBOL_REF)
525 +       abort ();
526 +      model = SYMBOL_REF_TLS_MODEL (tmp);
527 +      if (model == 0)
528 +       abort ();
529 +
530 +      tmp = rs6000_legitimize_tls_address (tmp, model);
531 +      if (addend)
532 +       {
533 +         tmp = gen_rtx_PLUS (mode, tmp, addend);
534 +         tmp = force_operand (tmp, operands[0]);
535 +       }
536 +      operands[1] = tmp;
537      }
538  
539    /* Handle the case where reload calls us with an invalid address.  */
540 --- gcc/testsuite/gcc.dg/tls/opt-9.c    (revision 0)
541 +++ gcc/testsuite/gcc.dg/tls/opt-9.c    (revision 99367)
542 @@ -0,0 +1,7 @@
543 +/* PR 21412 */
544 +/* { dg-do compile */
545 +/* { dg-options "-O2 -fPIC" } */
546 +
547 +struct S { int x[10]; };
548 +extern __thread struct S s;
549 +int *foo() { return &s.x[2]; }
550 --- gcc/testsuite/gcc.dg/tls/opt-12.c   2006-04-19 19:21:31.748476000 +0200
551 +++ gcc/testsuite/gcc.dg/tls/opt-12.c   2006-05-05 11:01:33.000000000 +0200
552 @@ -0,0 +1,16 @@
553 +/* { dg-do compile } */
554 +/* { dg-options "-O2" } */
555 +/* { XXdgXX-require-effective-target tls } */
556 +
557 +__thread struct
558 +{
559 +  int a;
560 +  char b[32];
561 +} thr;
562 +
563 +int
564 +main ()
565 +{
566 +  __builtin_strcpy (thr.b, "abcd");
567 +  return 0;
568 +}
569 2005-07-22  Jakub Jelinek  <jakub@redhat.com>
570
571         * src/sstream-inst.cc: Add .hidden directive for
572         streamsize basic_stringbuf<{char,wchar_t}>::showmanyc().
573         * src/sstream-inst-showmanyc.cc: New file.
574         * src/Makefile.am (libstdc++_nonshared.la): Add new library.
575         * src/Makefile.in: Rebuilt.
576         * testsuite/lib/libstdc++.exp: Append -lstdc++_nonshared for
577         testsuite executable linking.
578
579 2005-06-08  Benjamin Kosnik  <bkoz@redhat.com>
580
581         PR libstdc++/21955
582         * include/std/std_sstream.h (basic_stringbuf::showmanyc): Add.
583         * testsuite/27_io/basic_streambuf/in_avail/char/1.cc: New, test
584         base class behavior.
585         * testsuite/27_io/basic_streambuf/in_avail/wchar_t/1.cc: Same.
586         * testsuite/27_io/basic_stringbuf/in_avail/char/21955.cc: New.
587         * testsuite/27_io/basic_stringbuf/in_avail/char/1.cc: Match
588         filebuf behavior.
589         * testsuite/27_io/basic_stringbuf/str/char/1.cc: Same.
590
591 --- libstdc++-v3/src/sstream-inst.cc.jj 2003-07-11 10:28:13.000000000 +0200
592 +++ libstdc++-v3/src/sstream-inst.cc    2005-07-21 17:46:08.000000000 +0200
593 @@ -60,3 +60,8 @@ namespace std
594    template class basic_stringstream<wchar_t>; 
595  #endif
596  } // namespace std
597 +
598 +#ifdef PIC
599 +__asm (".hidden _ZNSt15basic_stringbufIcSt11char_traitsIcESaIcEE9showmanycEv");
600 +__asm (".hidden _ZNSt15basic_stringbufIwSt11char_traitsIwESaIwEE9showmanycEv");
601 +#endif
602 --- libstdc++-v3/src/sstream-inst-showmanyc.cc.jj       2005-07-21 21:27:40.000000000 +0200
603 +++ libstdc++-v3/src/sstream-inst-showmanyc.cc  2005-07-22 09:16:58.000000000 +0200
604 @@ -0,0 +1,39 @@
605 +// Explicit instantiation file.
606 +
607 +// Copyright (C) 2005
608 +// Free Software Foundation, Inc.
609 +//
610 +// This file is part of the GNU ISO C++ Library.  This library is free
611 +// software; you can redistribute it and/or modify it under the
612 +// terms of the GNU General Public License as published by the
613 +// Free Software Foundation; either version 2, or (at your option)
614 +// any later version.
615 +
616 +// This library is distributed in the hope that it will be useful,
617 +// but WITHOUT ANY WARRANTY; without even the implied warranty of
618 +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
619 +// GNU General Public License for more details.
620 +
621 +// You should have received a copy of the GNU General Public License along
622 +// with this library; see the file COPYING.  If not, write to the Free
623 +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
624 +// USA.
625 +
626 +// As a special exception, you may use this file as part of a free software
627 +// library without restriction.  Specifically, if other files instantiate
628 +// templates or use macros or inline functions from this file, or you compile
629 +// this file and link it with other files to produce an executable, this
630 +// file does not by itself cause the resulting executable to be covered by
631 +// the GNU General Public License.  This exception does not however
632 +// invalidate any other reasons why the executable file might be covered by
633 +// the GNU General Public License.
634 +
635 +#include <sstream>
636 +
637 +namespace std
638 +{
639 +  // These symbols are hidden in libstdc++.so, as it is undesirable to export
640 +  // @@GLIBCXX_3.4.6
641 +  template streamsize basic_stringbuf<char, char_traits<char>, allocator<char> >::showmanyc();
642 +  template streamsize basic_stringbuf<wchar_t, char_traits<wchar_t>, allocator<wchar_t> >::showmanyc();
643 +} // namespace std
644 --- libstdc++-v3/src/Makefile.am.jj     2004-04-20 15:55:47.000000000 +0200
645 +++ libstdc++-v3/src/Makefile.am        2005-07-22 09:00:32.000000000 +0200
646 @@ -25,7 +25,7 @@
647  include $(top_srcdir)/fragment.am
648  
649  # Cross compiler support.
650 -toolexeclib_LTLIBRARIES = libstdc++.la
651 +toolexeclib_LTLIBRARIES = libstdc++.la libstdc++_nonshared.la
652  
653  # Symbol versioning for shared libraries.
654  if GLIBCXX_BUILD_VERSIONED_SHLIB
655 @@ -150,6 +150,11 @@ libstdc___la_DEPENDENCIES = ${version_de
656  libstdc___la_LDFLAGS = \
657         -version-info $(libtool_VERSION) ${version_arg} -lm 
658  
659 +libstdc___nonshared_la_SOURCES = \
660 +       sstream-inst-showmanyc.cc
661 +libstdc___nonshared_la_LIBADD =
662 +libstdc___nonshared_la_DEPENDENCIES = $(libstdc___nonshared_la_LIBADD)
663 +libstdc___nonshared_la_LDFLAGS = -static
664  
665  # Use special rules for the deprecated source files so that they find
666  # deprecated include files.
667 @@ -159,6 +164,14 @@ strstream.lo: strstream.cc
668  strstream.o: strstream.cc
669         $(CXXCOMPILE) -I$(GLIBCXX_INCLUDE_DIR)/backward -Wno-deprecated -c $<
670  
671 +# Use special rules for libstdc++_nonshared.la files, as -prefer-pic
672 +# doesn't seem to work for some reason.
673 +sstream-inst-showmanyc.lo: sstream-inst-showmanyc.cc
674 +       $(LTCXXCOMPILE) -c $< \
675 +         && cp -f .libs/sstream-inst-showmanyc.o sstream-inst-showmanyc.o
676 +sstream-inst-showmanyc.o: sstream-inst-showmanyc.cc
677 +       $(CXXCOMPILE) -fPIC -DPIC -c $<
678 +
679  # Use special rules for the concept-checking instantiations so that all
680  # the generated template functions are also instantiated.  Force the checks
681  # to be on so that the instantiations are actually seen.
682 --- libstdc++-v3/src/Makefile.in.jj     2004-04-20 15:55:47.000000000 +0200
683 +++ libstdc++-v3/src/Makefile.in        2005-07-22 09:06:15.000000000 +0200
684 @@ -221,7 +221,7 @@ WARN_CXXFLAGS = \
685  AM_CPPFLAGS = $(GLIBCXX_INCLUDES)
686  
687  # Cross compiler support.
688 -toolexeclib_LTLIBRARIES = libstdc++.la
689 +toolexeclib_LTLIBRARIES = libstdc++.la libstdc++_nonshared.la
690  
691  # Symbol versioning for shared libraries.
692  @GLIBCXX_BUILD_VERSIONED_SHLIB_TRUE@version_arg = -Wl,--version-script=libstdc++-symbol.ver
693 @@ -308,6 +308,13 @@ libstdc___la_LDFLAGS = \
694         -version-info $(libtool_VERSION) ${version_arg} -lm 
695  
696  
697 +libstdc___nonshared_la_SOURCES = \
698 +       sstream-inst-showmanyc.cc
699 +
700 +libstdc___nonshared_la_LIBADD = 
701 +libstdc___nonshared_la_DEPENDENCIES = $(libstdc___nonshared_la_LIBADD)
702 +libstdc___nonshared_la_LDFLAGS = -static
703 +
704  # Use special rules for the deprecated source files so that they find
705  # deprecated include files.
706  GLIBCXX_INCLUDE_DIR = $(glibcxx_builddir)/include
707 @@ -379,6 +386,8 @@ am__objects_3 = allocator.lo codecvt.lo 
708         $(am__objects_1) $(am__objects_2)
709  am_libstdc___la_OBJECTS = $(am__objects_3)
710  libstdc___la_OBJECTS = $(am_libstdc___la_OBJECTS)
711 +am_libstdc___nonshared_la_OBJECTS = sstream-inst-showmanyc.lo
712 +libstdc___nonshared_la_OBJECTS = $(am_libstdc___nonshared_la_OBJECTS)
713  
714  DEFAULT_INCLUDES =  -I. -I$(srcdir) -I$(top_builddir)
715  depcomp =
716 @@ -386,10 +395,10 @@ am__depfiles_maybe =
717  CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
718         $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
719  CXXLD = $(CXX)
720 -DIST_SOURCES = $(libstdc___la_SOURCES)
721 +DIST_SOURCES = $(libstdc___la_SOURCES) $(libstdc___nonshared_la_SOURCES)
722  DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/fragment.am \
723         Makefile.am
724 -SOURCES = $(libstdc___la_SOURCES)
725 +SOURCES = $(libstdc___la_SOURCES) $(libstdc___nonshared_la_SOURCES)
726  
727  all: all-am
728  
729 @@ -430,6 +439,8 @@ clean-toolexeclibLTLIBRARIES:
730         done
731  libstdc++.la: $(libstdc___la_OBJECTS) $(libstdc___la_DEPENDENCIES) 
732         $(CXXLINK) -rpath $(toolexeclibdir) $(libstdc___la_LDFLAGS) $(libstdc___la_OBJECTS) $(libstdc___la_LIBADD) $(LIBS)
733 +libstdc++_nonshared.la: $(libstdc___nonshared_la_OBJECTS) $(libstdc___nonshared_la_DEPENDENCIES) 
734 +       $(CXXLINK) -rpath $(toolexeclibdir) $(libstdc___nonshared_la_LDFLAGS) $(libstdc___nonshared_la_OBJECTS) $(libstdc___nonshared_la_LIBADD) $(LIBS)
735  
736  mostlyclean-compile:
737         -rm -f *.$(OBJEXT) core *.core
738 @@ -674,6 +685,14 @@ strstream.lo: strstream.cc
739  strstream.o: strstream.cc
740         $(CXXCOMPILE) -I$(GLIBCXX_INCLUDE_DIR)/backward -Wno-deprecated -c $<
741  
742 +# Use special rules for libstdc++_nonshared.la files, as -prefer-pic
743 +# doesn't seem to work for some reason.
744 +sstream-inst-showmanyc.lo: sstream-inst-showmanyc.cc
745 +       $(LTCXXCOMPILE) -c $< \
746 +         && cp -f .libs/sstream-inst-showmanyc.o sstream-inst-showmanyc.o
747 +sstream-inst-showmanyc.o: sstream-inst-showmanyc.cc
748 +       $(CXXCOMPILE) -fPIC -DPIC -c $<
749 +
750  # Use special rules for the concept-checking instantiations so that all
751  # the generated template functions are also instantiated.  Force the checks
752  # to be on so that the instantiations are actually seen.
753 --- libstdc++-v3/include/std/std_sstream.h.jj   2004-10-04 14:58:25.000000000 +0200
754 +++ libstdc++-v3/include/std/std_sstream.h      2005-07-21 17:17:16.000000000 +0200
755 @@ -185,6 +185,18 @@ namespace std
756         _M_sync(const_cast<char_type*>(_M_string.data()), 0, __len);
757        }
758  
759 +      virtual streamsize
760 +      showmanyc()
761 +      {
762 +       streamsize __ret = -1;
763 +       if (_M_mode & ios_base::in)
764 +         {
765 +           _M_update_egptr();
766 +           __ret = this->egptr() - this->gptr();
767 +         }
768 +       return __ret;
769 +      }
770 +
771        // [documentation is inherited]
772        virtual int_type
773        underflow();
774 --- libstdc++-v3/testsuite/27_io/basic_stringbuf/str/char/1.cc.jj       2003-10-01 12:12:11.000000000 +0200
775 +++ libstdc++-v3/testsuite/27_io/basic_stringbuf/str/char/1.cc  2005-07-22 01:22:15.000000000 +0200
776 @@ -45,7 +45,7 @@ void test03() 
777    std::streamsize d1 = strb_01.in_avail();
778    std::streamsize d2 = strb_03.in_avail();
779    VERIFY( d1 ); // non-zero
780 -  VERIFY( !d2 ); // zero, cuz ios_base::out
781 +  VERIFY( d2 == -1 ); // -1, cuz ios_base::out
782    VERIFY( d1 != d2 ); //these should be the same
783    VERIFY( static_cast<std::streamsize>(str_01.length()) == d1 );  
784    VERIFY( strb_01.str() == strb_03.str() ); //ditto
785 --- libstdc++-v3/testsuite/27_io/basic_stringbuf/in_avail/char/1.cc.jj  2003-10-01 12:12:10.000000000 +0200
786 +++ libstdc++-v3/testsuite/27_io/basic_stringbuf/in_avail/char/1.cc     2005-07-22 01:22:04.000000000 +0200
787 @@ -49,8 +49,8 @@ void test04() 
788    VERIFY( strmof_1 == static_cast<std::streamoff>(str_01.length()) );
789    VERIFY( strmof_2 == static_cast<std::streamoff>(str_02.length()) );
790    strmof_1 = strb_03.in_avail(); 
791 -  // zero cuz write-only, or eof()? zero, from showmany
792 -  VERIFY( strmof_1 == 0 ); 
793 +  // zero cuz write-only, or eof() to match basic_filebuf
794 +  VERIFY( strmof_1 == -1 ); 
795  }
796  
797  int main()
798 --- libstdc++-v3/testsuite/27_io/basic_stringbuf/in_avail/char/21955.cc.jj      2005-07-22 01:22:04.000000000 +0200
799 +++ libstdc++-v3/testsuite/27_io/basic_stringbuf/in_avail/char/21955.cc 2005-07-22 01:22:04.000000000 +0200
800 @@ -0,0 +1,54 @@
801 +// 2005-06-07 Benjamin Kosnik
802 +
803 +// Copyright (C) 2005
804 +// Free Software Foundation, Inc.
805 +//
806 +// This file is part of the GNU ISO C++ Library.  This library is free
807 +// software; you can redistribute it and/or modify it under the
808 +// terms of the GNU General Public License as published by the
809 +// Free Software Foundation; either version 2, or (at your option)
810 +// any later version.
811 +
812 +// This library is distributed in the hope that it will be useful,
813 +// but WITHOUT ANY WARRANTY; without even the implied warranty of
814 +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
815 +// GNU General Public License for more details.
816 +
817 +// You should have received a copy of the GNU General Public License along
818 +// with this library; see the file COPYING.  If not, write to the Free
819 +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
820 +// USA.
821 +
822 +#include <sstream>
823 +#include <testsuite_hooks.h>
824 +#include <stdexcept>
825 +
826 +double  
827 +test_stringstream()
828 +{
829 +  double result;
830 +  char* source = "1918"; 
831 +  std::stringstream s;
832 +  s << source;
833 +
834 +  std::string tmp = s.str();
835 +  std::streambuf* sb = s.rdbuf();
836 +  int i = sb->in_avail();
837 +
838 +  if (i)
839 +    {
840 +      s >> result;
841 +    }
842 +  else
843 +    {
844 +      throw std::runtime_error("conversion failed");
845 +    }
846 +  return result;
847 +}
848 +
849 +
850 +int main ()
851 +{
852 +  test_stringstream();
853 +  return 0;
854 +}
855 --- libstdc++-v3/testsuite/27_io/basic_streambuf/in_avail/char/1.cc.jj  2005-07-22 01:21:41.000000000 +0200
856 +++ libstdc++-v3/testsuite/27_io/basic_streambuf/in_avail/char/1.cc     2005-07-22 01:21:41.000000000 +0200
857 @@ -0,0 +1,54 @@
858 +// 2005-06-07 Benjamin Kosnik  <bkoz@redhat.com>
859 +
860 +// Copyright (C) 2005 Free Software Foundation, Inc.
861 +//
862 +// This file is part of the GNU ISO C++ Library.  This library is free
863 +// software; you can redistribute it and/or modify it under the
864 +// terms of the GNU General Public License as published by the
865 +// Free Software Foundation; either version 2, or (at your option)
866 +// any later version.
867 +
868 +// This library is distributed in the hope that it will be useful,
869 +// but WITHOUT ANY WARRANTY; without even the implied warranty of
870 +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
871 +// GNU General Public License for more details.
872 +
873 +// You should have received a copy of the GNU General Public License along
874 +// with this library; see the file COPYING.  If not, write to the Free
875 +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
876 +// USA.
877 +
878 +// 27.8.1.4 Overridden virtual functions
879 +
880 +#include <fstream>
881 +#include <testsuite_hooks.h>
882 +
883 +typedef std::basic_streambuf<char>     streambuf_type;
884 +
885 +struct testbuf : streambuf_type
886 +{
887 +  testbuf() { }
888 +};
889 +
890 +void test05() 
891 +{
892 +  typedef streambuf_type::int_type     int_type;
893 +  typedef streambuf_type::traits_type  traits_type;
894 +  typedef streambuf_type::pos_type     pos_type;
895 +  typedef streambuf_type::off_type     off_type;
896 +  typedef size_t                       size_type;
897 +
898 +  bool test __attribute__((unused)) = true;
899 +  std::streamoff                       strmof_1, strmof_2;
900 +  testbuf      sb01;
901 +
902 +  // int in_avail()
903 +  strmof_1 = sb01.in_avail();
904 +  VERIFY( strmof_1  == 0 ); 
905 +}
906 +
907 +int main() 
908 +{
909 +  test05();
910 +  return 0;
911 +}
912 --- libstdc++-v3/testsuite/27_io/basic_streambuf/in_avail/wchar_t/1.cc.jj       2005-07-22 01:21:41.000000000 +0200
913 +++ libstdc++-v3/testsuite/27_io/basic_streambuf/in_avail/wchar_t/1.cc  2005-07-22 01:21:41.000000000 +0200
914 @@ -0,0 +1,54 @@
915 +// 2005-06-07 Benjamin Kosnik  <bkoz@redhat.com>
916 +
917 +// Copyright (C) 2005 Free Software Foundation, Inc.
918 +//
919 +// This file is part of the GNU ISO C++ Library.  This library is free
920 +// software; you can redistribute it and/or modify it under the
921 +// terms of the GNU General Public License as published by the
922 +// Free Software Foundation; either version 2, or (at your option)
923 +// any later version.
924 +
925 +// This library is distributed in the hope that it will be useful,
926 +// but WITHOUT ANY WARRANTY; without even the implied warranty of
927 +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
928 +// GNU General Public License for more details.
929 +
930 +// You should have received a copy of the GNU General Public License along
931 +// with this library; see the file COPYING.  If not, write to the Free
932 +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
933 +// USA.
934 +
935 +// 27.8.1.4 Overridden virtual functions
936 +
937 +#include <fstream>
938 +#include <testsuite_hooks.h>
939 +
940 +typedef std::basic_streambuf<wchar_t>  streambuf_type;
941 +
942 +struct testbuf : streambuf_type
943 +{
944 +  testbuf() { }
945 +};
946 +
947 +void test05() 
948 +{
949 +  typedef streambuf_type::int_type     int_type;
950 +  typedef streambuf_type::traits_type  traits_type;
951 +  typedef streambuf_type::pos_type     pos_type;
952 +  typedef streambuf_type::off_type     off_type;
953 +  typedef size_t                       size_type;
954 +
955 +  bool test __attribute__((unused)) = true;
956 +  std::streamoff                       strmof_1, strmof_2;
957 +  testbuf      sb01;
958 +
959 +  // int in_avail()
960 +  strmof_1 = sb01.in_avail();
961 +  VERIFY( strmof_1  == 0 ); 
962 +}
963 +
964 +int main() 
965 +{
966 +  test05();
967 +  return 0;
968 +}
969 --- libstdc++-v3/libsupc++/eh_globals.cc.jj     2005-11-21 14:43:32.000000000 +0100
970 +++ libstdc++-v3/libsupc++/eh_globals.cc        2006-04-21 15:38:55.000000000 +0200
971 @@ -36,6 +36,26 @@
972  
973  using namespace __cxxabiv1;
974  
975 +#if 1
976 +namespace __gnu_internal
977 +{
978 +  __cxxabiv1::__cxa_eh_globals*
979 +  get_global() throw()
980 +  {
981 +    static __thread __cxxabiv1::__cxa_eh_globals global __attribute__((tls_model ("initial-exec")));
982 +    return &global;
983 +  }
984 +}
985 +
986 +extern "C" __cxa_eh_globals*
987 +__cxxabiv1::__cxa_get_globals_fast() throw()
988 +{ return __gnu_internal::get_global(); }
989 +
990 +extern "C" __cxa_eh_globals*
991 +__cxxabiv1::__cxa_get_globals() throw()
992 +{ return __gnu_internal::get_global(); }
993 +
994 +#else
995  
996  // Single-threaded fallback buffer.
997  static __cxa_eh_globals globals_static;
998 @@ -125,3 +145,4 @@ __cxa_get_globals () throw()
999    return &globals_static;
1000  #endif
1001  }
1002 +#endif
1003 2005-11-23  Paolo Carlini  <pcarlini@suse.de>
1004
1005         PR libstdc++/24975 (basic_string)
1006         * include/bits/basic_string.h (_Rep::_S_empty_rep): Avoid
1007         strict-aliasing warnings.
1008
1009 2005-11-22  Paolo Carlini  <pcarlini@suse.de>
1010
1011         PR libstdc++/24975
1012         * include/bits/stl_set.h (insert(iterator, const value_type&),
1013         erase(iterator), erase(iterator, iterator)): Don't break aliasing
1014         rules casting to _Rep_iterator&, forward to _Rb_tree facilities.
1015         * include/bits/stl_multiset.h (insert(iterator, const value_type&),
1016         erase(iterator), erase(iterator, iterator)): Likewise.
1017         * include/bits/stl_tree.h (_Rb_tree<>::_M_insert(_Const_Base_ptr,
1018         _Const_Base_ptr, const value_type&), insert_unique(const_iterator,
1019         const value_type&), insert_equal(const_iterator, const value_type&),
1020         erase(const_iterator), erase(const_iterator, const_iterator)): New,
1021         _Rb_tree<>::const_iterator counterparts of existing facilities.
1022
1023 --- libstdc++-v3/include/bits/basic_string.h.jj 2007-02-23 21:29:15.000000000 +0100
1024 +++ libstdc++-v3/include/bits/basic_string.h    2007-07-19 12:11:40.000000000 +0200
1025 @@ -175,7 +175,16 @@ namespace std
1026  
1027          static _Rep&
1028          _S_empty_rep()
1029 -        { return *reinterpret_cast<_Rep*>(&_S_empty_rep_storage); }
1030 +        {
1031 +#if __GNUC__ >= 4
1032 +         // Work around type-punning warning in g++4.  _S_empty_rep_storage
1033 +         // is never modified, so type-punning is ok.
1034 +         void* __p = reinterpret_cast<void*>(&_S_empty_rep_storage);
1035 +         return *reinterpret_cast<_Rep*>(__p);
1036 +#else
1037 +         return *reinterpret_cast<_Rep*>(&_S_empty_rep_storage);
1038 +#endif
1039 +        }
1040  
1041          bool
1042         _M_is_leaked() const
1043 --- libstdc++-v3/include/bits/stl_tree.h.jj     2007-02-23 21:29:15.000000000 +0100
1044 +++ libstdc++-v3/include/bits/stl_tree.h        2007-07-19 13:18:28.000000000 +0200
1045 @@ -532,6 +532,12 @@ namespace std
1046        iterator
1047        _M_insert(_Base_ptr __x, _Base_ptr __y, const value_type& __v);
1048  
1049 +#if __GNUC__ >= 4
1050 +      const_iterator
1051 +      _M_insert(_Const_Base_ptr __x, _Const_Base_ptr __y,
1052 +               const value_type& __v);
1053 +#endif
1054 +
1055        _Link_type
1056        _M_copy(_Const_Link_type __x, _Link_type __p);
1057  
1058 @@ -631,9 +637,19 @@ namespace std
1059        iterator
1060        insert_unique(iterator __position, const value_type& __x);
1061  
1062 +#if __GNUC__ >= 4
1063 +      const_iterator
1064 +      insert_unique(const_iterator __position, const value_type& __x);
1065 +#endif
1066 +
1067        iterator
1068        insert_equal(iterator __position, const value_type& __x);
1069  
1070 +#if __GNUC__ >= 4
1071 +      const_iterator
1072 +      insert_equal(const_iterator __position, const value_type& __x);
1073 +#endif
1074 +
1075        template<typename _InputIterator>
1076        void
1077        insert_unique(_InputIterator __first, _InputIterator __last);
1078 @@ -645,12 +661,22 @@ namespace std
1079        void
1080        erase(iterator __position);
1081  
1082 +#if __GNUC__ >= 4
1083 +      void
1084 +      erase(const_iterator __position);
1085 +#endif
1086 +
1087        size_type
1088        erase(const key_type& __x);
1089  
1090        void
1091        erase(iterator __first, iterator __last);
1092  
1093 +#if __GNUC__ >= 4
1094 +      void
1095 +      erase(const_iterator __first, const_iterator __last);
1096 +#endif
1097 +
1098        void
1099        erase(const key_type* __first, const key_type* __last);
1100  
1101 @@ -793,6 +819,28 @@ namespace std
1102        return iterator(__z);
1103      }
1104  
1105 +#if __GNUC__ >= 4
1106 +  template<typename _Key, typename _Val, typename _KeyOfValue,
1107 +           typename _Compare, typename _Alloc>
1108 +    typename _Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>::const_iterator
1109 +    _Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>::
1110 +    _M_insert(_Const_Base_ptr __x, _Const_Base_ptr __p, const _Val& __v)
1111 +    {
1112 +      _Link_type __z = _M_create_node(__v);
1113 +      bool __insert_left;
1114 +
1115 +      __insert_left = __x != 0 || __p == _M_end()
1116 +                     || _M_impl._M_key_compare(_KeyOfValue()(__v), 
1117 +                                               _S_key(__p));
1118 +
1119 +      _Rb_tree_insert_and_rebalance(__insert_left, __z,
1120 +                                   const_cast<_Base_ptr>(__p),  
1121 +                                   this->_M_impl._M_header);
1122 +      ++_M_impl._M_node_count;
1123 +      return const_iterator(__z);
1124 +    }
1125 +#endif
1126 +
1127    template<typename _Key, typename _Val, typename _KeyOfValue,
1128             typename _Compare, typename _Alloc>
1129      typename _Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>::iterator
1130 @@ -928,6 +976,54 @@ namespace std
1131         }
1132      }
1133  
1134 +#if __GNUC__ >= 4
1135 +  template<typename _Key, typename _Val, typename _KeyOfValue,
1136 +           typename _Compare, typename _Alloc>
1137 +    typename _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::const_iterator
1138 +    _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::
1139 +    insert_unique(const_iterator __position, const _Val& __v)
1140 +    {
1141 +      if (__position._M_node == _M_leftmost())
1142 +       {
1143 +         // begin()
1144 +         if (size() > 0
1145 +             && _M_impl._M_key_compare(_KeyOfValue()(__v), 
1146 +                                       _S_key(__position._M_node)))
1147 +           return _M_insert(__position._M_node, __position._M_node, __v);
1148 +         // First argument just needs to be non-null.
1149 +         else
1150 +           return const_iterator(insert_unique(__v).first);
1151 +       }
1152 +      else if (__position._M_node == _M_end())
1153 +       {
1154 +         // end()
1155 +         if (_M_impl._M_key_compare(_S_key(_M_rightmost()), 
1156 +                                    _KeyOfValue()(__v)))
1157 +           return _M_insert(0, _M_rightmost(), __v);
1158 +         else
1159 +           return const_iterator(insert_unique(__v).first);
1160 +       }
1161 +      else
1162 +       {
1163 +         const_iterator __before = __position;
1164 +         --__before;
1165 +         if (_M_impl._M_key_compare(_S_key(__before._M_node), 
1166 +                                    _KeyOfValue()(__v))
1167 +             && _M_impl._M_key_compare(_KeyOfValue()(__v),
1168 +                                       _S_key(__position._M_node)))
1169 +           {
1170 +             if (_S_right(__before._M_node) == 0)
1171 +               return _M_insert(0, __before._M_node, __v);
1172 +             else
1173 +               return _M_insert(__position._M_node, __position._M_node, __v);
1174 +             // First argument just needs to be non-null.
1175 +           }
1176 +         else
1177 +           return const_iterator(insert_unique(__v).first);
1178 +       }
1179 +    }
1180 +#endif
1181 +
1182    template<typename _Key, typename _Val, typename _KeyOfValue,
1183             typename _Compare, typename _Alloc>
1184      typename _Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>::iterator
1185 @@ -974,6 +1070,54 @@ namespace std
1186         }
1187      }
1188  
1189 +#if __GNUC__ >= 4
1190 +  template<typename _Key, typename _Val, typename _KeyOfValue,
1191 +           typename _Compare, typename _Alloc>
1192 +    typename _Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>::const_iterator
1193 +    _Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>::
1194 +    insert_equal(const_iterator __position, const _Val& __v)
1195 +    {
1196 +      if (__position._M_node == _M_leftmost())
1197 +       {
1198 +         // begin()
1199 +         if (size() > 0
1200 +             && !_M_impl._M_key_compare(_S_key(__position._M_node),
1201 +                                        _KeyOfValue()(__v)))
1202 +           return _M_insert(__position._M_node, __position._M_node, __v);
1203 +         // first argument just needs to be non-null
1204 +         else
1205 +           return const_iterator(insert_equal(__v));
1206 +       }
1207 +      else if (__position._M_node == _M_end())
1208 +       {
1209 +         // end()
1210 +         if (!_M_impl._M_key_compare(_KeyOfValue()(__v), 
1211 +                                     _S_key(_M_rightmost())))
1212 +           return _M_insert(0, _M_rightmost(), __v);
1213 +         else
1214 +           return const_iterator(insert_equal(__v));
1215 +       }
1216 +      else
1217 +       {
1218 +         const_iterator __before = __position;
1219 +         --__before;
1220 +         if (!_M_impl._M_key_compare(_KeyOfValue()(__v), 
1221 +                                     _S_key(__before._M_node))
1222 +             && !_M_impl._M_key_compare(_S_key(__position._M_node),
1223 +                                        _KeyOfValue()(__v)))
1224 +           {
1225 +             if (_S_right(__before._M_node) == 0)
1226 +               return _M_insert(0, __before._M_node, __v);
1227 +             else
1228 +               return _M_insert(__position._M_node, __position._M_node, __v);
1229 +             // First argument just needs to be non-null.
1230 +           }
1231 +         else
1232 +           return const_iterator(insert_equal(__v));
1233 +       }
1234 +    }
1235 +#endif
1236 +
1237    template<typename _Key, typename _Val, typename _KoV,
1238             typename _Cmp, typename _Alloc>
1239      template<class _II>
1240 @@ -1008,6 +1152,20 @@ namespace std
1241        --_M_impl._M_node_count;
1242      }
1243  
1244 +#if __GNUC__ >= 4
1245 +  template<typename _Key, typename _Val, typename _KeyOfValue,
1246 +           typename _Compare, typename _Alloc>
1247 +    inline void
1248 +    _Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>::erase(const_iterator __position)
1249 +    {
1250 +      _Link_type __y =
1251 +       static_cast<_Link_type>(_Rb_tree_rebalance_for_erase(const_cast<_Base_ptr>(__position._M_node),
1252 +                                                            this->_M_impl._M_header));
1253 +      destroy_node(__y);
1254 +      --_M_impl._M_node_count;
1255 +    }
1256 +#endif
1257 +
1258    template<typename _Key, typename _Val, typename _KeyOfValue,
1259             typename _Compare, typename _Alloc>
1260      typename _Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>::size_type
1261 @@ -1082,6 +1240,20 @@ namespace std
1262         while (__first != __last) erase(__first++);
1263      }
1264  
1265 +#if __GNUC__ >= 4
1266 +  template<typename _Key, typename _Val, typename _KeyOfValue,
1267 +           typename _Compare, typename _Alloc>
1268 +    void
1269 +    _Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>::
1270 +    erase(const_iterator __first, const_iterator __last)
1271 +    {
1272 +      if (__first == begin() && __last == end())
1273 +       clear();
1274 +      else
1275 +       while (__first != __last) erase(__first++);
1276 +    }
1277 +#endif
1278 +
1279    template<typename _Key, typename _Val, typename _KeyOfValue,
1280             typename _Compare, typename _Alloc>
1281      void
1282 --- libstdc++-v3/include/bits/stl_multiset.h.jj 2007-02-23 21:29:15.000000000 +0100
1283 +++ libstdc++-v3/include/bits/stl_multiset.h    2007-07-19 12:30:47.000000000 +0200
1284 @@ -328,8 +328,12 @@ namespace _GLIBCXX_STD
1285        iterator
1286        insert(iterator __position, const value_type& __x)
1287        {
1288 +#if __GNUC__ >= 4
1289 +       return _M_t.insert_equal(__position, __x);
1290 +#else
1291         typedef typename _Rep_type::iterator _Rep_iterator;
1292         return _M_t.insert_equal((_Rep_iterator&)__position, __x);
1293 +#endif
1294        }
1295  
1296        /**
1297 @@ -358,8 +362,12 @@ namespace _GLIBCXX_STD
1298        void
1299        erase(iterator __position)
1300        {
1301 +#if __GNUC__ >= 4
1302 +       _M_t.erase(__position);
1303 +#else
1304         typedef typename _Rep_type::iterator _Rep_iterator;
1305         _M_t.erase((_Rep_iterator&)__position);
1306 +#endif
1307        }
1308  
1309        /**
1310 @@ -391,8 +399,12 @@ namespace _GLIBCXX_STD
1311        void
1312        erase(iterator __first, iterator __last)
1313        {
1314 +#if __GNUC__ >= 4
1315 +       _M_t.erase(__first, __last);
1316 +#else
1317         typedef typename _Rep_type::iterator _Rep_iterator;
1318         _M_t.erase((_Rep_iterator&)__first, (_Rep_iterator&)__last);
1319 +#endif
1320        }
1321  
1322        /**
1323 --- libstdc++-v3/include/bits/stl_set.h.jj      2007-02-23 21:29:15.000000000 +0100
1324 +++ libstdc++-v3/include/bits/stl_set.h 2007-07-19 12:23:57.000000000 +0200
1325 @@ -337,8 +337,12 @@ namespace _GLIBCXX_STD
1326        iterator
1327        insert(iterator __position, const value_type& __x)
1328        {
1329 +#if __GNUC__ >= 4
1330 +       return _M_t.insert_unique(__position, __x);
1331 +#else
1332         typedef typename _Rep_type::iterator _Rep_iterator;
1333         return _M_t.insert_unique((_Rep_iterator&)__position, __x);
1334 +#endif
1335        }
1336  
1337        /**
1338 @@ -366,8 +370,12 @@ namespace _GLIBCXX_STD
1339        void
1340        erase(iterator __position)
1341        {
1342 +#if __GNUC__ >= 4
1343 +       _M_t.erase(__position);
1344 +#else
1345         typedef typename _Rep_type::iterator _Rep_iterator;
1346         _M_t.erase((_Rep_iterator&)__position);
1347 +#endif
1348        }
1349  
1350        /**
1351 @@ -398,8 +406,12 @@ namespace _GLIBCXX_STD
1352        void
1353        erase(iterator __first, iterator __last)
1354        {
1355 +#if __GNUC__ >= 4
1356 +       _M_t.erase(__first, __last);
1357 +#else
1358         typedef typename _Rep_type::iterator _Rep_iterator;
1359         _M_t.erase((_Rep_iterator&)__first, (_Rep_iterator&)__last);
1360 +#endif
1361        }
1362  
1363        /**
1364 2006-02-27  Jakub Jelinek  <jakub@redhat.com>
1365
1366         PR other/26208
1367         * unwind-dw2.c (struct _Unwind_Context): Add signal_frame field.
1368         (_Unwind_FrameState): Add signal_frame field.
1369         (extract_cie_info): Handle S flag in augmentation string.
1370         (execute_cfa_program): If context->signal_frame, execute also
1371         fs->pc == context->ra instructions.
1372         (uw_frame_state_for): If context->signal_frame, don't subtract one
1373         from context->ra to find FDE.
1374         (uw_update_context_1): Set context->signal_frame to
1375         fs->signal_frame.
1376         (_Unwind_GetIPInfo): New function.
1377         * unwind-c.c (PERSONALITY_FUNCTION): Use _Unwind_GetIPInfo instead
1378         of _Unwind_GetIP.
1379         * unwind-sjlj.c (_Unwind_GetIPInfo): New function.
1380         * unwind.h (_Unwind_GetIPInfo): New prototype.
1381         * unwind-compat.c (_Unwind_GetIPInfo): New function.
1382         * libgcc-std.ver (_Unwind_GetIPInfo): Export @@GCC_4.2.0.
1383         * config/ia64/unwind-ia64.c (_Unwind_GetIPInfo): New function.
1384         * config/i386/linux.h (MD_FALLBACK_FRAME_STATE_FOR): Set
1385         (FS)->signal_frame.
1386         * config/i386/linux64.h (MD_FALLBACK_FRAME_STATE_FOR): Likewise.
1387         * config/rs6000/linux-unwind.h (MD_FALLBACK_FRAME_STATE_FOR): Likewise.
1388         * config/s390/linux.h (MD_FALLBACK_FRAME_STATE_FOR): Likewise.
1389
1390         * libsupc++/eh_personality.cc (PERSONALITY_FUNCTION): Use
1391         _Unwind_GetIPInfo instead of _Unwind_GetIP.
1392
1393         * exception.cc (PERSONALITY_FUNCTION): Use _Unwind_GetIPInfo instead
1394         of _Unwind_GetIP.
1395         * include/i386-signal.h (MAKE_THROW_FRAME): Change into empty macro.
1396         (HANDLE_DIVIDE_OVERFLOW): Don't adjust _res->eip if falling through
1397         to throw.
1398         * include/x86_64-signal.h (MAKE_THROW_FRAME): Change into empty
1399         macro.
1400         * include/powerpc-signal.h (MAKE_THROW_FRAME): Change into empty
1401         macro.
1402
1403 --- libjava/exception.cc.jj     2005-11-21 14:47:25.000000000 +0100
1404 +++ libjava/exception.cc        2006-04-21 14:00:19.000000000 +0200
1405 @@ -199,6 +199,7 @@ PERSONALITY_FUNCTION (int version,
1406    int handler_switch_value;
1407    bool saw_cleanup;
1408    bool saw_handler;
1409 +  int ip_before_insn = 0;
1410  
1411  
1412    // Interface version check.
1413 @@ -214,10 +215,10 @@ PERSONALITY_FUNCTION (int version,
1414        goto install_context;
1415      }
1416  
1417 -  // FIXME: In Phase 1, record _Unwind_GetIP in xh->obj as a part of
1418 +  // FIXME: In Phase 1, record _Unwind_GetIPInfo in xh->obj as a part of
1419    // the stack trace for this exception.  This will only collect Java
1420    // frames, but perhaps that is acceptable.
1421 -  // FIXME2: _Unwind_GetIP is nonsensical for SJLJ, being a call-site
1422 +  // FIXME2: _Unwind_GetIPInfo is nonsensical for SJLJ, being a call-site
1423    // index instead of a PC value.  We could perhaps arrange for
1424    // _Unwind_GetRegionStart to return context->fc->jbuf[1], which
1425    // is the address of the handler label for __builtin_longjmp, but
1426 @@ -232,7 +233,9 @@ PERSONALITY_FUNCTION (int version,
1427  
1428    // Parse the LSDA header.
1429    p = parse_lsda_header (context, language_specific_data, &info);
1430 -  ip = _Unwind_GetIP (context) - 1;
1431 +  ip = _Unwind_GetIPInfo (context, &ip_before_insn);
1432 +  if (! ip_before_insn)
1433 +    --ip;
1434    landing_pad = 0;
1435    action_record = 0;
1436    handler_switch_value = 0;
1437 --- libjava/include/i386-signal.h.jj    2005-11-21 14:47:15.000000000 +0100
1438 +++ libjava/include/i386-signal.h       2006-04-21 14:57:55.000000000 +0200
1439 @@ -22,19 +22,7 @@ details.  */
1440  #define SIGNAL_HANDLER(_name)  \
1441  static void _name (int _dummy)
1442  
1443 -#define MAKE_THROW_FRAME(_exception)                                   \
1444 -do                                                                     \
1445 -{                                                                      \
1446 -  void **_p = (void **)&_dummy;                                                \
1447 -  struct sigcontext_struct *_regs = (struct sigcontext_struct *)++_p;  \
1448 -                                                                       \
1449 -  /* Advance the program counter so that it is after the start of the  \
1450 -     instruction:  the x86 exception handler expects                   \
1451 -     the PC to point to the instruction after a call. */               \
1452 -  _regs->eip += 2;                                                     \
1453 -                                                                       \
1454 -}                                                                      \
1455 -while (0)
1456 +#define MAKE_THROW_FRAME(_exception)
1457  
1458  #define HANDLE_DIVIDE_OVERFLOW                                         \
1459  do                                                                     \
1460 @@ -84,14 +72,6 @@ do                                                                   \
1461           _regs->eip = (unsigned long)_eip;                             \
1462           return;                                                       \
1463         }                                                               \
1464 -      else                                                             \
1465 -       {                                                               \
1466 -         /* Advance the program counter so that it is after the start  \
1467 -            of the instruction: this is because the x86 exception      \
1468 -            handler expects the PC to point to the instruction after a \
1469 -            call. */                                                   \
1470 -         _regs->eip += 2;                                              \
1471 -       }                                                               \
1472      }                                                                  \
1473  }                                                                      \
1474  while (0)
1475 --- libjava/include/x86_64-signal.h.jj  2006-04-20 17:02:27.000000000 +0200
1476 +++ libjava/include/x86_64-signal.h     2006-04-21 14:00:19.000000000 +0200
1477 @@ -34,17 +34,7 @@ extern "C" 
1478    };
1479  }
1480  
1481 -#define MAKE_THROW_FRAME(_exception)                                        \
1482 -do                                                                          \
1483 -{                                                                           \
1484 -  /* Advance the program counter so that it is after the start of the       \
1485 -     instruction:  the x86_64 exception handler expects                             \
1486 -     the PC to point to the instruction after a call. */                    \
1487 -  struct ucontext *_uc = (struct ucontext *)_p;                                     \
1488 -  volatile struct sigcontext *_sc = (struct sigcontext *) &_uc->uc_mcontext; \
1489 -  _sc->rip += 2;                                                            \
1490 -}                                                                           \
1491 -while (0)
1492 +#define MAKE_THROW_FRAME(_exception)
1493  
1494  #define RESTORE(name, syscall) RESTORE2 (name, syscall)
1495  #define RESTORE2(name, syscall)                        \
1496 --- libjava/include/powerpc-signal.h.jj 2005-11-21 14:47:15.000000000 +0100
1497 +++ libjava/include/powerpc-signal.h    2006-04-21 14:00:19.000000000 +0200
1498 @@ -22,18 +22,12 @@ details.  */
1499  #define SIGNAL_HANDLER(_name)                                          \
1500    static void _name (int /* _signal */, struct sigcontext *_sc)
1501  
1502 -/* PPC either leaves PC pointing at a faulting instruction or the
1503 -   following instruction, depending on the signal.  SEGV always does
1504 -   the former, so we adjust the saved PC to point to the following
1505 -   instruction. This is what the handler in libgcc expects.  */
1506 +/* MD_FALBACK_FRAME_STATE_FOR takes care of special casing PC
1507 +   before the faulting instruction, so we don't need to do anything
1508 +   here.  */
1509 +
1510 +#define MAKE_THROW_FRAME(_exception)
1511  
1512 -#define MAKE_THROW_FRAME(_exception)                                   \
1513 -do                                                                     \
1514 -  {                                                                    \
1515 -    _sc->regs->nip += 4;                                               \
1516 -  }                                                                    \
1517 -while (0)
1518 -  
1519  /* For an explanation why we cannot simply use sigaction to
1520     install the handlers, see i386-signal.h.  */
1521  
1522 --- libstdc++-v3/libsupc++/eh_personality.cc.jj 2005-11-21 14:43:32.000000000 +0100
1523 +++ libstdc++-v3/libsupc++/eh_personality.cc    2006-04-21 14:24:34.000000000 +0200
1524 @@ -201,6 +201,7 @@ PERSONALITY_FUNCTION (int version,
1525    _Unwind_Ptr landing_pad, ip;
1526    int handler_switch_value;
1527    void *thrown_ptr = xh + 1;
1528 +  int ip_before_insn = 0;
1529  
1530    // Interface version check.
1531    if (version != 1)
1532 @@ -227,7 +228,9 @@ PERSONALITY_FUNCTION (int version,
1533    // Parse the LSDA header.
1534    p = parse_lsda_header (context, language_specific_data, &info);
1535    info.ttype_base = base_of_encoded_value (info.ttype_encoding, context);
1536 -  ip = _Unwind_GetIP (context) - 1;
1537 +  ip = _Unwind_GetIPInfo (context, &ip_before_insn);
1538 +  if (! ip_before_insn)
1539 +    --ip;
1540    landing_pad = 0;
1541    action_record = 0;
1542    handler_switch_value = 0;
1543 --- gcc/libgcc-std.ver.jj       2005-11-21 14:43:21.000000000 +0100
1544 +++ gcc/libgcc-std.ver  2006-04-21 14:02:13.000000000 +0200
1545 @@ -234,3 +234,8 @@ GCC_3.4.4 {
1546    __negvti2
1547    __subvti3
1548  }
1549 +
1550 +%inherit GCC_4.2.0 GCC_3.4.4
1551 +GCC_4.2.0 {
1552 +  _Unwind_GetIPInfo
1553 +}
1554 --- gcc/unwind-c.c.jj   2005-11-21 14:43:20.000000000 +0100
1555 +++ gcc/unwind-c.c      2006-04-21 14:00:08.000000000 +0200
1556 @@ -102,6 +102,7 @@ PERSONALITY_FUNCTION (int version,
1557    lsda_header_info info;
1558    const unsigned char *language_specific_data, *p, *action_record;
1559    _Unwind_Ptr landing_pad, ip;
1560 +  int ip_before_insn = 0;
1561  
1562    if (version != 1)
1563      return _URC_FATAL_PHASE1_ERROR;
1564 @@ -119,7 +120,9 @@ PERSONALITY_FUNCTION (int version,
1565  
1566    /* Parse the LSDA header.  */
1567    p = parse_lsda_header (context, language_specific_data, &info);
1568 -  ip = _Unwind_GetIP (context) - 1;
1569 +  ip = _Unwind_GetIPInfo (context, &ip_before_insn);
1570 +  if (! ip_before_insn)
1571 +    --ip;
1572    landing_pad = 0;
1573  
1574  #ifdef __USING_SJLJ_EXCEPTIONS__
1575 --- gcc/config/s390/linux.h.jj  2005-11-21 14:40:55.000000000 +0100
1576 +++ gcc/config/s390/linux.h     2006-04-21 14:15:46.000000000 +0200
1577 @@ -113,6 +113,7 @@ Software Foundation, 59 Temple Place - S
1578        } __attribute__ ((__aligned__ (8))) sigregs_;                    \
1579                                                                         \
1580      sigregs_ *regs_;                                                   \
1581 +    int *signo_ = NULL;                                                        \
1582                                                                         \
1583      /* svc $__NR_sigreturn or svc $__NR_rt_sigreturn  */               \
1584      if (pc_[0] != 0x0a || (pc_[1] != 119 && pc_[1] != 173))            \
1585 @@ -133,6 +134,7 @@ Software Foundation, 59 Temple Place - S
1586           } *uc_ = (CONTEXT)->cfa + 8 + 128;                            \
1587                                                                         \
1588         regs_ = &uc_->uc_mcontext;                                      \
1589 +       signo_ = (CONTEXT)->cfa + sizeof(long);                         \
1590        }                                                                        \
1591                                                                         \
1592      /* Old-style RT frame and all non-RT frames:                       \
1593 @@ -141,6 +143,11 @@ Software Foundation, 59 Temple Place - S
1594      else                                                               \
1595        {                                                                        \
1596         regs_ = *(sigregs_ **)((CONTEXT)->cfa + 8);                     \
1597 +       /* Recent kernels store the signal number immediately after     \
1598 +          the sigregs; old kernels have the return trampoline at       \
1599 +          this location.  */                                           \
1600 +       if ((void *)(regs_ + 1) != (CONTEXT)->ra)                       \
1601 +         signo_ = (int *)(regs_ + 1);                                  \
1602        }                                                                        \
1603                                                                         \
1604      new_cfa_ = regs_->gprs[15] + 16*sizeof(long) + 32;                 \
1605 @@ -167,6 +174,12 @@ Software Foundation, 59 Temple Place - S
1606      (FS)->regs.reg[32].loc.offset = (long)&regs_->psw_addr - new_cfa_; \
1607      (FS)->retaddr_column = 32;                                         \
1608                                                                         \
1609 +    /* SIGILL, SIGFPE and SIGTRAP are delivered with psw_addr          \
1610 +       after the faulting instruction rather than before it.           \
1611 +       Don't set FS->signal_frame in that case.  */                    \
1612 +    if (!signo_ || (*signo_ != 4 && *signo_ != 5 && *signo_ != 8))     \
1613 +      (FS)->signal_frame = 1;                                          \
1614 +                                                                       \
1615      goto SUCCESS;                                                      \
1616    } while (0)
1617  
1618 --- gcc/config/i386/linux.h.jj  2005-11-21 14:41:07.000000000 +0100
1619 +++ gcc/config/i386/linux.h     2006-04-21 14:18:05.000000000 +0200
1620 @@ -268,6 +268,7 @@ Boston, MA 02111-1307, USA.  */
1621      (FS)->regs.reg[8].how = REG_SAVED_OFFSET;                          \
1622      (FS)->regs.reg[8].loc.offset = (long)&sc_->eip - new_cfa_;         \
1623      (FS)->retaddr_column = 8;                                          \
1624 +    (FS)->signal_frame = 1;                                            \
1625      goto SUCCESS;                                                      \
1626    } while (0)
1627  #endif /* not USE_GNULIBC_1 */
1628 --- gcc/config/i386/linux64.h.jj        2005-11-21 14:41:07.000000000 +0100
1629 +++ gcc/config/i386/linux64.h   2006-04-21 14:18:45.000000000 +0200
1630 @@ -136,6 +136,7 @@ Boston, MA 02111-1307, USA.  */
1631      (FS)->regs.reg[16].how = REG_SAVED_OFFSET;                         \
1632      (FS)->regs.reg[16].loc.offset = (long)&sc_->rip - new_cfa_;                \
1633      (FS)->retaddr_column = 16;                                         \
1634 +    (FS)->signal_frame = 1;                                            \
1635      goto SUCCESS;                                                      \
1636    } while (0)
1637  #else /* ifdef __x86_64__  */
1638 @@ -190,6 +191,7 @@ Boston, MA 02111-1307, USA.  */
1639      (FS)->regs.reg[8].how = REG_SAVED_OFFSET;                          \
1640      (FS)->regs.reg[8].loc.offset = (long)&sc_->eip - new_cfa_;         \
1641      (FS)->retaddr_column = 8;                                          \
1642 +    (FS)->signal_frame = 1;                                            \
1643      goto SUCCESS;                                                      \
1644    } while (0)
1645  #endif /* ifdef __x86_64__  */
1646 --- gcc/config/ia64/unwind-ia64.c.jj    2005-11-21 14:40:57.000000000 +0100
1647 +++ gcc/config/ia64/unwind-ia64.c       2006-04-21 14:00:11.000000000 +0200
1648 @@ -1748,6 +1748,13 @@ _Unwind_GetIP (struct _Unwind_Context *c
1649    return context->rp;
1650  }
1651  
1652 +inline _Unwind_Ptr
1653 +_Unwind_GetIPInfo (struct _Unwind_Context *context, int *ip_before_insn)
1654 +{
1655 +  *ip_before_insn = 0;
1656 +  return context->rp;
1657 +}
1658 +
1659  /* Overwrite the return address for CONTEXT with VAL.  */
1660  
1661  inline void
1662 --- gcc/unwind-compat.c.jj      2005-11-21 14:43:20.000000000 +0100
1663 +++ gcc/unwind-compat.c 2006-04-21 13:59:59.000000000 +0200
1664 @@ -134,6 +134,13 @@ _Unwind_GetIP (struct _Unwind_Context *c
1665  }
1666  symver (_Unwind_GetIP, GCC_3.0);
1667  
1668 +_Unwind_Ptr
1669 +_Unwind_GetIPInfo (struct _Unwind_Context *context, int *ip_before_insn)
1670 +{
1671 +  *ip_before_insn = 0;
1672 +  return __libunwind_Unwind_GetIP (context);
1673 +}
1674 +
1675  extern void *__libunwind_Unwind_GetLanguageSpecificData
1676    (struct _Unwind_Context *);
1677  
1678 --- gcc/unwind-sjlj.c.jj        2005-11-21 14:43:21.000000000 +0100
1679 +++ gcc/unwind-sjlj.c   2006-04-21 14:00:08.000000000 +0200
1680 @@ -202,6 +202,13 @@ _Unwind_GetIP (struct _Unwind_Context *c
1681    return context->fc->call_site + 1;
1682  }
1683  
1684 +_Unwind_Ptr
1685 +_Unwind_GetIPInfo (struct _Unwind_Context *context, int *ip_before_insn)
1686 +{
1687 +  *ip_before_insn = 0;
1688 +  return context->fc->call_site + 1;
1689 +}
1690 +
1691  /* Set the return landing pad index in CONTEXT.  */
1692  
1693  void
1694 --- gcc/unwind.h.jj     2005-11-21 14:43:20.000000000 +0100
1695 +++ gcc/unwind.h        2006-04-21 14:08:51.000000000 +0200
1696 @@ -151,6 +151,7 @@ extern _Unwind_Word _Unwind_GetGR (struc
1697  extern void _Unwind_SetGR (struct _Unwind_Context *, int, _Unwind_Word);
1698  
1699  extern _Unwind_Ptr _Unwind_GetIP (struct _Unwind_Context *);
1700 +extern _Unwind_Ptr _Unwind_GetIPInfo (struct _Unwind_Context *, int *);
1701  extern void _Unwind_SetIP (struct _Unwind_Context *, _Unwind_Ptr);
1702  
1703  /* @@@ Retrieve the CFA of the given context.  */
1704 --- gcc/unwind-dw2.c.jj 2005-11-21 14:43:21.000000000 +0100
1705 +++ gcc/unwind-dw2.c    2006-04-21 14:05:32.000000000 +0200
1706 @@ -82,6 +82,7 @@ struct _Unwind_Context
1707    void *lsda;
1708    struct dwarf_eh_bases bases;
1709    _Unwind_Word args_size;
1710 +  char signal_frame;
1711  };
1712  
1713  /* Byte size of every register managed by these routines.  */
1714 @@ -137,6 +138,7 @@ typedef struct
1715    unsigned char fde_encoding;
1716    unsigned char lsda_encoding;
1717    unsigned char saw_z;
1718 +  unsigned char signal_frame;
1719    void *eh_ptr;
1720  } _Unwind_FrameState;
1721  \f
1722 @@ -271,6 +273,16 @@ _Unwind_GetIP (struct _Unwind_Context *c
1723    return (_Unwind_Ptr) context->ra;
1724  }
1725  
1726 +/* Retrieve the return address and flag whether that IP is before
1727 +   or after first not yet fully executed instruction.  */
1728 +
1729 +inline _Unwind_Ptr
1730 +_Unwind_GetIPInfo (struct _Unwind_Context *context, int *ip_before_insn)
1731 +{
1732 +  *ip_before_insn = context->signal_frame != 0;
1733 +  return (_Unwind_Ptr) context->ra;
1734 +}
1735 +
1736  /* Overwrite the return address for CONTEXT with VAL.  */
1737  
1738  inline void
1739 @@ -382,6 +394,13 @@ extract_cie_info (const struct dwarf_cie
1740           aug += 1;
1741         }
1742  
1743 +      /* "S" indicates a signal frame.  */
1744 +      else if (aug[0] == 'S')
1745 +       {
1746 +         fs->signal_frame = 1;
1747 +         aug += 1;
1748 +       }
1749 +
1750        /* Otherwise we have an unknown augmentation string.
1751          Bail unless we saw a 'z' prefix.  */
1752        else
1753 @@ -818,8 +837,10 @@ execute_cfa_program (const unsigned char
1754       a different stack configuration that we are not interested in.  We
1755       assume that the call itself is unwind info-neutral; if not, or if
1756       there are delay instructions that adjust the stack, these must be
1757 -     reflected at the point immediately before the call insn.  */
1758 -  while (insn_ptr < insn_end && fs->pc < context->ra)
1759 +     reflected at the point immediately before the call insn.
1760 +     In signal frames, return address is after last completed instruction,
1761 +     so we add 1 to return address to make the comparison <=.  */
1762 +  while (insn_ptr < insn_end && fs->pc < context->ra + context->signal_frame)
1763      {
1764        unsigned char insn = *insn_ptr++;
1765        _Unwind_Word reg, utmp;
1766 @@ -1021,7 +1042,8 @@ uw_frame_state_for (struct _Unwind_Conte
1767    if (context->ra == 0)
1768      return _URC_END_OF_STACK;
1769  
1770 -  fde = _Unwind_Find_FDE (context->ra - 1, &context->bases);
1771 +  fde = _Unwind_Find_FDE (context->ra + context->signal_frame - 1,
1772 +                         &context->bases);
1773    if (fde == NULL)
1774      {
1775        /* Couldn't find frame unwind info for this function.  Try a
1776 @@ -1376,6 +1398,8 @@ uw_update_context_1 (struct _Unwind_Cont
1777         break;
1778        }
1779  
1780 +  context->signal_frame = fs->signal_frame;
1781 +
1782    MD_FROB_UPDATE_CONTEXT (context, fs);
1783  }
1784  
1785 --- gcc/unwind-dw2.c.jj 2006-05-22 13:39:48.000000000 -0400
1786 +++ gcc/unwind-dw2.c    2006-05-22 13:48:20.000000000 -0400
1787 @@ -40,6 +40,7 @@
1788  #include "unwind-pe.h"
1789  #include "unwind-dw2-fde.h"
1790  #include "gthr.h"
1791 +#include <endian.h>
1792  
1793  
1794  #ifndef __USING_SJLJ_EXCEPTIONS__
1795 @@ -81,8 +82,15 @@ struct _Unwind_Context
1796    void *ra;
1797    void *lsda;
1798    struct dwarf_eh_bases bases;
1799 -  _Unwind_Word args_size;
1800 -  char signal_frame;
1801 +#if __BYTE_ORDER == __BIG_ENDIAN
1802 +  _Unwind_Word signal_frame : 1;
1803 +  _Unwind_Word args_size : sizeof (_Unwind_Word) * 8 - 1;
1804 +#elif __BYTE_ORDER == __LITTLE_ENDIAN
1805 +  _Unwind_Word args_size : sizeof (_Unwind_Word) * 8 - 1;
1806 +  _Unwind_Word signal_frame : 1;
1807 +#else
1808 +#error Unknown endianity
1809 +#endif
1810  };
1811  
1812  /* Byte size of every register managed by these routines.  */
1813 @@ -1003,7 +1011,13 @@ execute_cfa_program (const unsigned char
1814           break;
1815  
1816         case DW_CFA_GNU_args_size:
1817 -         insn_ptr = read_uleb128 (insn_ptr, &context->args_size);
1818 +         {
1819 +           _Unwind_Word args_size;
1820 +           insn_ptr = read_uleb128 (insn_ptr, &args_size);
1821 +           context->args_size = args_size;
1822 +           if (context->args_size != args_size)
1823 +             abort ();
1824 +         }
1825           break;
1826  
1827         case DW_CFA_GNU_negative_offset_extended:
1828 --- libjava/exception.cc.jj     2006-05-22 13:39:48.000000000 -0400
1829 +++ libjava/exception.cc        2006-05-22 14:48:30.000000000 -0400
1830 @@ -31,6 +31,153 @@ namespace std
1831  }
1832  #include "unwind.h"
1833  
1834 +#if defined PIC && !defined __ia64__
1835 +
1836 +#include <dlfcn.h>
1837 +
1838 +extern "C" {
1839 +
1840 +static void *libgcc_s_handle;
1841 +
1842 +_Unwind_Reason_Code __attribute__((visibility ("hidden")))
1843 +_Unwind_RaiseException (struct _Unwind_Exception *exc)
1844 +{
1845 +  static _Unwind_Reason_Code (*RaiseException) (struct _Unwind_Exception *);
1846 +
1847 +  if (RaiseException == NULL)
1848 +    {
1849 +      if (libgcc_s_handle == NULL)
1850 +       libgcc_s_handle = dlopen ("libgcc_s.so.1", RTLD_LAZY);
1851 +      RaiseException = (__typeof (RaiseException))
1852 +       dlsym (libgcc_s_handle, "_Unwind_RaiseException");
1853 +    }
1854 +  return RaiseException (exc);
1855 +}
1856 +
1857 +void __attribute__((visibility ("hidden")))
1858 +_Unwind_Resume (struct _Unwind_Exception *exc)
1859 +{
1860 +  static void (*Resume) (struct _Unwind_Exception *);
1861 +
1862 +  if (Resume == NULL)
1863 +    {
1864 +      if (libgcc_s_handle == NULL)
1865 +       libgcc_s_handle = dlopen ("libgcc_s.so.1", RTLD_LAZY);
1866 +      Resume = (__typeof (Resume))
1867 +       dlsym (libgcc_s_handle, "_Unwind_Resume");
1868 +    }
1869 +  Resume (exc);
1870 +}
1871 +
1872 +__attribute__((visibility ("hidden"))) void * 
1873 +_Unwind_GetLanguageSpecificData (struct _Unwind_Context *ctx)
1874 +{
1875 +  static void * (*GetLanguageSpecificData) (struct _Unwind_Context *);
1876 +
1877 +  if (GetLanguageSpecificData == NULL)
1878 +    {
1879 +      if (libgcc_s_handle == NULL)
1880 +       libgcc_s_handle = dlopen ("libgcc_s.so.1", RTLD_LAZY);
1881 +      GetLanguageSpecificData = (__typeof (GetLanguageSpecificData))
1882 +       dlsym (libgcc_s_handle, "_Unwind_GetLanguageSpecificData");
1883 +    }
1884 +  return GetLanguageSpecificData (ctx);
1885 +}
1886 +
1887 +_Unwind_Ptr __attribute__((visibility ("hidden")))
1888 +_Unwind_GetRegionStart (struct _Unwind_Context *ctx)
1889 +{
1890 +  static _Unwind_Ptr (*GetRegionStart) (struct _Unwind_Context *);
1891 +
1892 +  if (GetRegionStart == NULL)
1893 +    {
1894 +      if (libgcc_s_handle == NULL)
1895 +       libgcc_s_handle = dlopen ("libgcc_s.so.1", RTLD_LAZY);
1896 +      GetRegionStart = (__typeof (GetRegionStart))
1897 +       dlsym (libgcc_s_handle, "_Unwind_GetRegionStart");
1898 +    }
1899 +  return GetRegionStart (ctx);
1900 +}
1901 +
1902 +_Unwind_Ptr __attribute__((visibility ("hidden")))
1903 +_Unwind_GetDataRelBase (struct _Unwind_Context *ctx)
1904 +{
1905 +  static _Unwind_Ptr (*GetDataRelBase) (struct _Unwind_Context *);
1906 +
1907 +  if (GetDataRelBase == NULL)
1908 +    {
1909 +      if (libgcc_s_handle == NULL)
1910 +       libgcc_s_handle = dlopen ("libgcc_s.so.1", RTLD_LAZY);
1911 +      GetDataRelBase = (__typeof (GetDataRelBase))
1912 +       dlsym (libgcc_s_handle, "_Unwind_GetDataRelBase");
1913 +    }
1914 +  return GetDataRelBase (ctx);
1915 +}
1916 +
1917 +_Unwind_Ptr __attribute__((visibility ("hidden")))
1918 +_Unwind_GetTextRelBase (struct _Unwind_Context *ctx)
1919 +{
1920 +  static _Unwind_Ptr (*GetTextRelBase) (struct _Unwind_Context *);
1921 +
1922 +  if (GetTextRelBase == NULL)
1923 +    {
1924 +      if (libgcc_s_handle == NULL)
1925 +       libgcc_s_handle = dlopen ("libgcc_s.so.1", RTLD_LAZY);
1926 +      GetTextRelBase = (__typeof (GetTextRelBase))
1927 +       dlsym (libgcc_s_handle, "_Unwind_GetTextRelBase");
1928 +    }
1929 +  return GetTextRelBase (ctx);
1930 +}
1931 +
1932 +_Unwind_Ptr __attribute__((visibility ("hidden")))
1933 +_Unwind_GetIPInfo (struct _Unwind_Context *ctx, int *ip)
1934 +{
1935 +  static _Unwind_Ptr (*GetIPInfo) (struct _Unwind_Context *, int *ip);
1936 +
1937 +  if (GetIPInfo == NULL)
1938 +    {
1939 +      if (libgcc_s_handle == NULL)
1940 +       libgcc_s_handle = dlopen ("libgcc_s.so.1", RTLD_LAZY);
1941 +      GetIPInfo = (__typeof (GetIPInfo))
1942 +       dlsym (libgcc_s_handle, "_Unwind_GetIPInfo");
1943 +    }
1944 +  return GetIPInfo (ctx, ip);
1945 +}
1946 +
1947 +void __attribute__((visibility ("hidden")))
1948 +_Unwind_SetIP (struct _Unwind_Context *ctx, _Unwind_Ptr ip)
1949 +{
1950 +  static void (*SetIP) (struct _Unwind_Context *, _Unwind_Ptr ip);
1951 +
1952 +  if (SetIP == NULL)
1953 +    {
1954 +      if (libgcc_s_handle == NULL)
1955 +       libgcc_s_handle = dlopen ("libgcc_s.so.1", RTLD_LAZY);
1956 +      SetIP = (__typeof (SetIP))
1957 +       dlsym (libgcc_s_handle, "_Unwind_SetIP");
1958 +    }
1959 +  SetIP (ctx, ip);
1960 +}
1961 +
1962 +void __attribute__((visibility ("hidden")))
1963 +_Unwind_SetGR (struct _Unwind_Context *ctx, int num, _Unwind_Ptr gr)
1964 +{
1965 +  static void (*SetGR) (struct _Unwind_Context *, int num, _Unwind_Ptr gr);
1966 +
1967 +  if (SetGR == NULL)
1968 +    {
1969 +      if (libgcc_s_handle == NULL)
1970 +       libgcc_s_handle = dlopen ("libgcc_s.so.1", RTLD_LAZY);
1971 +      SetGR = (__typeof (SetGR))
1972 +       dlsym (libgcc_s_handle, "_Unwind_SetGR");
1973 +    }
1974 +  SetGR (ctx, num, gr);
1975 +}
1976 +
1977 +}
1978 +
1979 +#endif
1980 +
1981  struct alignment_test_struct
1982  {
1983    char space;
1984 2005-05-08  Roger Sayle  <roger@eyesopen.com>
1985
1986         PR inline-asm/8788
1987         * stmt.c (expand_asm_operands): Avoid calling force_reg on BLKmode
1988         operands.
1989
1990         * gcc.dg/pr8788-1.c: New testcase.
1991
1992 --- gcc/stmt.c  (revision 99421)
1993 +++ gcc/stmt.c  (revision 99422)
1994 @@ -877,7 +877,7 @@ expand_asm_operands (tree string, tree o
1995  
1996        if (asm_operand_ok (op, constraint) <= 0)
1997         {
1998 -         if (allows_reg)
1999 +         if (allows_reg && TYPE_MODE (type) != BLKmode)
2000             op = force_reg (TYPE_MODE (type), op);
2001           else if (!allows_mem)
2002             warning (0, "asm operand %d probably doesn%'t match constraints",
2003 --- gcc/testsuite/gcc.dg/pr8788-1.c     (revision 0)
2004 +++ gcc/testsuite/gcc.dg/pr8788-1.c     (revision 99422)
2005 @@ -0,0 +1,20 @@
2006 +/* PR inline-asm/8788 */
2007 +/* { dg-do compile } */
2008 +/* { dg-options "-O2" } */
2009 +
2010 +typedef struct {
2011 +    long x[6];
2012 +} myjmp_buf;
2013 +
2014 +typedef struct {
2015 +    myjmp_buf regs;
2016 +} my_stack;
2017 +
2018 +void switch_to_stack (my_stack *stack){
2019 +    asm (  /* { dg-error "impossible constraint" } */
2020 +/* { dg-warning "asm operand 1" "asm operand 1" { target *-*-* } 14 } */
2021 +        "\n"
2022 +        : "+r" (stack->regs)
2023 +    );
2024 +}
2025 +
2026 2005-11-30  Alexandre Oliva  <aoliva@redhat.com>
2027
2028         * gcc.c (find_a_file): Use update_path before access tests.
2029         Mostly from Thomas Walker <thomas.walker@morganstanley.com>
2030         * prefix.c (update_path): Move dir/../-stripping code to...
2031         (maybe_strip_dotdots): New function.  Reorganize.
2032
2033 --- gcc/gcc.c.orig      2005-12-01 18:38:38.000000000 -0200
2034 +++ gcc/gcc.c   2005-12-01 18:41:01.000000000 -0200
2035 @@ -2371,7 +2371,7 @@
2036  find_a_file (struct path_prefix *pprefix, const char *name, int mode,
2037              int multilib)
2038  {
2039 -  char *temp;
2040 +  char *temp, *temp2;
2041    const char *const file_suffix =
2042      ((mode & X_OK) != 0 ? HOST_EXECUTABLE_SUFFIX : "");
2043    struct prefix_list *pl;
2044 @@ -2407,19 +2407,18 @@
2045                                     NULL));
2046      }
2047  
2048 -  temp = xmalloc (len);
2049 -
2050    /* Determine the filename to execute (special case for absolute paths).  */
2051  
2052    if (IS_ABSOLUTE_PATH (name))
2053      {
2054 -      if (access (name, mode) == 0)
2055 -       {
2056 -         strcpy (temp, name);
2057 -         return temp;
2058 -       }
2059 +      /* IS_ABSOLUTE_PATHNAME lets anything through that starts with '/'  */
2060 +      temp = update_path (name, NULL);
2061 +      if (access (temp, mode) == 0)
2062 +       return temp;
2063      }
2064    else
2065 +  {
2066 +    temp = xmalloc (len);
2067      for (pl = pprefix->plist; pl; pl = pl->next)
2068        {
2069         const char *this_name
2070 @@ -2435,24 +2434,30 @@
2071                 strcat (temp, machine_suffix);
2072                 strcat (temp, multilib_name);
2073                 strcat (temp, file_suffix);
2074 -               if (access_check (temp, mode) == 0)
2075 +               temp2 = update_path (temp, NULL);
2076 +               if (access_check (temp2, mode) == 0)
2077                   {
2078                     if (pl->used_flag_ptr != 0)
2079                       *pl->used_flag_ptr = 1;
2080 -                   return temp;
2081 +                   free (temp);
2082 +                   return temp2;
2083                   }
2084 +               free (temp2);
2085               }
2086  
2087             /* Now try just the multilib_name.  */
2088             strcpy (temp, pl->prefix);
2089             strcat (temp, machine_suffix);
2090             strcat (temp, multilib_name);
2091 -           if (access_check (temp, mode) == 0)
2092 +           temp2 = update_path (temp, NULL);
2093 +           if (access_check (temp2, mode) == 0)
2094               {
2095                 if (pl->used_flag_ptr != 0)
2096                   *pl->used_flag_ptr = 1;
2097 -               return temp;
2098 +               free (temp);
2099 +               return temp2;
2100               }
2101 +           free (temp2);
2102           }
2103  
2104         /* Certain prefixes are tried with just the machine type,
2105 @@ -2467,23 +2472,29 @@
2106                 strcat (temp, just_machine_suffix);
2107                 strcat (temp, multilib_name);
2108                 strcat (temp, file_suffix);
2109 -               if (access_check (temp, mode) == 0)
2110 +               temp2 = update_path (temp, NULL);
2111 +               if (access_check (temp2, mode) == 0)
2112                   {
2113                     if (pl->used_flag_ptr != 0)
2114                       *pl->used_flag_ptr = 1;
2115 -                   return temp;
2116 +                   free (temp);
2117 +                   return temp2;
2118                   }
2119 +               free (temp2);
2120               }
2121  
2122             strcpy (temp, pl->prefix);
2123             strcat (temp, just_machine_suffix);
2124             strcat (temp, multilib_name);
2125 -           if (access_check (temp, mode) == 0)
2126 +           temp2 = update_path (temp, NULL);
2127 +           if (access_check (temp2, mode) == 0)
2128               {
2129                 if (pl->used_flag_ptr != 0)
2130                   *pl->used_flag_ptr = 1;
2131 -               return temp;
2132 +               free (temp);
2133 +               return temp2;
2134               }
2135 +           free (temp2);
2136           }
2137  
2138         /* Certain prefixes can't be used without the machine suffix
2139 @@ -2497,24 +2508,31 @@
2140                 strcpy (temp, pl->prefix);
2141                 strcat (temp, this_name);
2142                 strcat (temp, file_suffix);
2143 -               if (access_check (temp, mode) == 0)
2144 +               temp2 = update_path (temp, NULL);
2145 +               if (access_check (temp2, mode) == 0)
2146                   {
2147                     if (pl->used_flag_ptr != 0)
2148                       *pl->used_flag_ptr = 1;
2149 -                   return temp;
2150 +                   free (temp);
2151 +                   return temp2;
2152                   }
2153 +               free (temp2);
2154               }
2155  
2156             strcpy (temp, pl->prefix);
2157             strcat (temp, this_name);
2158 -           if (access_check (temp, mode) == 0)
2159 +           temp2 = update_path (temp, NULL);
2160 +           if (access_check (temp2, mode) == 0)
2161               {
2162                 if (pl->used_flag_ptr != 0)
2163                   *pl->used_flag_ptr = 1;
2164 -               return temp;
2165 +               free (temp);
2166 +               return temp2;
2167               }
2168 +           free (temp2);
2169           }
2170        }
2171 +  }
2172  
2173    free (temp);
2174    return 0;
2175 --- gcc/prefix.c.orig   2005-12-01 18:38:38.000000000 -0200
2176 +++ gcc/prefix.c        2005-12-01 18:46:37.000000000 -0200
2177 @@ -238,6 +238,105 @@
2178    while (*string++);
2179  }
2180  
2181 +/* Strip dir/.. from a pathname when it makes sense, e.g., when this
2182 +   would turn an inaccessible pathname into an accessible one.
2183 +
2184 +   We short-circuit dir/.. when dir does not exist, and when
2185 +   some/dir/../thing does not exist but some/thing does.  In case
2186 +   there are multiple possible dir/../ stripping possibilities that
2187 +   would turn an inaccessible pathname into an accessible one, the one
2188 +   closer to the end of the pathname is preferred.
2189 +
2190 +   RESULT is the pathname that might contain such dotdot sequences to
2191 +   be stripped.  P points into RESULT, and indicates the location
2192 +   where we should start looking for ../ sequences.
2193 +
2194 +   Even though RESULT is const, P is not, and that's because
2195 +   characters in it may be temporarily overwritten, so RESULT must not
2196 +   be in read-only storage.
2197 +
2198 +   The returned value is either a newly-allocated memory area, holding
2199 +   a string that is the result of dotdot-stripping from the original
2200 +   input strip, or RESULT itself, in which case any modifications made
2201 +   to the string will have been undone.  */
2202 +
2203 +static const char *
2204 +maybe_strip_dotdots (const char *result, char *p)
2205 +{
2206 +  char *temp;
2207 +  const char *path, *before, *after;
2208 +  size_t len;
2209 +
2210 +  while (1)
2211 +    {
2212 +      p = strchr (p, '.');
2213 +      if (p == NULL)
2214 +       return result;
2215 +      /* Look for `/../'  */
2216 +      if (p[1] == '.'
2217 +         && IS_DIR_SEPARATOR (p[2])
2218 +         && (p != result && IS_DIR_SEPARATOR (p[-1])))
2219 +       break;
2220 +      else
2221 +       ++p;
2222 +    }
2223 +
2224 +  *p = 0;
2225 +  if (access (result, X_OK) == 0)
2226 +    {
2227 +      *p = '.';
2228 +
2229 +      path = maybe_strip_dotdots (result, p + 3);
2230 +      if (access (path, F_OK) == 0)
2231 +       return path;
2232 +      if (path != result)
2233 +       free ((char *) path);
2234 +    }
2235 +  else
2236 +    *p = '.';
2237 +
2238 +  /* If we couldn't access the dir, or if recursion resulted in a
2239 +     non-accessible pathname, we try stripping out dir/../.  If `dir'
2240 +     turns out to be `.', strip one more path component.  */
2241 +  before = p;
2242 +  do
2243 +    {
2244 +      --before;
2245 +      while (before != result && IS_DIR_SEPARATOR (*before))
2246 +       --before;
2247 +      while (before != result && !IS_DIR_SEPARATOR (before[-1]))
2248 +       --before;
2249 +    }
2250 +  while (before != result && *before == '.'
2251 +        && IS_DIR_SEPARATOR (*(before + 1)));
2252 +  /* If we have something like `./..' or `/..', don't
2253 +     strip anything more.  */
2254 +  if (*before == '.' || IS_DIR_SEPARATOR (*before))
2255 +    return result;
2256 +
2257 +  after = p + 3;
2258 +  while (IS_DIR_SEPARATOR (*after))
2259 +    ++after;
2260 +
2261 +  len = (after - result) + strlen (after);
2262 +
2263 +  temp = xmalloc (len + 1 - (after - before));
2264 +  memcpy (temp, result, before - result);
2265 +  memcpy (temp + (before - result), after, len + 1 - (after - result));
2266 +
2267 +  path = maybe_strip_dotdots (temp, temp + (before - result));
2268 +
2269 +  if (path != temp)
2270 +    free (temp);
2271 +
2272 +  if (access (path, F_OK) == 0)
2273 +    result = path;
2274 +  else if (path != result)
2275 +    free ((char *) path);
2276 +
2277 +  return result;
2278 +}
2279 +
2280  /* Update PATH using KEY if PATH starts with PREFIX.  The returned
2281     string is always malloc-ed, and the caller is responsible for
2282     freeing it.  */
2283 @@ -245,7 +344,7 @@
2284  char *
2285  update_path (const char *path, const char *key)
2286  {
2287 -  char *result, *p;
2288 +  char *result, *temp;
2289  
2290    if (! strncmp (path, std_prefix, strlen (std_prefix)) && key != 0)
2291      {
2292 @@ -265,62 +364,11 @@
2293    else
2294      result = xstrdup (path);
2295  
2296 -#ifndef ALWAYS_STRIP_DOTDOT
2297 -#define ALWAYS_STRIP_DOTDOT 0
2298 -#endif
2299 +  temp = result;
2300 +  result = (char *) maybe_strip_dotdots (temp, temp);
2301  
2302 -  p = result;
2303 -  while (1)
2304 -    {
2305 -      char *src, *dest;
2306 -
2307 -      p = strchr (p, '.');
2308 -      if (p == NULL)
2309 -       break;
2310 -      /* Look for `/../'  */
2311 -      if (p[1] == '.'
2312 -         && IS_DIR_SEPARATOR (p[2])
2313 -         && (p != result && IS_DIR_SEPARATOR (p[-1])))
2314 -       {
2315 -         *p = 0;
2316 -         if (!ALWAYS_STRIP_DOTDOT && access (result, X_OK) == 0)
2317 -           {
2318 -             *p = '.';
2319 -             break;
2320 -           }
2321 -         else
2322 -           {
2323 -             /* We can't access the dir, so we won't be able to
2324 -                access dir/.. either.  Strip out `dir/../'.  If `dir'
2325 -                turns out to be `.', strip one more path component.  */
2326 -             dest = p;
2327 -             do
2328 -               {
2329 -                 --dest;
2330 -                 while (dest != result && IS_DIR_SEPARATOR (*dest))
2331 -                   --dest;
2332 -                 while (dest != result && !IS_DIR_SEPARATOR (dest[-1]))
2333 -                   --dest;
2334 -               }
2335 -             while (dest != result && *dest == '.');
2336 -             /* If we have something like `./..' or `/..', don't
2337 -                strip anything more.  */
2338 -             if (*dest == '.' || IS_DIR_SEPARATOR (*dest))
2339 -               {
2340 -                 *p = '.';
2341 -                 break;
2342 -               }
2343 -             src = p + 3;
2344 -             while (IS_DIR_SEPARATOR (*src))
2345 -               ++src;
2346 -             p = dest;
2347 -             while ((*dest++ = *src++) != 0)
2348 -               ;
2349 -           }
2350 -       }
2351 -      else
2352 -       ++p;
2353 -    }
2354 +  if (result != temp)
2355 +    free (temp);
2356  
2357  #ifdef UPDATE_PATH_HOST_CANONICALIZE
2358    /* Perform host dependent canonicalization when needed.  */
2359 2005-09-29  Alexandre Oliva  <aoliva@redhat.com>
2360
2361         * error.c (dump_type) <UNKNOWN_TYPE>: Print reworded message.
2362
2363         * g++.dg/overload/unknown1.C: New.
2364
2365 --- gcc/cp/error.c.orig 2004-11-07 11:22:11.000000000 -0200
2366 +++ gcc/cp/error.c      2005-09-29 16:13:20.000000000 -0300
2367 @@ -302,7 +302,7 @@
2368    switch (TREE_CODE (t))
2369      {
2370      case UNKNOWN_TYPE:
2371 -      pp_identifier (cxx_pp, "<unknown type>");
2372 +      pp_identifier (cxx_pp, "<unresolved overloaded function type>");
2373        break;
2374  
2375      case TREE_LIST:
2376 --- gcc/testsuite/g++.dg/overload/unknown1.C    1970-01-01 00:00:00.000000000 +0000
2377 +++ gcc/testsuite/g++.dg/overload/unknown1.C    2005-09-29 16:12:49.000000000 -0300
2378 @@ -0,0 +1,9 @@
2379 +// { dg-do compile }
2380 +
2381 +void foo(void);
2382 +int foo(int);
2383 +template <typename T> void bar(T f);
2384 +
2385 +void baz() {
2386 +  bar(foo); // { dg-error "<unresolved overloaded function type>" }
2387 +}
2388 2005-12-18  Alexandre Oliva  <aoliva@redhat.com>
2389
2390         * optabs.c (expand_vector_binop): Do not use a SUBREG to modify
2391         a subword in the output if it matches any of the inputs.
2392
2393 2006-04-20  Jakub Jelinek  <jakub@redhat.com>
2394
2395         * gcc.c-torture/execute/20060420-1.c: New test.
2396
2397 --- gcc/optabs.c.orig   2005-11-21 11:43:20.000000000 -0200
2398 +++ gcc/optabs.c        2005-12-18 18:35:14.000000000 -0200
2399 @@ -1933,16 +1933,19 @@
2400  
2401        for (i = 0; i < elts; ++i)
2402         {
2403 -         /* If this is part of a register, and not the first item in the
2404 -            word, we can't store using a SUBREG - that would clobber
2405 -            previous results.
2406 +         /* If this is part of a register, and not the first item in
2407 +            the word, we can't store using a SUBREG - that would
2408 +            clobber previous results, or even the input operands, if
2409 +            target matches any of them.
2410              And storing with a SUBREG is only possible for the least
2411              significant part, hence we can't do it for big endian
2412              (unless we want to permute the evaluation order.  */
2413           if (GET_CODE (target) == REG
2414               && (BYTES_BIG_ENDIAN
2415                   ? subsize < UNITS_PER_WORD
2416 -                 : ((i * subsize) % UNITS_PER_WORD) != 0))
2417 +                 : (((i * subsize) % UNITS_PER_WORD) != 0
2418 +                    || (subsize < UNITS_PER_WORD
2419 +                        && (target == op0 || target == op1)))))
2420             t = NULL_RTX;
2421           else
2422             t = simplify_gen_subreg (submode, target, mode, i * subsize);
2423 --- gcc/testsuite/gcc.c-torture/execute/20060420-1.c.jj 2006-04-20 18:47:19.000000000 +0200
2424 +++ gcc/testsuite/gcc.c-torture/execute/20060420-1.c    2006-04-20 19:07:20.000000000 +0200
2425 @@ -0,0 +1,71 @@
2426 +extern void abort (void);
2427 +
2428 +typedef float v4flt __attribute__ ((vector_size (16)));
2429 +
2430 +void __attribute__ ((noinline)) foo (float *dst, float **src, int a, int n)
2431 +{
2432 +  int i, j;
2433 +  int z = sizeof (v4flt) / sizeof (float);
2434 +  unsigned m = sizeof (v4flt) - 1;
2435 +
2436 +  for (j = 0; j < n && (((unsigned long) dst + j) & m); ++j)
2437 +    {
2438 +      float t = src[0][j];
2439 +      for (i = 1; i < a; ++i)
2440 +       t += src[i][j];
2441 +      dst[j] = t;
2442 +    }
2443 +
2444 +  for (; j < (n - (4 * z - 1)); j += 4 * z)
2445 +    {
2446 +      v4flt t0 = *(v4flt *) (src[0] + j + 0 * z);
2447 +      v4flt t1 = *(v4flt *) (src[0] + j + 1 * z);
2448 +      v4flt t2 = *(v4flt *) (src[0] + j + 2 * z);
2449 +      v4flt t3 = *(v4flt *) (src[0] + j + 3 * z);
2450 +      for (i = 1; i < a; ++i)
2451 +       {
2452 +         t0 += *(v4flt *) (src[i] + j + 0 * z);
2453 +         t1 += *(v4flt *) (src[i] + j + 1 * z);
2454 +         t2 += *(v4flt *) (src[i] + j + 2 * z);
2455 +         t3 += *(v4flt *) (src[i] + j + 3 * z);
2456 +       }
2457 +      *(v4flt *) (dst + j + 0 * z) = t0;
2458 +      *(v4flt *) (dst + j + 1 * z) = t1;
2459 +      *(v4flt *) (dst + j + 2 * z) = t2;
2460 +      *(v4flt *) (dst + j + 3 * z) = t3;
2461 +    }
2462 +  for (; j < n; ++j)
2463 +    {
2464 +      float t = src[0][j];
2465 +      for (i = 1; i < a; ++i)
2466 +       t += src[i][j];
2467 +      dst[j] = t;
2468 +    }
2469 +}
2470 +
2471 +float buffer[64];
2472 +
2473 +int
2474 +main (void)
2475 +{
2476 +  int i;
2477 +  float *dst, *src[2];
2478 +
2479 +  dst = buffer;
2480 +  dst += (-(long int) buffer & (16 * sizeof (float) - 1)) / sizeof (float);
2481 +  src[0] = dst + 16;
2482 +  src[1] = dst + 32;
2483 +  for (i = 0; i < 16; ++i)
2484 +    {
2485 +      src[0][i] = (float) i + 11 * (float) i;
2486 +      src[1][i] = (float) i + 12 * (float) i;
2487 +    }
2488 +  foo (dst, src, 2, 16);
2489 +  for (i = 0; i < 16; ++i)
2490 +    {
2491 +      float e = (float) i + 11 * (float) i + (float) i + 12 * (float) i;
2492 +      if (dst[i] != e)
2493 +       abort ();
2494 +    }
2495 +  return 0;
2496 +}
2497 2006-03-01  Alexandre Oliva  <aoliva@redhat.com>
2498
2499         * dwarf2out.c (dwarf2out_stack_adjust): Always track the stack
2500         pointer, instead of assuming it is possible to derive the
2501         correct args size from a call insn.
2502
2503 --- gcc/dwarf2out.c.orig        2006-03-01 05:13:50.000000000 -0300
2504 +++ gcc/dwarf2out.c     2006-03-01 05:41:38.000000000 -0300
2505 @@ -1069,26 +1069,6 @@ dwarf2out_stack_adjust (rtx insn)
2506    if (prologue_epilogue_contains (insn) || sibcall_epilogue_contains (insn))
2507      return;
2508  
2509 -  if (!flag_asynchronous_unwind_tables && GET_CODE (insn) == CALL_INSN)
2510 -    {
2511 -      /* Extract the size of the args from the CALL rtx itself.  */
2512 -      insn = PATTERN (insn);
2513 -      if (GET_CODE (insn) == PARALLEL)
2514 -       insn = XVECEXP (insn, 0, 0);
2515 -      if (GET_CODE (insn) == SET)
2516 -       insn = SET_SRC (insn);
2517 -      if (GET_CODE (insn) != CALL)
2518 -       abort ();
2519 -
2520 -      dwarf2out_args_size ("", INTVAL (XEXP (insn, 1)));
2521 -      return;
2522 -    }
2523 -
2524 -  /* If only calls can throw, and we have a frame pointer,
2525 -     save up adjustments until we see the CALL_INSN.  */
2526 -  else if (!flag_asynchronous_unwind_tables && cfa.reg != STACK_POINTER_REGNUM)
2527 -    return;
2528 -
2529    if (GET_CODE (insn) == BARRIER)
2530      {
2531        /* When we see a BARRIER, we know to reset args_size to 0.  Usually
2532 @@ -1111,9 +1091,20 @@ dwarf2out_stack_adjust (rtx insn)
2533         if (GET_CODE (XVECEXP (PATTERN (insn), 0, i)) == SET)
2534           offset += stack_adjust_offset (XVECEXP (PATTERN (insn), 0, i));
2535      }
2536 +  else if (GET_CODE (insn) == CALL_INSN)
2537 +    offset = 0;
2538    else
2539      return;
2540  
2541 +  /* We handle this separately because we want stack adjustments in a
2542 +     CALL_INSN to be handled.  */;
2543 +  if (GET_CODE (insn) == CALL_INSN)
2544 +    {
2545 +      /* If only calls can throw, adjust args_size only at call sites.  */
2546 +      if (!flag_asynchronous_unwind_tables)
2547 +       dwarf2out_args_size ("", args_size);
2548 +    }
2549 +
2550    if (offset == 0)
2551      return;
2552  
2553 @@ -1128,6 +1119,16 @@ dwarf2out_stack_adjust (rtx insn)
2554    if (args_size < 0)
2555      args_size = 0;
2556  
2557 +  /* If only calls can throw and we have a frame pointer, we'll save
2558 +     up adjustments until we see the CALL_INSN.  We used to return
2559 +     early and derive args_size from NARGS in the CALL_INSN itself,
2560 +     but that doesn't compute the right value if we have nested call
2561 +     expansions, e.g., stack adjustments for a call have already been
2562 +     emitted, and then we issue another call to compute an argument
2563 +     for the enclosing call (i.e., bar (foo ())).  */
2564 +  if (!flag_asynchronous_unwind_tables && cfa.reg != STACK_POINTER_REGNUM)
2565 +    return;
2566 +
2567    label = dwarf2out_cfi_label ();
2568    def_cfa_1 (label, &cfa);
2569    dwarf2out_args_size (label, args_size);
2570 2006-02-25  Alexandre Oliva  <aoliva@redhat.com>
2571
2572         * varasm.c (copy_constant): Handle VECTOR_CST.
2573
2574         * gcc.dg/altivec-23.c: New test.
2575
2576 --- gcc/varasm.c        2006-02-25 03:52:54.000000000 -0300
2577 +++ gcc/varasm.c        2006-02-25 03:54:56.000000000 -0300
2578 @@ -2464,6 +2464,19 @@ copy_constant (tree exp)
2579         return copy;
2580        }
2581  
2582 +    case VECTOR_CST:
2583 +      {
2584 +       tree copy = copy_node (exp);
2585 +       tree list = copy_list (TREE_VECTOR_CST_ELTS (exp));
2586 +       tree tail;
2587 +
2588 +       TREE_VECTOR_CST_ELTS (copy) = list;
2589 +       for (tail = list; tail; tail = TREE_CHAIN (tail))
2590 +         TREE_VALUE (tail) = copy_constant (TREE_VALUE (tail));
2591 +
2592 +       return copy;
2593 +      }
2594 +
2595      default:
2596        {
2597         tree t;
2598 --- gcc/testsuite/gcc.dg/altivec-23.c   1970-01-01 00:00:00.000000000 +0000
2599 +++ gcc/testsuite/gcc.dg/altivec-23.c   2006-02-25 04:10:36.000000000 -0300
2600 @@ -0,0 +1,25 @@
2601 +/* Verify that it is possible to define variables of composite types
2602 +   containing vector types.  We used to crash handling the
2603 +   initializer of automatic ones.  */
2604 +
2605 +/* { dg-do compile { target powerpc*-*-* } } */
2606 +/* { dg-xfail-if "" { "powerpc-ibm-aix*" } { "-maltivec" } { "" } } */
2607 +/* { dg-options "-maltivec -mabi=altivec" } */
2608 +
2609 +#include <altivec.h>
2610 +
2611 +typedef int bt;
2612 +typedef vector bt vt;
2613 +typedef struct { vt x; bt y[sizeof(vt) / sizeof (bt)]; } st;
2614 +#define INIT { 1, 2, 3, 4 }
2615 +
2616 +void f ()
2617 +{
2618 +  vt x = INIT;
2619 +  vt y[1] = { INIT };
2620 +  st s = { INIT, INIT };
2621 +}
2622 +
2623 +vt x = INIT;
2624 +vt y[1] = { INIT };
2625 +st s = { INIT, INIT };
2626 2006-12-08  Alexandre Oliva  <aoliva@redhat.com>
2627
2628         * g++.dg/template/array17.C: New test.
2629
2630 2006-10-27  Alexandre Oliva  <aoliva@redhat.com>
2631
2632         * typeck.c (non_reference): Don't dereference NULL type.
2633
2634 --- gcc/cp/typeck.c.orig        2005-11-21 11:56:03.000000000 -0200
2635 +++ gcc/cp/typeck.c     2006-10-27 03:28:04.000000000 -0300
2636 @@ -6443,7 +6443,7 @@ casts_away_constness (tree t1, tree t2)
2637  tree
2638  non_reference (tree t)
2639  {
2640 -  if (TREE_CODE (t) == REFERENCE_TYPE)
2641 +  if (t != NULL_TREE && TREE_CODE (t) == REFERENCE_TYPE)
2642      t = TREE_TYPE (t);
2643    return t;
2644  }
2645 --- gcc/testsuite/g++.dg/template/array17.C     2006-10-04 16:28:56.502613000 +0200
2646 +++ gcc/testsuite/g++.dg/template/array17.C     2006-12-08 12:38:27.000000000 +0100
2647 @@ -0,0 +1,23 @@
2648 +// { dg-do compile }
2649 +
2650 +template <typename T>
2651 +struct V {
2652 +  T& operator[](int);
2653 +};
2654 +
2655 +struct S {
2656 +  S operator +(int);
2657 +  template <typename T> T value();
2658 +};
2659 +
2660 +template <typename T>
2661 +void R (T v)
2662 +{
2663 +  v[(S() + 0).template value<int>()][0] = 0;
2664 +}
2665 +
2666 +int
2667 +main ()
2668 +{
2669 +  R(V<V<int> >());
2670 +}
2671 2006-12-08  Jakub Jelinek  <jakub@redhat.com>
2672
2673         * g++.dg/opt/ifcvt1.C: New test.
2674
2675 2005-11-09  Eric Botcazou  <ebotcazou@adacore.com>
2676
2677         * ifcvt.c (noce_get_alt_condition): Use prev_nonnote_insn.
2678         (noce_try_abs): Negate if the comparison is reversed.
2679         Look only one instruction backwards for a REG_EQUAL note.
2680
2681         * gcc.dg/ifcvt-fabs-1.c: New test.
2682
2683 --- gcc/ifcvt.c.orig    2005-11-21 11:43:21.000000000 -0200
2684 +++ gcc/ifcvt.c 2006-10-26 02:21:07.000000000 -0300
2685 @@ -1406,7 +1406,7 @@ noce_get_alt_condition (struct noce_if_i
2686        rtx prev_insn;
2687  
2688        /* First, look to see if we put a constant in a register.  */
2689 -      prev_insn = PREV_INSN (if_info->cond_earliest);
2690 +      prev_insn = prev_nonnote_insn (if_info->cond_earliest);
2691        if (prev_insn
2692           && INSN_P (prev_insn)
2693           && GET_CODE (PATTERN (prev_insn)) == SET)
2694 @@ -1642,25 +1642,30 @@ noce_try_abs (struct noce_if_info *if_in
2695    if (rtx_equal_p (XEXP (cond, 0), b))
2696      c = XEXP (cond, 1);
2697    else if (rtx_equal_p (XEXP (cond, 1), b))
2698 -    c = XEXP (cond, 0);
2699 +    {
2700 +      c = XEXP (cond, 0);
2701 +      negate = !negate;
2702 +    }
2703    else
2704      return FALSE;
2705  
2706 -  /* Verify that C is zero.  Search backward through the block for
2707 -     a REG_EQUAL note if necessary.  */
2708 +  /* Verify that C is zero.  Search one step backward for a
2709 +     REG_EQUAL note or a simple source if necessary.  */
2710    if (REG_P (c))
2711      {
2712 -      rtx insn, note = NULL;
2713 -      for (insn = earliest;
2714 -          insn != BB_HEAD (if_info->test_bb);
2715 -          insn = PREV_INSN (insn))
2716 -       if (INSN_P (insn)
2717 -           && ((note = find_reg_note (insn, REG_EQUAL, c))
2718 -               || (note = find_reg_note (insn, REG_EQUIV, c))))
2719 -         break;
2720 -      if (! note)
2721 +      rtx set, insn = prev_nonnote_insn (earliest);
2722 +      if (insn
2723 +         && (set = single_set (insn))
2724 +         && rtx_equal_p (SET_DEST (set), c))
2725 +       {
2726 +         rtx note = find_reg_equal_equiv_note (insn);
2727 +         if (note)
2728 +           c = XEXP (note, 0);
2729 +         else
2730 +           c = SET_SRC (set);
2731 +       }
2732 +      else
2733         return FALSE;
2734 -      c = XEXP (note, 0);
2735      }
2736    if (GET_CODE (c) == MEM
2737        && GET_CODE (XEXP (c, 0)) == SYMBOL_REF
2738 --- gcc/testsuite/gcc.dg/ifcvt-fabs-1.c 1970-01-01 00:00:00.000000000 +0000
2739 +++ gcc/testsuite/gcc.dg/ifcvt-fabs-1.c 2006-10-26 02:20:24.000000000 -0300
2740 @@ -0,0 +1,21 @@
2741 +/* { dg-do run } */
2742 +/* { dg-options "-O" } */
2743 +/* { dg-options "-O -march=i686" { target i686-*-* } } */
2744 +
2745 +extern void abort(void);
2746 +
2747 +float foo(float f)
2748 +{
2749 +  if (f < 0.0f)
2750 +    f = -f;
2751 +
2752 +  return f;
2753 +}
2754 +
2755 +int main(void)
2756 +{
2757 +  if (foo (-1.0f) != 1.0f)
2758 +    abort ();
2759 +
2760 +  return 0;
2761 +}
2762 --- gcc/testsuite/g++.dg/opt/ifcvt1.C   2006-10-04 16:28:56.502613000 +0200
2763 +++ gcc/testsuite/g++.dg/opt/ifcvt1.C   2006-12-08 12:23:23.000000000 +0100
2764 @@ -0,0 +1,17 @@
2765 +// { dg-do compile }
2766 +// { dg-options "-O2 -fnon-call-exceptions" }
2767 +
2768 +struct S { ~S () throw () {} };
2769 +double bar ();
2770 +
2771 +int
2772 +foo ()
2773 +{
2774 +  S a;
2775 +  int i = 0;
2776 +  double c = bar ();
2777 +  c = c < 0 ? -c : c;
2778 +  if (c <= 1.e-8)
2779 +    i += 24;
2780 +  return i;
2781 +}
2782 2007-04-02  Jakub Jelinek  <jakub@redhat.com>
2783
2784         * expr.c (expand_expr_real) <case COMPLEX_EXPR>: Force op1
2785         into register if target overlaps with op1.
2786
2787         * g77.f-torture/execute/20070402.f: New test.
2788
2789 --- gcc/expr.c.jj       2006-10-05 00:37:01.000000000 +0200
2790 +++ gcc/expr.c  2007-04-02 13:28:52.000000000 +0200
2791 @@ -8949,6 +8949,9 @@ expand_expr_real (tree exp, rtx target, 
2792  
2793         if (! target)
2794           target = gen_reg_rtx (TYPE_MODE (TREE_TYPE (exp)));
2795 +       else if (GET_CODE (target) == MEM
2796 +                && reg_overlap_mentioned_p (target, op1))
2797 +         op1 = force_reg (mode, op1);
2798  
2799         start_sequence ();
2800  
2801 --- gcc/testsuite/g77.f-torture/execute/20070402.f.jj   2007-04-02 13:29:51.000000000 +0200
2802 +++ gcc/testsuite/g77.f-torture/execute/20070402.f      2007-04-02 12:11:00.000000000 +0200
2803 @@ -0,0 +1,21 @@
2804 +      program rh233941
2805 +      implicit none
2806 +      complex*16 z
2807 +      z = dcmplx(1.0, 2.0)
2808 +      call sub(z)
2809 +      stop
2810 +      end program rh233941
2811 +
2812 +      subroutine sub(z)
2813 +      implicit none
2814 +      complex*16 z
2815 +      z = dcmplx(-dimag(z), dreal(z))
2816 +      call sub2(z)
2817 +      return
2818 +      end subroutine sub
2819 +
2820 +      subroutine sub2(z)
2821 +      implicit none
2822 +      complex*16 z
2823 +      if (dreal(z).ne.-2.0.or.dimag(z).ne.1.0) call abort
2824 +      end subroutine sub2
2825 2007-01-24   Steve LoBasso <slobasso@yahoo.com>
2826              Paolo Carlini  <pcarlini@suse.de>
2827
2828         * include/bits/deque.tcc (deque<>::erase(iterator, iterator)):
2829         Fix condition.
2830         * testsuite/23_containers/deque/modifiers/erase/3.cc: New.
2831
2832 --- libstdc++-v3/include/bits/deque.tcc (revision 121146)
2833 +++ libstdc++-v3/include/bits/deque.tcc (revision 121147)
2834 @@ -140,7 +140,7 @@ namespace _GLIBCXX_STD
2835         {
2836           const difference_type __n = __last - __first;
2837           const difference_type __elems_before = __first - this->_M_impl._M_start;
2838 -         if (static_cast<size_type>(__elems_before) < (size() - __n) / 2)
2839 +         if (static_cast<size_type>(__elems_before) <= (size() - __n) / 2)
2840             {
2841               std::copy_backward(this->_M_impl._M_start, __first, __last);
2842               iterator __new_start = this->_M_impl._M_start + __n;
2843 --- libstdc++-v3/testsuite/23_containers/deque/modifiers/erase/3.cc     (revision 0)
2844 +++ libstdc++-v3/testsuite/23_containers/deque/modifiers/erase/3.cc     (revision 121147)
2845 @@ -0,0 +1,52 @@
2846 +// Copyright (C) 2007 Free Software Foundation, Inc.
2847 +//
2848 +// This file is part of the GNU ISO C++ Library.  This library is free
2849 +// software; you can redistribute it and/or modify it under the
2850 +// terms of the GNU General Public License as published by the
2851 +// Free Software Foundation; either version 2, or (at your option)
2852 +// any later version.
2853 +
2854 +// This library is distributed in the hope that it will be useful,
2855 +// but WITHOUT ANY WARRANTY; without even the implied warranty of
2856 +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
2857 +// GNU General Public License for more details.
2858 +
2859 +// You should have received a copy of the GNU General Public License along
2860 +// with this library; see the file COPYING.  If not, write to the Free
2861 +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
2862 +// USA.
2863 +
2864 +// 23.2.1.3 deque modifiers
2865 +
2866 +#include <deque>
2867 +#include <testsuite_hooks.h>
2868 +
2869 +void erase(size_t num_elm, size_t elm_strt, size_t elm_end)
2870 +{
2871 +  bool test __attribute__((unused)) = true;
2872 +  using __gnu_test::copy_tracker;
2873 +  using __gnu_test::assignment_operator;
2874 +
2875 +  std::deque<copy_tracker> x(num_elm);
2876 +  copy_tracker::reset();
2877 +  
2878 +  x.erase(x.begin() + elm_strt, x.begin() + elm_end);
2879 +  
2880 +  const size_t min_num_cpy = std::min(elm_strt, num_elm - elm_end);
2881 +  VERIFY( assignment_operator::count() == min_num_cpy );
2882 +}
2883 +
2884 +// http://gcc.gnu.org/ml/libstdc++/2007-01/msg00098.html
2885 +void test01()
2886 +{
2887 +  for (size_t num_elm = 0; num_elm <= 10; ++num_elm)
2888 +    for (size_t elm_strt = 0; elm_strt <= num_elm; ++elm_strt)
2889 +      for (size_t elm_end = elm_strt; elm_end <= num_elm; ++elm_end)
2890 +       erase(num_elm, elm_strt, elm_end);
2891 +}
2892 +
2893 +int main()
2894 +{
2895 +  test01();
2896 +  return 0;
2897 +}
2898 2007-04-12  Jakub Jelinek  <jakub@redhat.com>
2899
2900         * fr.po: Use %s rather than %S.
2901         * rw.po: Comment out translations with bogus format
2902         strings.
2903
2904 --- gcc/po/fr.po.jj     2006-10-05 00:33:36.000000000 +0200
2905 +++ gcc/po/fr.po        2007-04-13 00:23:29.000000000 +0200
2906 @@ -17100,7 +17100,7 @@ msgstr "%s liste d'expressions traitée c
2907  
2908  #: cp/typeck.c:4490
2909  msgid "%s from type `%T' to type `%T' casts away constness"
2910 -msgstr "%S à partir du « %T » vers le type « %T » provoque un transtypage sans constante"
2911 +msgstr "%s à partir du « %T » vers le type « %T » provoque un transtypage sans constante"
2912  
2913  #: cp/typeck.c:4692
2914  msgid "invalid static_cast from type `%T' to type `%T'"
2915 2007-04-21  Alexandre Oliva  <aoliva@redhat.com>
2916
2917         * gcse.c (store_killed_in_insn): Handle PARALLELs.
2918         (store_killed_in_pat): New.
2919
2920         * gcc.dg/movsi-sm-1.c: New.
2921
2922 --- gcc/gcse.c.jj       2007-02-23 21:29:12.000000000 +0100
2923 +++ gcc/gcse.c  2007-07-18 20:41:08.000000000 +0200
2924 @@ -7427,6 +7427,40 @@ find_loads (rtx x, rtx store_pattern, in
2925    return ret;
2926  }
2927  
2928 +static inline bool
2929 +store_killed_in_pat (rtx x, rtx pat, int after)
2930 +{
2931 +  if (GET_CODE (pat) == SET)
2932 +    {
2933 +      rtx dest = SET_DEST (pat);
2934 +
2935 +      if (GET_CODE (dest) == SIGN_EXTRACT
2936 +         || GET_CODE (dest) == ZERO_EXTRACT)
2937 +       dest = XEXP (dest, 0);
2938 +
2939 +      /* Check for memory stores to aliased objects.  */
2940 +      if (GET_CODE (dest) == MEM
2941 +         && !expr_equiv_p (dest, x))
2942 +       {
2943 +         if (after)
2944 +           {
2945 +             if (output_dependence (dest, x))
2946 +               return true;
2947 +           }
2948 +         else
2949 +           {
2950 +             if (output_dependence (x, dest))
2951 +               return true;
2952 +           }
2953 +       }
2954 +    }
2955 +
2956 +  if (find_loads (pat, x, after))
2957 +    return true;
2958 +
2959 +  return false;
2960 +}
2961 +
2962  /* Check if INSN kills the store pattern X (is aliased with it).
2963     AFTER is true if we are checking the case when store X occurs
2964     after the insn.  Return true if it it does.  */
2965 @@ -7434,7 +7468,7 @@ find_loads (rtx x, rtx store_pattern, in
2966  static bool
2967  store_killed_in_insn (rtx x, rtx x_regs, rtx insn, int after)
2968  {
2969 -  rtx reg, base, note;
2970 +  rtx reg, base, note, pat;
2971  
2972    if (!INSN_P (insn))
2973      return false;
2974 @@ -7461,33 +7495,20 @@ store_killed_in_insn (rtx x, rtx x_regs,
2975        return false;
2976      }
2977  
2978 -  if (GET_CODE (PATTERN (insn)) == SET)
2979 +  pat = PATTERN (insn);
2980 +  if (GET_CODE (pat) == SET)
2981      {
2982 -      rtx pat = PATTERN (insn);
2983 -      rtx dest = SET_DEST (pat);
2984 -
2985 -      if (GET_CODE (dest) == SIGN_EXTRACT
2986 -         || GET_CODE (dest) == ZERO_EXTRACT)
2987 -       dest = XEXP (dest, 0);
2988 -
2989 -      /* Check for memory stores to aliased objects.  */
2990 -      if (GET_CODE (dest) == MEM
2991 -         && !expr_equiv_p (dest, x))
2992 -       {
2993 -         if (after)
2994 -           {
2995 -             if (output_dependence (dest, x))
2996 -               return true;
2997 -           }
2998 -         else
2999 -           {
3000 -             if (output_dependence (x, dest))
3001 -               return true;
3002 -           }
3003 -       }
3004 -      if (find_loads (SET_SRC (pat), x, after))
3005 +      if (store_killed_in_pat (x, pat, after))
3006         return true;
3007      }
3008 +  else if (GET_CODE (pat) == PARALLEL)
3009 +    {
3010 +      int i;
3011 +
3012 +      for (i = 0; i < XVECLEN (pat, 0); i++)
3013 +       if (store_killed_in_pat (x, XVECEXP (pat, 0, i), after))
3014 +         return true;
3015 +    }
3016    else if (find_loads (PATTERN (insn), x, after))
3017      return true;
3018  
3019 --- gcc/testsuite/gcc.dg/movsi-sm-1.c.jj        2007-07-18 20:58:08.000000000 +0200
3020 +++ gcc/testsuite/gcc.dg/movsi-sm-1.c   2007-07-18 21:01:52.000000000 +0200
3021 @@ -0,0 +1,35 @@
3022 +/* { dg-do run } */
3023 +/* { dg-options "-O2" } */
3024 +/* { dg-options "-O2 -mtune=i386" { target { { i?86-*-* x86_64-*-* } && ilp32 } } } */
3025 +
3026 +int ret = 1;
3027 +char buf[128];
3028 +
3029 +void
3030 +__attribute__((noinline))
3031 +bug (int arg)
3032 +{
3033 +  char str[28];
3034 +
3035 +  __builtin_memcpy (str, "Bugged!", 8);
3036 +
3037 +  if (arg & 0200)
3038 +    {
3039 +      __builtin_memcpy (str, "This is what we should get!", 28);
3040 +      ret = 0;
3041 +    }
3042 +
3043 +  if (arg & 0100)
3044 +    __builtin_memcpy (str, "Broken!", 8);
3045 +
3046 +  __builtin_sprintf (buf, "%s\n", str);
3047 +}
3048 +
3049 +int
3050 +main ()
3051 +{
3052 +  bug (0200);
3053 +  if (ret)
3054 +    return ret;
3055 +  return __builtin_strcmp (buf, "This is what we should get!\n") != 0;
3056 +}
3057 2007-06-08  Jatin Nansi  <jnansi@redhat.com>
3058
3059         * config/locale/ieee_1003.1-2001/codecvt_specializations.h: Make sure
3060         _M_int_enc and _M_ext_enc are '\0' terminated.
3061
3062 --- libstdc++-v3/config/locale/ieee_1003.1-2001/codecvt_specializations.h.jj    2007-02-23 21:29:34.000000000 +0100
3063 +++ libstdc++-v3/config/locale/ieee_1003.1-2001/codecvt_specializations.h       2007-07-19 14:20:20.000000000 +0200
3064 @@ -83,8 +83,10 @@
3065                           int __ibom = 0, int __ebom = 0)
3066      : _M_in_desc(0), _M_out_desc(0), _M_ext_bom(__ebom), _M_int_bom(__ibom)
3067      {
3068 -      strncpy(_M_int_enc, __int, _S_max_size);
3069 -      strncpy(_M_ext_enc, __ext, _S_max_size);
3070 +      strncpy(_M_int_enc, __int, _S_max_size - 1);
3071 +      strncpy(_M_ext_enc, __ext, _S_max_size - 1);
3072 +      _M_int_enc[_S_max_size - 1] = '\0';
3073 +      _M_ext_enc[_S_max_size - 1] = '\0';
3074        _M_init();
3075      }
3076  
3077 @@ -98,8 +100,10 @@
3078      // information.
3079      __enc_traits(const __enc_traits& __obj): _M_in_desc(0), _M_out_desc(0)
3080      {
3081 -      strncpy(_M_int_enc, __obj._M_int_enc, _S_max_size);
3082 -      strncpy(_M_ext_enc, __obj._M_ext_enc, _S_max_size);
3083 +      strncpy(_M_int_enc, __obj._M_int_enc, _S_max_size - 1);
3084 +      strncpy(_M_ext_enc, __obj._M_ext_enc, _S_max_size - 1);
3085 +      _M_int_enc[_S_max_size - 1] = '\0';
3086 +      _M_ext_enc[_S_max_size - 1] = '\0';
3087        _M_ext_bom = __obj._M_ext_bom;
3088        _M_int_bom = __obj._M_int_bom;
3089        _M_destroy();
3090 @@ -110,8 +114,10 @@
3091      __enc_traits&
3092      operator=(const __enc_traits& __obj)
3093      {
3094 -      strncpy(_M_int_enc, __obj._M_int_enc, _S_max_size);
3095 -      strncpy(_M_ext_enc, __obj._M_ext_enc, _S_max_size);
3096 +      strncpy(_M_int_enc, __obj._M_int_enc, _S_max_size - 1);
3097 +      strncpy(_M_ext_enc, __obj._M_ext_enc, _S_max_size - 1);
3098 +      _M_int_enc[_S_max_size - 1] = '\0';
3099 +      _M_ext_enc[_S_max_size - 1] = '\0';
3100        _M_ext_bom = __obj._M_ext_bom;
3101        _M_int_bom = __obj._M_int_bom;
3102        _M_destroy();
This page took 0.469423 seconds and 3 git commands to generate.