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