1 2006-02-17 Jakub Jelinek <jakub@redhat.com>
4 * gthr-posix.h (_REENTRANT): Only define if __osf__ is defined.
6 * config/ia64/linux.h (CPP_SPEC): Define.
7 * config/s390/linux.h (CPP_SPEC): Define.
9 --- gcc/gthr-posix.h (revision 111211)
10 +++ gcc/gthr-posix.h (revision 111212)
11 @@ -36,7 +36,7 @@ Software Foundation, 51 Franklin Street,
14 /* Some implementations of <pthread.h> require this to be defined. */
16 +#if !defined(_REENTRANT) && defined(__osf__)
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}}}}"
26 +#define CPP_SPEC "%{posix:-D_POSIX_SOURCE} %{pthread:-D_REENTRANT}"
28 #define TARGET_ASM_FILE_END file_end_indicate_exec_stack
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}} \
36 +#define CPP_SPEC "%{posix:-D_POSIX_SOURCE} %{pthread:-D_REENTRANT}"
38 #define JMP_BUF_SIZE 76
40 2004-05-27 Josef Zlomek <zlomekj@suse.cz>
43 * emit-rtl.c (gen_rtx_REG_offset): Adjust the offset according
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)
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. */
58 gen_rtx_REG_offset (rtx reg, enum machine_mode mode, unsigned int regno, int offset)
60 rtx new = gen_rtx_REG (mode, regno);
62 + HOST_WIDE_INT var_size;
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.
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).
73 + However, this is not true on big endian machines.
74 + The offset of the start of the variable is different when accessed
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.
79 + If we would not do the big endian correction the resulting REG_OFFSET
80 + would be larger than the size of the DECL.
82 + Examples of correction, for BYTES_BIG_ENDIAN WORDS_BIG_ENDIAN machine:
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
90 + DI HI 4 6 2 1st element in HImode
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. */
98 + decl = REG_EXPR (reg);
99 + if ((BYTES_BIG_ENDIAN || WORDS_BIG_ENDIAN)
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))))
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;
113 + offset_le = (offset / UNITS_PER_WORD) * UNITS_PER_WORD;
115 + if (BYTES_BIG_ENDIAN)
116 + offset_le += ((GET_MODE_SIZE (GET_MODE (reg)) - 1 - offset)
119 + offset_le += offset % UNITS_PER_WORD;
121 + if (offset_le >= var_size)
123 + /* MODE is wider than the variable so the new reg will cover
124 + the whole variable so the resulting OFFSET should be 0. */
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;
134 + offset = (offset_le / UNITS_PER_WORD) * UNITS_PER_WORD;
136 + if (BYTES_BIG_ENDIAN)
137 + offset += ((var_size - 1 - offset_le)
140 + offset += offset_le % UNITS_PER_WORD;
144 REG_ATTRS (new) = get_reg_attrs (REG_EXPR (reg),
145 REG_OFFSET (reg) + offset);
147 2005-01-13 Jakub Jelinek <jakub@redhat.com>
149 PR rtl-optimization/16104
150 * expr.c (convert_move): Handle vector from resp. to if mode
153 * gcc.c-torture/execute/20050113-1.c: New test.
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))
160 if (GET_MODE_BITSIZE (from_mode) != GET_MODE_BITSIZE (to_mode))
163 + if (VECTOR_MODE_P (from_mode))
165 + enum machine_mode new_mode;
167 + new_mode = mode_for_size (GET_MODE_BITSIZE (from_mode),
169 + from = simplify_gen_subreg (new_mode, from, from_mode, 0);
171 + if (VECTOR_MODE_P (to_mode))
173 + enum machine_mode new_mode;
175 + new_mode = mode_for_size (GET_MODE_BITSIZE (to_mode),
177 + to = simplify_gen_subreg (new_mode, to, to_mode, 0);
179 + convert_move (to, from, unsignedp);
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
188 +/* PR rtl-optimization/16104 */
190 +extern void abort (void);
192 +typedef int V2SI __attribute__ ((vector_size (8)));
193 +typedef short V2HI __attribute__ ((vector_size (4)));
198 + return (long long) (V2SI) 0LL;
204 + return (long long) x;
210 + return (V2SI) (long long) (int) (V2HI) 0;
216 + return (V2SI) (long long) (int) x;
222 + if (sizeof (short) != 2 || sizeof (int) != 4 || sizeof (long long) != 8)
229 + if (test2 (x) != 2)
232 + union { V2SI x; int y[2]; } u;
234 + if (u.y[0] != 0 || u.y[1] != 0)
238 + union { V2SI x; long long y; } v;
240 + if (v.y != 0x40004)
244 2005-09-07 Jakub Jelinek <jakub@redhat.com>
247 * config/i386/i386.c (classify_argument): Only use different
248 iterators for nested loops if nested loops sharing the same
251 2004-11-13 Zak Kipling <zak@transversal.com>
254 * config/i386/i386.c (classify_argument): Fix infinite loop when
255 passing object with 3 or more base classes by value.
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
261 tree bases = TYPE_BINFO_BASETYPES (type);
262 int n_bases = TREE_VEC_LENGTH (bases);
266 + enum x86_64_reg_class saveclasses[MAX_CLASSES];
267 + bool seen[MAX_CLASSES];
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)
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);
283 + if (i < MAX_CLASSES)
289 num = classify_argument (TYPE_MODE (type),
291 (offset + bit_offset) % 256);
292 @@ -2049,6 +2064,32 @@ classify_argument (enum machine_mode mod
293 merge_classes (subclasses[i], classes[i + pos]);
298 + /* Older GCC 3.[0-4].x would hang in the above loop, so
299 + don't worry about backwards compatibility and
301 + memcpy (classes, saveclasses, sizeof (saveclasses));
302 + for (basenum = 0; basenum < n_bases; ++basenum)
304 + tree binfo = TREE_VEC_ELT (bases, basenum);
306 + int offset = tree_low_cst (BINFO_OFFSET (binfo), 0) * 8;
307 + tree type = BINFO_TYPE (binfo);
309 + num = classify_argument (TYPE_MODE (type),
311 + (offset + bit_offset) % 256);
314 + for (i = 0; i < num; i++)
316 + int pos = (offset + (bit_offset % 64)) / 8 / 8;
318 + merge_classes (subclasses[i], classes[i + pos]);
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
327 tree bases = TYPE_BINFO_BASETYPES (type);
328 int n_bases = TREE_VEC_LENGTH (bases);
332 + enum x86_64_reg_class saveclasses[MAX_CLASSES];
333 + bool seen[MAX_CLASSES];
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)
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);
349 + if (i < MAX_CLASSES)
355 num = classify_argument (TYPE_MODE (type),
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]);
364 + /* Older GCC 3.[0-4].x would hang in the above loop, so
365 + don't worry about backwards compatibility and
367 + memcpy (classes, saveclasses, sizeof (saveclasses));
368 + for (basenum = 0; basenum < n_bases; ++basenum)
370 + tree binfo = TREE_VEC_ELT (bases, basenum);
372 + int offset = tree_low_cst (BINFO_OFFSET (binfo), 0) * 8;
373 + tree type = BINFO_TYPE (binfo);
375 + num = classify_argument (TYPE_MODE (type),
377 + (offset + (bit_offset % 64)) % 256);
380 + for (i = 0; i < num; i++)
382 + int pos = (offset + (bit_offset % 64)) / 8 / 8;
384 + merge_classes (subclasses[i], classes[i + pos]);
389 for (field = TYPE_FIELDS (type); field; field = TREE_CHAIN (field))
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
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>
401 +struct derived : base1, base2, base3 { };
410 --- gcc/testsuite/g++.dg/ext/visibility/staticdatamem.C 1 Jan 1970 00:00:00 -0000
411 +++ gcc/testsuite/g++.dg/ext/visibility/staticdatamem.C 14 Dec 2004 02:15:55 -0000 1.1
414 +// { dg-do compile { target ia64-*-linux* } }
415 +// { dg-options "-fPIC -fvisibility=hidden" }
416 +// { dg-final { scan-assembler-not "gprel" } }
418 +class __attribute__ ((visibility("default"))) Type
421 + static long _staticTypeCount;
423 + Type() { _staticTypeCount++; }
427 +long Type::_staticTypeCount = 0;
431 + _staticTypeCount--;
433 2005-05-07 Richard Henderson <rth@redhat.com>
436 * config/rs6000/rs6000.c (rs6000_emit_move): Look for tls addresses
437 with constant offsets.
439 2004-07-11 Ulrich Weigand <uweigand@de.ibm.com>
441 * config/s390/s390.c (legitimize_tls_address): Handle constant offsets
442 added to TLS symbol addresses.
444 2004-07-06 Richard Henderson <rth@redhat.com>
446 * config/i386/i386.c (legitimize_address): Handle CONST with TLS
448 (ix86_expand_move): Don't call legitimize_pic_address directly.
450 2006-05-05 Jakub Jelinek <jakub@redhat.com>
452 * gcc.dg/tls/opt-12.c: New test.
454 --- gcc/config/s390/s390.c (revision 84404)
455 +++ gcc/config/s390/s390.c (revision 84535)
456 @@ -2913,6 +2913,18 @@ legitimize_tls_address (rtx addr, rtx re
460 + else if (GET_CODE (addr) == CONST && GET_CODE (XEXP (addr, 0)) == PLUS
461 + && GET_CODE (XEXP (XEXP (addr, 0), 1)) == CONST_INT)
463 + new = XEXP (XEXP (addr, 0), 0);
464 + if (GET_CODE (new) != SYMBOL_REF)
465 + new = gen_rtx_CONST (Pmode, new);
467 + new = legitimize_tls_address (new, reg);
468 + new = plus_constant (new, INTVAL (XEXP (XEXP (addr, 0), 1)));
469 + new = force_operand (new, 0);
473 abort (); /* for now ... */
475 --- gcc/config/i386/i386.c 2005-11-21 14:56:49.000000000 +0100
476 +++ gcc/config/i386/i386.c 2006-05-05 11:21:54.000000000 +0200
477 @@ -6604,6 +6604,13 @@ legitimize_address (rtx x, rtx oldx ATTR
478 log = tls_symbolic_operand (x, mode);
480 return legitimize_tls_address (x, log, false);
481 + if (GET_CODE (x) == CONST
482 + && GET_CODE (XEXP (x, 0)) == PLUS
483 + && (log = tls_symbolic_operand (XEXP (XEXP (x, 0), 0), Pmode)))
485 + rtx t = legitimize_tls_address (XEXP (XEXP (x, 0), 0), log, false);
486 + return gen_rtx_PLUS (Pmode, t, XEXP (XEXP (x, 0), 1));
489 if (flag_pic && SYMBOLIC_CONST (x))
490 return legitimize_pic_address (x, 0);
491 @@ -8395,6 +8402,10 @@ ix86_expand_move (enum machine_mode mode
493 if (GET_CODE (op0) == MEM)
494 op1 = force_reg (Pmode, op1);
495 + else if (GET_CODE (op1) == CONST
496 + && GET_CODE (XEXP (op1, 0)) == PLUS
497 + && tls_symbolic_operand (XEXP (XEXP (op1, 0), 0), Pmode))
498 + op1 = legitimize_address (op1, op1, Pmode);
502 --- gcc/config/rs6000/rs6000.c (revision 99334)
503 +++ gcc/config/rs6000/rs6000.c (revision 99367)
504 @@ -4436,11 +4436,31 @@ rs6000_emit_move (rtx dest, rtx source,
506 /* Recognize the case where operand[1] is a reference to thread-local
507 data and load its address to a register. */
508 - if (GET_CODE (operands[1]) == SYMBOL_REF)
509 + if (rs6000_tls_referenced_p (operands[1]))
511 - enum tls_model model = SYMBOL_REF_TLS_MODEL (operands[1]);
513 - operands[1] = rs6000_legitimize_tls_address (operands[1], model);
514 + enum tls_model model;
515 + rtx tmp = operands[1];
518 + if (GET_CODE (tmp) == CONST && GET_CODE (XEXP (tmp, 0)) == PLUS)
520 + addend = XEXP (XEXP (tmp, 0), 1);
521 + tmp = XEXP (XEXP (tmp, 0), 0);
524 + if (GET_CODE (tmp) != SYMBOL_REF)
526 + model = SYMBOL_REF_TLS_MODEL (tmp);
530 + tmp = rs6000_legitimize_tls_address (tmp, model);
533 + tmp = gen_rtx_PLUS (mode, tmp, addend);
534 + tmp = force_operand (tmp, operands[0]);
539 /* Handle the case where reload calls us with an invalid address. */
540 --- gcc/testsuite/gcc.dg/tls/opt-9.c (revision 0)
541 +++ gcc/testsuite/gcc.dg/tls/opt-9.c (revision 99367)
544 +/* { dg-do compile */
545 +/* { dg-options "-O2 -fPIC" } */
547 +struct S { int x[10]; };
548 +extern __thread struct S s;
549 +int *foo() { return &s.x[2]; }
550 --- gcc/testsuite/gcc.dg/tls/opt-12.c 2006-04-19 19:21:31.748476000 +0200
551 +++ gcc/testsuite/gcc.dg/tls/opt-12.c 2006-05-05 11:01:33.000000000 +0200
553 +/* { dg-do compile } */
554 +/* { dg-options "-O2" } */
555 +/* { XXdgXX-require-effective-target tls } */
566 + __builtin_strcpy (thr.b, "abcd");
569 2005-07-22 Jakub Jelinek <jakub@redhat.com>
571 * src/sstream-inst.cc: Add .hidden directive for
572 streamsize basic_stringbuf<{char,wchar_t}>::showmanyc().
573 * src/sstream-inst-showmanyc.cc: New file.
574 * src/Makefile.am (libstdc++_nonshared.la): Add new library.
575 * src/Makefile.in: Rebuilt.
576 * testsuite/lib/libstdc++.exp: Append -lstdc++_nonshared for
577 testsuite executable linking.
579 2005-06-08 Benjamin Kosnik <bkoz@redhat.com>
582 * include/std/std_sstream.h (basic_stringbuf::showmanyc): Add.
583 * testsuite/27_io/basic_streambuf/in_avail/char/1.cc: New, test
585 * testsuite/27_io/basic_streambuf/in_avail/wchar_t/1.cc: Same.
586 * testsuite/27_io/basic_stringbuf/in_avail/char/21955.cc: New.
587 * testsuite/27_io/basic_stringbuf/in_avail/char/1.cc: Match
589 * testsuite/27_io/basic_stringbuf/str/char/1.cc: Same.
591 --- libstdc++-v3/src/sstream-inst.cc.jj 2003-07-11 10:28:13.000000000 +0200
592 +++ libstdc++-v3/src/sstream-inst.cc 2005-07-21 17:46:08.000000000 +0200
593 @@ -60,3 +60,8 @@ namespace std
594 template class basic_stringstream<wchar_t>;
599 +__asm (".hidden _ZNSt15basic_stringbufIcSt11char_traitsIcESaIcEE9showmanycEv");
600 +__asm (".hidden _ZNSt15basic_stringbufIwSt11char_traitsIwESaIwEE9showmanycEv");
602 --- libstdc++-v3/src/sstream-inst-showmanyc.cc.jj 2005-07-21 21:27:40.000000000 +0200
603 +++ libstdc++-v3/src/sstream-inst-showmanyc.cc 2005-07-22 09:16:58.000000000 +0200
605 +// Explicit instantiation file.
607 +// Copyright (C) 2005
608 +// Free Software Foundation, Inc.
610 +// This file is part of the GNU ISO C++ Library. This library is free
611 +// software; you can redistribute it and/or modify it under the
612 +// terms of the GNU General Public License as published by the
613 +// Free Software Foundation; either version 2, or (at your option)
614 +// any later version.
616 +// This library is distributed in the hope that it will be useful,
617 +// but WITHOUT ANY WARRANTY; without even the implied warranty of
618 +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
619 +// GNU General Public License for more details.
621 +// You should have received a copy of the GNU General Public License along
622 +// with this library; see the file COPYING. If not, write to the Free
623 +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
626 +// As a special exception, you may use this file as part of a free software
627 +// library without restriction. Specifically, if other files instantiate
628 +// templates or use macros or inline functions from this file, or you compile
629 +// this file and link it with other files to produce an executable, this
630 +// file does not by itself cause the resulting executable to be covered by
631 +// the GNU General Public License. This exception does not however
632 +// invalidate any other reasons why the executable file might be covered by
633 +// the GNU General Public License.
639 + // These symbols are hidden in libstdc++.so, as it is undesirable to export
641 + template streamsize basic_stringbuf<char, char_traits<char>, allocator<char> >::showmanyc();
642 + template streamsize basic_stringbuf<wchar_t, char_traits<wchar_t>, allocator<wchar_t> >::showmanyc();
644 --- libstdc++-v3/src/Makefile.am.jj 2004-04-20 15:55:47.000000000 +0200
645 +++ libstdc++-v3/src/Makefile.am 2005-07-22 09:00:32.000000000 +0200
647 include $(top_srcdir)/fragment.am
649 # Cross compiler support.
650 -toolexeclib_LTLIBRARIES = libstdc++.la
651 +toolexeclib_LTLIBRARIES = libstdc++.la libstdc++_nonshared.la
653 # Symbol versioning for shared libraries.
654 if GLIBCXX_BUILD_VERSIONED_SHLIB
655 @@ -150,6 +150,11 @@ libstdc___la_DEPENDENCIES = ${version_de
656 libstdc___la_LDFLAGS = \
657 -version-info $(libtool_VERSION) ${version_arg} -lm
659 +libstdc___nonshared_la_SOURCES = \
660 + sstream-inst-showmanyc.cc
661 +libstdc___nonshared_la_LIBADD =
662 +libstdc___nonshared_la_DEPENDENCIES = $(libstdc___nonshared_la_LIBADD)
663 +libstdc___nonshared_la_LDFLAGS = -static
665 # Use special rules for the deprecated source files so that they find
666 # deprecated include files.
667 @@ -159,6 +164,14 @@ strstream.lo: strstream.cc
668 strstream.o: strstream.cc
669 $(CXXCOMPILE) -I$(GLIBCXX_INCLUDE_DIR)/backward -Wno-deprecated -c $<
671 +# Use special rules for libstdc++_nonshared.la files, as -prefer-pic
672 +# doesn't seem to work for some reason.
673 +sstream-inst-showmanyc.lo: sstream-inst-showmanyc.cc
674 + $(LTCXXCOMPILE) -c $< \
675 + && cp -f .libs/sstream-inst-showmanyc.o sstream-inst-showmanyc.o
676 +sstream-inst-showmanyc.o: sstream-inst-showmanyc.cc
677 + $(CXXCOMPILE) -fPIC -DPIC -c $<
679 # Use special rules for the concept-checking instantiations so that all
680 # the generated template functions are also instantiated. Force the checks
681 # to be on so that the instantiations are actually seen.
682 --- libstdc++-v3/src/Makefile.in.jj 2004-04-20 15:55:47.000000000 +0200
683 +++ libstdc++-v3/src/Makefile.in 2005-07-22 09:06:15.000000000 +0200
684 @@ -221,7 +221,7 @@ WARN_CXXFLAGS = \
685 AM_CPPFLAGS = $(GLIBCXX_INCLUDES)
687 # Cross compiler support.
688 -toolexeclib_LTLIBRARIES = libstdc++.la
689 +toolexeclib_LTLIBRARIES = libstdc++.la libstdc++_nonshared.la
691 # Symbol versioning for shared libraries.
692 @GLIBCXX_BUILD_VERSIONED_SHLIB_TRUE@version_arg = -Wl,--version-script=libstdc++-symbol.ver
693 @@ -308,6 +308,13 @@ libstdc___la_LDFLAGS = \
694 -version-info $(libtool_VERSION) ${version_arg} -lm
697 +libstdc___nonshared_la_SOURCES = \
698 + sstream-inst-showmanyc.cc
700 +libstdc___nonshared_la_LIBADD =
701 +libstdc___nonshared_la_DEPENDENCIES = $(libstdc___nonshared_la_LIBADD)
702 +libstdc___nonshared_la_LDFLAGS = -static
704 # Use special rules for the deprecated source files so that they find
705 # deprecated include files.
706 GLIBCXX_INCLUDE_DIR = $(glibcxx_builddir)/include
707 @@ -379,6 +386,8 @@ am__objects_3 = allocator.lo codecvt.lo
708 $(am__objects_1) $(am__objects_2)
709 am_libstdc___la_OBJECTS = $(am__objects_3)
710 libstdc___la_OBJECTS = $(am_libstdc___la_OBJECTS)
711 +am_libstdc___nonshared_la_OBJECTS = sstream-inst-showmanyc.lo
712 +libstdc___nonshared_la_OBJECTS = $(am_libstdc___nonshared_la_OBJECTS)
714 DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)
716 @@ -386,10 +395,10 @@ am__depfiles_maybe =
717 CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
718 $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
720 -DIST_SOURCES = $(libstdc___la_SOURCES)
721 +DIST_SOURCES = $(libstdc___la_SOURCES) $(libstdc___nonshared_la_SOURCES)
722 DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/fragment.am \
724 -SOURCES = $(libstdc___la_SOURCES)
725 +SOURCES = $(libstdc___la_SOURCES) $(libstdc___nonshared_la_SOURCES)
729 @@ -430,6 +439,8 @@ clean-toolexeclibLTLIBRARIES:
731 libstdc++.la: $(libstdc___la_OBJECTS) $(libstdc___la_DEPENDENCIES)
732 $(CXXLINK) -rpath $(toolexeclibdir) $(libstdc___la_LDFLAGS) $(libstdc___la_OBJECTS) $(libstdc___la_LIBADD) $(LIBS)
733 +libstdc++_nonshared.la: $(libstdc___nonshared_la_OBJECTS) $(libstdc___nonshared_la_DEPENDENCIES)
734 + $(CXXLINK) -rpath $(toolexeclibdir) $(libstdc___nonshared_la_LDFLAGS) $(libstdc___nonshared_la_OBJECTS) $(libstdc___nonshared_la_LIBADD) $(LIBS)
737 -rm -f *.$(OBJEXT) core *.core
738 @@ -674,6 +685,14 @@ strstream.lo: strstream.cc
739 strstream.o: strstream.cc
740 $(CXXCOMPILE) -I$(GLIBCXX_INCLUDE_DIR)/backward -Wno-deprecated -c $<
742 +# Use special rules for libstdc++_nonshared.la files, as -prefer-pic
743 +# doesn't seem to work for some reason.
744 +sstream-inst-showmanyc.lo: sstream-inst-showmanyc.cc
745 + $(LTCXXCOMPILE) -c $< \
746 + && cp -f .libs/sstream-inst-showmanyc.o sstream-inst-showmanyc.o
747 +sstream-inst-showmanyc.o: sstream-inst-showmanyc.cc
748 + $(CXXCOMPILE) -fPIC -DPIC -c $<
750 # Use special rules for the concept-checking instantiations so that all
751 # the generated template functions are also instantiated. Force the checks
752 # to be on so that the instantiations are actually seen.
753 --- libstdc++-v3/include/std/std_sstream.h.jj 2004-10-04 14:58:25.000000000 +0200
754 +++ libstdc++-v3/include/std/std_sstream.h 2005-07-21 17:17:16.000000000 +0200
755 @@ -185,6 +185,18 @@ namespace std
756 _M_sync(const_cast<char_type*>(_M_string.data()), 0, __len);
762 + streamsize __ret = -1;
763 + if (_M_mode & ios_base::in)
766 + __ret = this->egptr() - this->gptr();
771 // [documentation is inherited]
774 --- libstdc++-v3/testsuite/27_io/basic_stringbuf/str/char/1.cc.jj 2003-10-01 12:12:11.000000000 +0200
775 +++ libstdc++-v3/testsuite/27_io/basic_stringbuf/str/char/1.cc 2005-07-22 01:22:15.000000000 +0200
776 @@ -45,7 +45,7 @@ void test03()
777 std::streamsize d1 = strb_01.in_avail();
778 std::streamsize d2 = strb_03.in_avail();
779 VERIFY( d1 ); // non-zero
780 - VERIFY( !d2 ); // zero, cuz ios_base::out
781 + VERIFY( d2 == -1 ); // -1, cuz ios_base::out
782 VERIFY( d1 != d2 ); //these should be the same
783 VERIFY( static_cast<std::streamsize>(str_01.length()) == d1 );
784 VERIFY( strb_01.str() == strb_03.str() ); //ditto
785 --- libstdc++-v3/testsuite/27_io/basic_stringbuf/in_avail/char/1.cc.jj 2003-10-01 12:12:10.000000000 +0200
786 +++ libstdc++-v3/testsuite/27_io/basic_stringbuf/in_avail/char/1.cc 2005-07-22 01:22:04.000000000 +0200
787 @@ -49,8 +49,8 @@ void test04()
788 VERIFY( strmof_1 == static_cast<std::streamoff>(str_01.length()) );
789 VERIFY( strmof_2 == static_cast<std::streamoff>(str_02.length()) );
790 strmof_1 = strb_03.in_avail();
791 - // zero cuz write-only, or eof()? zero, from showmany
792 - VERIFY( strmof_1 == 0 );
793 + // zero cuz write-only, or eof() to match basic_filebuf
794 + VERIFY( strmof_1 == -1 );
798 --- libstdc++-v3/testsuite/27_io/basic_stringbuf/in_avail/char/21955.cc.jj 2005-07-22 01:22:04.000000000 +0200
799 +++ libstdc++-v3/testsuite/27_io/basic_stringbuf/in_avail/char/21955.cc 2005-07-22 01:22:04.000000000 +0200
801 +// 2005-06-07 Benjamin Kosnik
803 +// Copyright (C) 2005
804 +// Free Software Foundation, Inc.
806 +// This file is part of the GNU ISO C++ Library. This library is free
807 +// software; you can redistribute it and/or modify it under the
808 +// terms of the GNU General Public License as published by the
809 +// Free Software Foundation; either version 2, or (at your option)
810 +// any later version.
812 +// This library is distributed in the hope that it will be useful,
813 +// but WITHOUT ANY WARRANTY; without even the implied warranty of
814 +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
815 +// GNU General Public License for more details.
817 +// You should have received a copy of the GNU General Public License along
818 +// with this library; see the file COPYING. If not, write to the Free
819 +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
823 +#include <testsuite_hooks.h>
824 +#include <stdexcept>
830 + char* source = "1918";
831 + std::stringstream s;
834 + std::string tmp = s.str();
835 + std::streambuf* sb = s.rdbuf();
836 + int i = sb->in_avail();
844 + throw std::runtime_error("conversion failed");
852 + test_stringstream();
855 --- libstdc++-v3/testsuite/27_io/basic_streambuf/in_avail/char/1.cc.jj 2005-07-22 01:21:41.000000000 +0200
856 +++ libstdc++-v3/testsuite/27_io/basic_streambuf/in_avail/char/1.cc 2005-07-22 01:21:41.000000000 +0200
858 +// 2005-06-07 Benjamin Kosnik <bkoz@redhat.com>
860 +// Copyright (C) 2005 Free Software Foundation, Inc.
862 +// This file is part of the GNU ISO C++ Library. This library is free
863 +// software; you can redistribute it and/or modify it under the
864 +// terms of the GNU General Public License as published by the
865 +// Free Software Foundation; either version 2, or (at your option)
866 +// any later version.
868 +// This library is distributed in the hope that it will be useful,
869 +// but WITHOUT ANY WARRANTY; without even the implied warranty of
870 +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
871 +// GNU General Public License for more details.
873 +// You should have received a copy of the GNU General Public License along
874 +// with this library; see the file COPYING. If not, write to the Free
875 +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
878 +// 27.8.1.4 Overridden virtual functions
881 +#include <testsuite_hooks.h>
883 +typedef std::basic_streambuf<char> streambuf_type;
885 +struct testbuf : streambuf_type
892 + typedef streambuf_type::int_type int_type;
893 + typedef streambuf_type::traits_type traits_type;
894 + typedef streambuf_type::pos_type pos_type;
895 + typedef streambuf_type::off_type off_type;
896 + typedef size_t size_type;
898 + bool test __attribute__((unused)) = true;
899 + std::streamoff strmof_1, strmof_2;
903 + strmof_1 = sb01.in_avail();
904 + VERIFY( strmof_1 == 0 );
912 --- libstdc++-v3/testsuite/27_io/basic_streambuf/in_avail/wchar_t/1.cc.jj 2005-07-22 01:21:41.000000000 +0200
913 +++ libstdc++-v3/testsuite/27_io/basic_streambuf/in_avail/wchar_t/1.cc 2005-07-22 01:21:41.000000000 +0200
915 +// 2005-06-07 Benjamin Kosnik <bkoz@redhat.com>
917 +// Copyright (C) 2005 Free Software Foundation, Inc.
919 +// This file is part of the GNU ISO C++ Library. This library is free
920 +// software; you can redistribute it and/or modify it under the
921 +// terms of the GNU General Public License as published by the
922 +// Free Software Foundation; either version 2, or (at your option)
923 +// any later version.
925 +// This library is distributed in the hope that it will be useful,
926 +// but WITHOUT ANY WARRANTY; without even the implied warranty of
927 +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
928 +// GNU General Public License for more details.
930 +// You should have received a copy of the GNU General Public License along
931 +// with this library; see the file COPYING. If not, write to the Free
932 +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
935 +// 27.8.1.4 Overridden virtual functions
938 +#include <testsuite_hooks.h>
940 +typedef std::basic_streambuf<wchar_t> streambuf_type;
942 +struct testbuf : streambuf_type
949 + typedef streambuf_type::int_type int_type;
950 + typedef streambuf_type::traits_type traits_type;
951 + typedef streambuf_type::pos_type pos_type;
952 + typedef streambuf_type::off_type off_type;
953 + typedef size_t size_type;
955 + bool test __attribute__((unused)) = true;
956 + std::streamoff strmof_1, strmof_2;
960 + strmof_1 = sb01.in_avail();
961 + VERIFY( strmof_1 == 0 );
969 --- libstdc++-v3/libsupc++/eh_globals.cc.jj 2005-11-21 14:43:32.000000000 +0100
970 +++ libstdc++-v3/libsupc++/eh_globals.cc 2006-04-21 15:38:55.000000000 +0200
973 using namespace __cxxabiv1;
976 +namespace __gnu_internal
978 + __cxxabiv1::__cxa_eh_globals*
979 + get_global() throw()
981 + static __thread __cxxabiv1::__cxa_eh_globals global __attribute__((tls_model ("initial-exec")));
986 +extern "C" __cxa_eh_globals*
987 +__cxxabiv1::__cxa_get_globals_fast() throw()
988 +{ return __gnu_internal::get_global(); }
990 +extern "C" __cxa_eh_globals*
991 +__cxxabiv1::__cxa_get_globals() throw()
992 +{ return __gnu_internal::get_global(); }
996 // Single-threaded fallback buffer.
997 static __cxa_eh_globals globals_static;
998 @@ -125,3 +145,4 @@ __cxa_get_globals () throw()
999 return &globals_static;
1003 2005-11-23 Paolo Carlini <pcarlini@suse.de>
1005 PR libstdc++/24975 (basic_string)
1006 * include/bits/basic_string.h (_Rep::_S_empty_rep): Avoid
1007 strict-aliasing warnings.
1009 2005-11-22 Paolo Carlini <pcarlini@suse.de>
1012 * include/bits/stl_set.h (insert(iterator, const value_type&),
1013 erase(iterator), erase(iterator, iterator)): Don't break aliasing
1014 rules casting to _Rep_iterator&, forward to _Rb_tree facilities.
1015 * include/bits/stl_multiset.h (insert(iterator, const value_type&),
1016 erase(iterator), erase(iterator, iterator)): Likewise.
1017 * include/bits/stl_tree.h (_Rb_tree<>::_M_insert(_Const_Base_ptr,
1018 _Const_Base_ptr, const value_type&), insert_unique(const_iterator,
1019 const value_type&), insert_equal(const_iterator, const value_type&),
1020 erase(const_iterator), erase(const_iterator, const_iterator)): New,
1021 _Rb_tree<>::const_iterator counterparts of existing facilities.
1023 --- libstdc++-v3/include/bits/basic_string.h.jj 2007-02-23 21:29:15.000000000 +0100
1024 +++ libstdc++-v3/include/bits/basic_string.h 2007-07-19 12:11:40.000000000 +0200
1025 @@ -175,7 +175,16 @@ namespace std
1029 - { return *reinterpret_cast<_Rep*>(&_S_empty_rep_storage); }
1032 + // Work around type-punning warning in g++4. _S_empty_rep_storage
1033 + // is never modified, so type-punning is ok.
1034 + void* __p = reinterpret_cast<void*>(&_S_empty_rep_storage);
1035 + return *reinterpret_cast<_Rep*>(__p);
1037 + return *reinterpret_cast<_Rep*>(&_S_empty_rep_storage);
1042 _M_is_leaked() const
1043 --- libstdc++-v3/include/bits/stl_tree.h.jj 2007-02-23 21:29:15.000000000 +0100
1044 +++ libstdc++-v3/include/bits/stl_tree.h 2007-07-19 13:18:28.000000000 +0200
1045 @@ -532,6 +532,12 @@ namespace std
1047 _M_insert(_Base_ptr __x, _Base_ptr __y, const value_type& __v);
1051 + _M_insert(_Const_Base_ptr __x, _Const_Base_ptr __y,
1052 + const value_type& __v);
1056 _M_copy(_Const_Link_type __x, _Link_type __p);
1058 @@ -631,9 +637,19 @@ namespace std
1060 insert_unique(iterator __position, const value_type& __x);
1064 + insert_unique(const_iterator __position, const value_type& __x);
1068 insert_equal(iterator __position, const value_type& __x);
1072 + insert_equal(const_iterator __position, const value_type& __x);
1075 template<typename _InputIterator>
1077 insert_unique(_InputIterator __first, _InputIterator __last);
1078 @@ -645,12 +661,22 @@ namespace std
1080 erase(iterator __position);
1084 + erase(const_iterator __position);
1088 erase(const key_type& __x);
1091 erase(iterator __first, iterator __last);
1095 + erase(const_iterator __first, const_iterator __last);
1099 erase(const key_type* __first, const key_type* __last);
1101 @@ -793,6 +819,28 @@ namespace std
1102 return iterator(__z);
1106 + template<typename _Key, typename _Val, typename _KeyOfValue,
1107 + typename _Compare, typename _Alloc>
1108 + typename _Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>::const_iterator
1109 + _Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>::
1110 + _M_insert(_Const_Base_ptr __x, _Const_Base_ptr __p, const _Val& __v)
1112 + _Link_type __z = _M_create_node(__v);
1113 + bool __insert_left;
1115 + __insert_left = __x != 0 || __p == _M_end()
1116 + || _M_impl._M_key_compare(_KeyOfValue()(__v),
1119 + _Rb_tree_insert_and_rebalance(__insert_left, __z,
1120 + const_cast<_Base_ptr>(__p),
1121 + this->_M_impl._M_header);
1122 + ++_M_impl._M_node_count;
1123 + return const_iterator(__z);
1127 template<typename _Key, typename _Val, typename _KeyOfValue,
1128 typename _Compare, typename _Alloc>
1129 typename _Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>::iterator
1130 @@ -928,6 +976,54 @@ namespace std
1135 + template<typename _Key, typename _Val, typename _KeyOfValue,
1136 + typename _Compare, typename _Alloc>
1137 + typename _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::const_iterator
1138 + _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::
1139 + insert_unique(const_iterator __position, const _Val& __v)
1141 + if (__position._M_node == _M_leftmost())
1145 + && _M_impl._M_key_compare(_KeyOfValue()(__v),
1146 + _S_key(__position._M_node)))
1147 + return _M_insert(__position._M_node, __position._M_node, __v);
1148 + // First argument just needs to be non-null.
1150 + return const_iterator(insert_unique(__v).first);
1152 + else if (__position._M_node == _M_end())
1155 + if (_M_impl._M_key_compare(_S_key(_M_rightmost()),
1156 + _KeyOfValue()(__v)))
1157 + return _M_insert(0, _M_rightmost(), __v);
1159 + return const_iterator(insert_unique(__v).first);
1163 + const_iterator __before = __position;
1165 + if (_M_impl._M_key_compare(_S_key(__before._M_node),
1166 + _KeyOfValue()(__v))
1167 + && _M_impl._M_key_compare(_KeyOfValue()(__v),
1168 + _S_key(__position._M_node)))
1170 + if (_S_right(__before._M_node) == 0)
1171 + return _M_insert(0, __before._M_node, __v);
1173 + return _M_insert(__position._M_node, __position._M_node, __v);
1174 + // First argument just needs to be non-null.
1177 + return const_iterator(insert_unique(__v).first);
1182 template<typename _Key, typename _Val, typename _KeyOfValue,
1183 typename _Compare, typename _Alloc>
1184 typename _Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>::iterator
1185 @@ -974,6 +1070,54 @@ namespace std
1190 + template<typename _Key, typename _Val, typename _KeyOfValue,
1191 + typename _Compare, typename _Alloc>
1192 + typename _Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>::const_iterator
1193 + _Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>::
1194 + insert_equal(const_iterator __position, const _Val& __v)
1196 + if (__position._M_node == _M_leftmost())
1200 + && !_M_impl._M_key_compare(_S_key(__position._M_node),
1201 + _KeyOfValue()(__v)))
1202 + return _M_insert(__position._M_node, __position._M_node, __v);
1203 + // first argument just needs to be non-null
1205 + return const_iterator(insert_equal(__v));
1207 + else if (__position._M_node == _M_end())
1210 + if (!_M_impl._M_key_compare(_KeyOfValue()(__v),
1211 + _S_key(_M_rightmost())))
1212 + return _M_insert(0, _M_rightmost(), __v);
1214 + return const_iterator(insert_equal(__v));
1218 + const_iterator __before = __position;
1220 + if (!_M_impl._M_key_compare(_KeyOfValue()(__v),
1221 + _S_key(__before._M_node))
1222 + && !_M_impl._M_key_compare(_S_key(__position._M_node),
1223 + _KeyOfValue()(__v)))
1225 + if (_S_right(__before._M_node) == 0)
1226 + return _M_insert(0, __before._M_node, __v);
1228 + return _M_insert(__position._M_node, __position._M_node, __v);
1229 + // First argument just needs to be non-null.
1232 + return const_iterator(insert_equal(__v));
1237 template<typename _Key, typename _Val, typename _KoV,
1238 typename _Cmp, typename _Alloc>
1240 @@ -1008,6 +1152,20 @@ namespace std
1241 --_M_impl._M_node_count;
1245 + template<typename _Key, typename _Val, typename _KeyOfValue,
1246 + typename _Compare, typename _Alloc>
1248 + _Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>::erase(const_iterator __position)
1251 + static_cast<_Link_type>(_Rb_tree_rebalance_for_erase(const_cast<_Base_ptr>(__position._M_node),
1252 + this->_M_impl._M_header));
1253 + destroy_node(__y);
1254 + --_M_impl._M_node_count;
1258 template<typename _Key, typename _Val, typename _KeyOfValue,
1259 typename _Compare, typename _Alloc>
1260 typename _Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>::size_type
1261 @@ -1082,6 +1240,20 @@ namespace std
1262 while (__first != __last) erase(__first++);
1266 + template<typename _Key, typename _Val, typename _KeyOfValue,
1267 + typename _Compare, typename _Alloc>
1269 + _Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>::
1270 + erase(const_iterator __first, const_iterator __last)
1272 + if (__first == begin() && __last == end())
1275 + while (__first != __last) erase(__first++);
1279 template<typename _Key, typename _Val, typename _KeyOfValue,
1280 typename _Compare, typename _Alloc>
1282 --- libstdc++-v3/include/bits/stl_multiset.h.jj 2007-02-23 21:29:15.000000000 +0100
1283 +++ libstdc++-v3/include/bits/stl_multiset.h 2007-07-19 12:30:47.000000000 +0200
1284 @@ -328,8 +328,12 @@ namespace _GLIBCXX_STD
1286 insert(iterator __position, const value_type& __x)
1289 + return _M_t.insert_equal(__position, __x);
1291 typedef typename _Rep_type::iterator _Rep_iterator;
1292 return _M_t.insert_equal((_Rep_iterator&)__position, __x);
1297 @@ -358,8 +362,12 @@ namespace _GLIBCXX_STD
1299 erase(iterator __position)
1302 + _M_t.erase(__position);
1304 typedef typename _Rep_type::iterator _Rep_iterator;
1305 _M_t.erase((_Rep_iterator&)__position);
1310 @@ -391,8 +399,12 @@ namespace _GLIBCXX_STD
1312 erase(iterator __first, iterator __last)
1315 + _M_t.erase(__first, __last);
1317 typedef typename _Rep_type::iterator _Rep_iterator;
1318 _M_t.erase((_Rep_iterator&)__first, (_Rep_iterator&)__last);
1323 --- libstdc++-v3/include/bits/stl_set.h.jj 2007-02-23 21:29:15.000000000 +0100
1324 +++ libstdc++-v3/include/bits/stl_set.h 2007-07-19 12:23:57.000000000 +0200
1325 @@ -337,8 +337,12 @@ namespace _GLIBCXX_STD
1327 insert(iterator __position, const value_type& __x)
1330 + return _M_t.insert_unique(__position, __x);
1332 typedef typename _Rep_type::iterator _Rep_iterator;
1333 return _M_t.insert_unique((_Rep_iterator&)__position, __x);
1338 @@ -366,8 +370,12 @@ namespace _GLIBCXX_STD
1340 erase(iterator __position)
1343 + _M_t.erase(__position);
1345 typedef typename _Rep_type::iterator _Rep_iterator;
1346 _M_t.erase((_Rep_iterator&)__position);
1351 @@ -398,8 +406,12 @@ namespace _GLIBCXX_STD
1353 erase(iterator __first, iterator __last)
1356 + _M_t.erase(__first, __last);
1358 typedef typename _Rep_type::iterator _Rep_iterator;
1359 _M_t.erase((_Rep_iterator&)__first, (_Rep_iterator&)__last);
1364 2006-02-27 Jakub Jelinek <jakub@redhat.com>
1367 * unwind-dw2.c (struct _Unwind_Context): Add signal_frame field.
1368 (_Unwind_FrameState): Add signal_frame field.
1369 (extract_cie_info): Handle S flag in augmentation string.
1370 (execute_cfa_program): If context->signal_frame, execute also
1371 fs->pc == context->ra instructions.
1372 (uw_frame_state_for): If context->signal_frame, don't subtract one
1373 from context->ra to find FDE.
1374 (uw_update_context_1): Set context->signal_frame to
1376 (_Unwind_GetIPInfo): New function.
1377 * unwind-c.c (PERSONALITY_FUNCTION): Use _Unwind_GetIPInfo instead
1379 * unwind-sjlj.c (_Unwind_GetIPInfo): New function.
1380 * unwind.h (_Unwind_GetIPInfo): New prototype.
1381 * unwind-compat.c (_Unwind_GetIPInfo): New function.
1382 * libgcc-std.ver (_Unwind_GetIPInfo): Export @@GCC_4.2.0.
1383 * config/ia64/unwind-ia64.c (_Unwind_GetIPInfo): New function.
1384 * config/i386/linux.h (MD_FALLBACK_FRAME_STATE_FOR): Set
1386 * config/i386/linux64.h (MD_FALLBACK_FRAME_STATE_FOR): Likewise.
1387 * config/rs6000/linux-unwind.h (MD_FALLBACK_FRAME_STATE_FOR): Likewise.
1388 * config/s390/linux.h (MD_FALLBACK_FRAME_STATE_FOR): Likewise.
1390 * libsupc++/eh_personality.cc (PERSONALITY_FUNCTION): Use
1391 _Unwind_GetIPInfo instead of _Unwind_GetIP.
1393 * exception.cc (PERSONALITY_FUNCTION): Use _Unwind_GetIPInfo instead
1395 * include/i386-signal.h (MAKE_THROW_FRAME): Change into empty macro.
1396 (HANDLE_DIVIDE_OVERFLOW): Don't adjust _res->eip if falling through
1398 * include/x86_64-signal.h (MAKE_THROW_FRAME): Change into empty
1400 * include/powerpc-signal.h (MAKE_THROW_FRAME): Change into empty
1403 --- libjava/exception.cc.jj 2005-11-21 14:47:25.000000000 +0100
1404 +++ libjava/exception.cc 2006-04-21 14:00:19.000000000 +0200
1405 @@ -199,6 +199,7 @@ PERSONALITY_FUNCTION (int version,
1406 int handler_switch_value;
1409 + int ip_before_insn = 0;
1412 // Interface version check.
1413 @@ -214,10 +215,10 @@ PERSONALITY_FUNCTION (int version,
1414 goto install_context;
1417 - // FIXME: In Phase 1, record _Unwind_GetIP in xh->obj as a part of
1418 + // FIXME: In Phase 1, record _Unwind_GetIPInfo in xh->obj as a part of
1419 // the stack trace for this exception. This will only collect Java
1420 // frames, but perhaps that is acceptable.
1421 - // FIXME2: _Unwind_GetIP is nonsensical for SJLJ, being a call-site
1422 + // FIXME2: _Unwind_GetIPInfo is nonsensical for SJLJ, being a call-site
1423 // index instead of a PC value. We could perhaps arrange for
1424 // _Unwind_GetRegionStart to return context->fc->jbuf[1], which
1425 // is the address of the handler label for __builtin_longjmp, but
1426 @@ -232,7 +233,9 @@ PERSONALITY_FUNCTION (int version,
1428 // Parse the LSDA header.
1429 p = parse_lsda_header (context, language_specific_data, &info);
1430 - ip = _Unwind_GetIP (context) - 1;
1431 + ip = _Unwind_GetIPInfo (context, &ip_before_insn);
1432 + if (! ip_before_insn)
1436 handler_switch_value = 0;
1437 --- libjava/include/i386-signal.h.jj 2005-11-21 14:47:15.000000000 +0100
1438 +++ libjava/include/i386-signal.h 2006-04-21 14:57:55.000000000 +0200
1439 @@ -22,19 +22,7 @@ details. */
1440 #define SIGNAL_HANDLER(_name) \
1441 static void _name (int _dummy)
1443 -#define MAKE_THROW_FRAME(_exception) \
1446 - void **_p = (void **)&_dummy; \
1447 - struct sigcontext_struct *_regs = (struct sigcontext_struct *)++_p; \
1449 - /* Advance the program counter so that it is after the start of the \
1450 - instruction: the x86 exception handler expects \
1451 - the PC to point to the instruction after a call. */ \
1452 - _regs->eip += 2; \
1456 +#define MAKE_THROW_FRAME(_exception)
1458 #define HANDLE_DIVIDE_OVERFLOW \
1460 @@ -84,14 +72,6 @@ do \
1461 _regs->eip = (unsigned long)_eip; \
1466 - /* Advance the program counter so that it is after the start \
1467 - of the instruction: this is because the x86 exception \
1468 - handler expects the PC to point to the instruction after a \
1470 - _regs->eip += 2; \
1475 --- libjava/include/x86_64-signal.h.jj 2006-04-20 17:02:27.000000000 +0200
1476 +++ libjava/include/x86_64-signal.h 2006-04-21 14:00:19.000000000 +0200
1477 @@ -34,17 +34,7 @@ extern "C"
1481 -#define MAKE_THROW_FRAME(_exception) \
1484 - /* Advance the program counter so that it is after the start of the \
1485 - instruction: the x86_64 exception handler expects \
1486 - the PC to point to the instruction after a call. */ \
1487 - struct ucontext *_uc = (struct ucontext *)_p; \
1488 - volatile struct sigcontext *_sc = (struct sigcontext *) &_uc->uc_mcontext; \
1492 +#define MAKE_THROW_FRAME(_exception)
1494 #define RESTORE(name, syscall) RESTORE2 (name, syscall)
1495 #define RESTORE2(name, syscall) \
1496 --- libjava/include/powerpc-signal.h.jj 2005-11-21 14:47:15.000000000 +0100
1497 +++ libjava/include/powerpc-signal.h 2006-04-21 14:00:19.000000000 +0200
1498 @@ -22,18 +22,12 @@ details. */
1499 #define SIGNAL_HANDLER(_name) \
1500 static void _name (int /* _signal */, struct sigcontext *_sc)
1502 -/* PPC either leaves PC pointing at a faulting instruction or the
1503 - following instruction, depending on the signal. SEGV always does
1504 - the former, so we adjust the saved PC to point to the following
1505 - instruction. This is what the handler in libgcc expects. */
1506 +/* MD_FALBACK_FRAME_STATE_FOR takes care of special casing PC
1507 + before the faulting instruction, so we don't need to do anything
1510 +#define MAKE_THROW_FRAME(_exception)
1512 -#define MAKE_THROW_FRAME(_exception) \
1515 - _sc->regs->nip += 4; \
1519 /* For an explanation why we cannot simply use sigaction to
1520 install the handlers, see i386-signal.h. */
1522 --- libstdc++-v3/libsupc++/eh_personality.cc.jj 2005-11-21 14:43:32.000000000 +0100
1523 +++ libstdc++-v3/libsupc++/eh_personality.cc 2006-04-21 14:24:34.000000000 +0200
1524 @@ -201,6 +201,7 @@ PERSONALITY_FUNCTION (int version,
1525 _Unwind_Ptr landing_pad, ip;
1526 int handler_switch_value;
1527 void *thrown_ptr = xh + 1;
1528 + int ip_before_insn = 0;
1530 // Interface version check.
1532 @@ -227,7 +228,9 @@ PERSONALITY_FUNCTION (int version,
1533 // Parse the LSDA header.
1534 p = parse_lsda_header (context, language_specific_data, &info);
1535 info.ttype_base = base_of_encoded_value (info.ttype_encoding, context);
1536 - ip = _Unwind_GetIP (context) - 1;
1537 + ip = _Unwind_GetIPInfo (context, &ip_before_insn);
1538 + if (! ip_before_insn)
1542 handler_switch_value = 0;
1543 --- gcc/libgcc-std.ver.jj 2005-11-21 14:43:21.000000000 +0100
1544 +++ gcc/libgcc-std.ver 2006-04-21 14:02:13.000000000 +0200
1545 @@ -234,3 +234,8 @@ GCC_3.4.4 {
1550 +%inherit GCC_4.2.0 GCC_3.4.4
1554 --- gcc/unwind-c.c.jj 2005-11-21 14:43:20.000000000 +0100
1555 +++ gcc/unwind-c.c 2006-04-21 14:00:08.000000000 +0200
1556 @@ -102,6 +102,7 @@ PERSONALITY_FUNCTION (int version,
1557 lsda_header_info info;
1558 const unsigned char *language_specific_data, *p, *action_record;
1559 _Unwind_Ptr landing_pad, ip;
1560 + int ip_before_insn = 0;
1563 return _URC_FATAL_PHASE1_ERROR;
1564 @@ -119,7 +120,9 @@ PERSONALITY_FUNCTION (int version,
1566 /* Parse the LSDA header. */
1567 p = parse_lsda_header (context, language_specific_data, &info);
1568 - ip = _Unwind_GetIP (context) - 1;
1569 + ip = _Unwind_GetIPInfo (context, &ip_before_insn);
1570 + if (! ip_before_insn)
1574 #ifdef __USING_SJLJ_EXCEPTIONS__
1575 --- gcc/config/s390/linux.h.jj 2005-11-21 14:40:55.000000000 +0100
1576 +++ gcc/config/s390/linux.h 2006-04-21 14:15:46.000000000 +0200
1577 @@ -113,6 +113,7 @@ Software Foundation, 59 Temple Place - S
1578 } __attribute__ ((__aligned__ (8))) sigregs_; \
1581 + int *signo_ = NULL; \
1583 /* svc $__NR_sigreturn or svc $__NR_rt_sigreturn */ \
1584 if (pc_[0] != 0x0a || (pc_[1] != 119 && pc_[1] != 173)) \
1585 @@ -133,6 +134,7 @@ Software Foundation, 59 Temple Place - S
1586 } *uc_ = (CONTEXT)->cfa + 8 + 128; \
1588 regs_ = &uc_->uc_mcontext; \
1589 + signo_ = (CONTEXT)->cfa + sizeof(long); \
1592 /* Old-style RT frame and all non-RT frames: \
1593 @@ -141,6 +143,11 @@ Software Foundation, 59 Temple Place - S
1596 regs_ = *(sigregs_ **)((CONTEXT)->cfa + 8); \
1597 + /* Recent kernels store the signal number immediately after \
1598 + the sigregs; old kernels have the return trampoline at \
1599 + this location. */ \
1600 + if ((void *)(regs_ + 1) != (CONTEXT)->ra) \
1601 + signo_ = (int *)(regs_ + 1); \
1604 new_cfa_ = regs_->gprs[15] + 16*sizeof(long) + 32; \
1605 @@ -167,6 +174,12 @@ Software Foundation, 59 Temple Place - S
1606 (FS)->regs.reg[32].loc.offset = (long)®s_->psw_addr - new_cfa_; \
1607 (FS)->retaddr_column = 32; \
1609 + /* SIGILL, SIGFPE and SIGTRAP are delivered with psw_addr \
1610 + after the faulting instruction rather than before it. \
1611 + Don't set FS->signal_frame in that case. */ \
1612 + if (!signo_ || (*signo_ != 4 && *signo_ != 5 && *signo_ != 8)) \
1613 + (FS)->signal_frame = 1; \
1618 --- gcc/config/i386/linux.h.jj 2005-11-21 14:41:07.000000000 +0100
1619 +++ gcc/config/i386/linux.h 2006-04-21 14:18:05.000000000 +0200
1620 @@ -268,6 +268,7 @@ Boston, MA 02111-1307, USA. */
1621 (FS)->regs.reg[8].how = REG_SAVED_OFFSET; \
1622 (FS)->regs.reg[8].loc.offset = (long)&sc_->eip - new_cfa_; \
1623 (FS)->retaddr_column = 8; \
1624 + (FS)->signal_frame = 1; \
1627 #endif /* not USE_GNULIBC_1 */
1628 --- gcc/config/i386/linux64.h.jj 2005-11-21 14:41:07.000000000 +0100
1629 +++ gcc/config/i386/linux64.h 2006-04-21 14:18:45.000000000 +0200
1630 @@ -136,6 +136,7 @@ Boston, MA 02111-1307, USA. */
1631 (FS)->regs.reg[16].how = REG_SAVED_OFFSET; \
1632 (FS)->regs.reg[16].loc.offset = (long)&sc_->rip - new_cfa_; \
1633 (FS)->retaddr_column = 16; \
1634 + (FS)->signal_frame = 1; \
1637 #else /* ifdef __x86_64__ */
1638 @@ -190,6 +191,7 @@ Boston, MA 02111-1307, USA. */
1639 (FS)->regs.reg[8].how = REG_SAVED_OFFSET; \
1640 (FS)->regs.reg[8].loc.offset = (long)&sc_->eip - new_cfa_; \
1641 (FS)->retaddr_column = 8; \
1642 + (FS)->signal_frame = 1; \
1645 #endif /* ifdef __x86_64__ */
1646 --- gcc/config/ia64/unwind-ia64.c.jj 2005-11-21 14:40:57.000000000 +0100
1647 +++ gcc/config/ia64/unwind-ia64.c 2006-04-21 14:00:11.000000000 +0200
1648 @@ -1748,6 +1748,13 @@ _Unwind_GetIP (struct _Unwind_Context *c
1653 +_Unwind_GetIPInfo (struct _Unwind_Context *context, int *ip_before_insn)
1655 + *ip_before_insn = 0;
1656 + return context->rp;
1659 /* Overwrite the return address for CONTEXT with VAL. */
1662 --- gcc/unwind-compat.c.jj 2005-11-21 14:43:20.000000000 +0100
1663 +++ gcc/unwind-compat.c 2006-04-21 13:59:59.000000000 +0200
1664 @@ -134,6 +134,13 @@ _Unwind_GetIP (struct _Unwind_Context *c
1666 symver (_Unwind_GetIP, GCC_3.0);
1669 +_Unwind_GetIPInfo (struct _Unwind_Context *context, int *ip_before_insn)
1671 + *ip_before_insn = 0;
1672 + return __libunwind_Unwind_GetIP (context);
1675 extern void *__libunwind_Unwind_GetLanguageSpecificData
1676 (struct _Unwind_Context *);
1678 --- gcc/unwind-sjlj.c.jj 2005-11-21 14:43:21.000000000 +0100
1679 +++ gcc/unwind-sjlj.c 2006-04-21 14:00:08.000000000 +0200
1680 @@ -202,6 +202,13 @@ _Unwind_GetIP (struct _Unwind_Context *c
1681 return context->fc->call_site + 1;
1685 +_Unwind_GetIPInfo (struct _Unwind_Context *context, int *ip_before_insn)
1687 + *ip_before_insn = 0;
1688 + return context->fc->call_site + 1;
1691 /* Set the return landing pad index in CONTEXT. */
1694 --- gcc/unwind.h.jj 2005-11-21 14:43:20.000000000 +0100
1695 +++ gcc/unwind.h 2006-04-21 14:08:51.000000000 +0200
1696 @@ -151,6 +151,7 @@ extern _Unwind_Word _Unwind_GetGR (struc
1697 extern void _Unwind_SetGR (struct _Unwind_Context *, int, _Unwind_Word);
1699 extern _Unwind_Ptr _Unwind_GetIP (struct _Unwind_Context *);
1700 +extern _Unwind_Ptr _Unwind_GetIPInfo (struct _Unwind_Context *, int *);
1701 extern void _Unwind_SetIP (struct _Unwind_Context *, _Unwind_Ptr);
1703 /* @@@ Retrieve the CFA of the given context. */
1704 --- gcc/unwind-dw2.c.jj 2005-11-21 14:43:21.000000000 +0100
1705 +++ gcc/unwind-dw2.c 2006-04-21 14:05:32.000000000 +0200
1706 @@ -82,6 +82,7 @@ struct _Unwind_Context
1708 struct dwarf_eh_bases bases;
1709 _Unwind_Word args_size;
1710 + char signal_frame;
1713 /* Byte size of every register managed by these routines. */
1714 @@ -137,6 +138,7 @@ typedef struct
1715 unsigned char fde_encoding;
1716 unsigned char lsda_encoding;
1717 unsigned char saw_z;
1718 + unsigned char signal_frame;
1720 } _Unwind_FrameState;
1722 @@ -271,6 +273,16 @@ _Unwind_GetIP (struct _Unwind_Context *c
1723 return (_Unwind_Ptr) context->ra;
1726 +/* Retrieve the return address and flag whether that IP is before
1727 + or after first not yet fully executed instruction. */
1730 +_Unwind_GetIPInfo (struct _Unwind_Context *context, int *ip_before_insn)
1732 + *ip_before_insn = context->signal_frame != 0;
1733 + return (_Unwind_Ptr) context->ra;
1736 /* Overwrite the return address for CONTEXT with VAL. */
1739 @@ -382,6 +394,13 @@ extract_cie_info (const struct dwarf_cie
1743 + /* "S" indicates a signal frame. */
1744 + else if (aug[0] == 'S')
1746 + fs->signal_frame = 1;
1750 /* Otherwise we have an unknown augmentation string.
1751 Bail unless we saw a 'z' prefix. */
1753 @@ -818,8 +837,10 @@ execute_cfa_program (const unsigned char
1754 a different stack configuration that we are not interested in. We
1755 assume that the call itself is unwind info-neutral; if not, or if
1756 there are delay instructions that adjust the stack, these must be
1757 - reflected at the point immediately before the call insn. */
1758 - while (insn_ptr < insn_end && fs->pc < context->ra)
1759 + reflected at the point immediately before the call insn.
1760 + In signal frames, return address is after last completed instruction,
1761 + so we add 1 to return address to make the comparison <=. */
1762 + while (insn_ptr < insn_end && fs->pc < context->ra + context->signal_frame)
1764 unsigned char insn = *insn_ptr++;
1765 _Unwind_Word reg, utmp;
1766 @@ -1021,7 +1042,8 @@ uw_frame_state_for (struct _Unwind_Conte
1767 if (context->ra == 0)
1768 return _URC_END_OF_STACK;
1770 - fde = _Unwind_Find_FDE (context->ra - 1, &context->bases);
1771 + fde = _Unwind_Find_FDE (context->ra + context->signal_frame - 1,
1775 /* Couldn't find frame unwind info for this function. Try a
1776 @@ -1376,6 +1398,8 @@ uw_update_context_1 (struct _Unwind_Cont
1780 + context->signal_frame = fs->signal_frame;
1782 MD_FROB_UPDATE_CONTEXT (context, fs);
1785 --- gcc/unwind-dw2.c.jj 2006-05-22 13:39:48.000000000 -0400
1786 +++ gcc/unwind-dw2.c 2006-05-22 13:48:20.000000000 -0400
1788 #include "unwind-pe.h"
1789 #include "unwind-dw2-fde.h"
1791 +#include <endian.h>
1794 #ifndef __USING_SJLJ_EXCEPTIONS__
1795 @@ -81,8 +82,15 @@ struct _Unwind_Context
1798 struct dwarf_eh_bases bases;
1799 - _Unwind_Word args_size;
1800 - char signal_frame;
1801 +#if __BYTE_ORDER == __BIG_ENDIAN
1802 + _Unwind_Word signal_frame : 1;
1803 + _Unwind_Word args_size : sizeof (_Unwind_Word) * 8 - 1;
1804 +#elif __BYTE_ORDER == __LITTLE_ENDIAN
1805 + _Unwind_Word args_size : sizeof (_Unwind_Word) * 8 - 1;
1806 + _Unwind_Word signal_frame : 1;
1808 +#error Unknown endianity
1812 /* Byte size of every register managed by these routines. */
1813 @@ -1003,7 +1011,13 @@ execute_cfa_program (const unsigned char
1816 case DW_CFA_GNU_args_size:
1817 - insn_ptr = read_uleb128 (insn_ptr, &context->args_size);
1819 + _Unwind_Word args_size;
1820 + insn_ptr = read_uleb128 (insn_ptr, &args_size);
1821 + context->args_size = args_size;
1822 + if (context->args_size != args_size)
1827 case DW_CFA_GNU_negative_offset_extended:
1828 --- libjava/exception.cc.jj 2006-05-22 13:39:48.000000000 -0400
1829 +++ libjava/exception.cc 2006-05-22 14:48:30.000000000 -0400
1830 @@ -31,6 +31,153 @@ namespace std
1834 +#if defined PIC && !defined __ia64__
1840 +static void *libgcc_s_handle;
1842 +_Unwind_Reason_Code __attribute__((visibility ("hidden")))
1843 +_Unwind_RaiseException (struct _Unwind_Exception *exc)
1845 + static _Unwind_Reason_Code (*RaiseException) (struct _Unwind_Exception *);
1847 + if (RaiseException == NULL)
1849 + if (libgcc_s_handle == NULL)
1850 + libgcc_s_handle = dlopen ("libgcc_s.so.1", RTLD_LAZY);
1851 + RaiseException = (__typeof (RaiseException))
1852 + dlsym (libgcc_s_handle, "_Unwind_RaiseException");
1854 + return RaiseException (exc);
1857 +void __attribute__((visibility ("hidden")))
1858 +_Unwind_Resume (struct _Unwind_Exception *exc)
1860 + static void (*Resume) (struct _Unwind_Exception *);
1862 + if (Resume == NULL)
1864 + if (libgcc_s_handle == NULL)
1865 + libgcc_s_handle = dlopen ("libgcc_s.so.1", RTLD_LAZY);
1866 + Resume = (__typeof (Resume))
1867 + dlsym (libgcc_s_handle, "_Unwind_Resume");
1872 +__attribute__((visibility ("hidden"))) void *
1873 +_Unwind_GetLanguageSpecificData (struct _Unwind_Context *ctx)
1875 + static void * (*GetLanguageSpecificData) (struct _Unwind_Context *);
1877 + if (GetLanguageSpecificData == NULL)
1879 + if (libgcc_s_handle == NULL)
1880 + libgcc_s_handle = dlopen ("libgcc_s.so.1", RTLD_LAZY);
1881 + GetLanguageSpecificData = (__typeof (GetLanguageSpecificData))
1882 + dlsym (libgcc_s_handle, "_Unwind_GetLanguageSpecificData");
1884 + return GetLanguageSpecificData (ctx);
1887 +_Unwind_Ptr __attribute__((visibility ("hidden")))
1888 +_Unwind_GetRegionStart (struct _Unwind_Context *ctx)
1890 + static _Unwind_Ptr (*GetRegionStart) (struct _Unwind_Context *);
1892 + if (GetRegionStart == NULL)
1894 + if (libgcc_s_handle == NULL)
1895 + libgcc_s_handle = dlopen ("libgcc_s.so.1", RTLD_LAZY);
1896 + GetRegionStart = (__typeof (GetRegionStart))
1897 + dlsym (libgcc_s_handle, "_Unwind_GetRegionStart");
1899 + return GetRegionStart (ctx);
1902 +_Unwind_Ptr __attribute__((visibility ("hidden")))
1903 +_Unwind_GetDataRelBase (struct _Unwind_Context *ctx)
1905 + static _Unwind_Ptr (*GetDataRelBase) (struct _Unwind_Context *);
1907 + if (GetDataRelBase == NULL)
1909 + if (libgcc_s_handle == NULL)
1910 + libgcc_s_handle = dlopen ("libgcc_s.so.1", RTLD_LAZY);
1911 + GetDataRelBase = (__typeof (GetDataRelBase))
1912 + dlsym (libgcc_s_handle, "_Unwind_GetDataRelBase");
1914 + return GetDataRelBase (ctx);
1917 +_Unwind_Ptr __attribute__((visibility ("hidden")))
1918 +_Unwind_GetTextRelBase (struct _Unwind_Context *ctx)
1920 + static _Unwind_Ptr (*GetTextRelBase) (struct _Unwind_Context *);
1922 + if (GetTextRelBase == NULL)
1924 + if (libgcc_s_handle == NULL)
1925 + libgcc_s_handle = dlopen ("libgcc_s.so.1", RTLD_LAZY);
1926 + GetTextRelBase = (__typeof (GetTextRelBase))
1927 + dlsym (libgcc_s_handle, "_Unwind_GetTextRelBase");
1929 + return GetTextRelBase (ctx);
1932 +_Unwind_Ptr __attribute__((visibility ("hidden")))
1933 +_Unwind_GetIPInfo (struct _Unwind_Context *ctx, int *ip)
1935 + static _Unwind_Ptr (*GetIPInfo) (struct _Unwind_Context *, int *ip);
1937 + if (GetIPInfo == NULL)
1939 + if (libgcc_s_handle == NULL)
1940 + libgcc_s_handle = dlopen ("libgcc_s.so.1", RTLD_LAZY);
1941 + GetIPInfo = (__typeof (GetIPInfo))
1942 + dlsym (libgcc_s_handle, "_Unwind_GetIPInfo");
1944 + return GetIPInfo (ctx, ip);
1947 +void __attribute__((visibility ("hidden")))
1948 +_Unwind_SetIP (struct _Unwind_Context *ctx, _Unwind_Ptr ip)
1950 + static void (*SetIP) (struct _Unwind_Context *, _Unwind_Ptr ip);
1952 + if (SetIP == NULL)
1954 + if (libgcc_s_handle == NULL)
1955 + libgcc_s_handle = dlopen ("libgcc_s.so.1", RTLD_LAZY);
1956 + SetIP = (__typeof (SetIP))
1957 + dlsym (libgcc_s_handle, "_Unwind_SetIP");
1962 +void __attribute__((visibility ("hidden")))
1963 +_Unwind_SetGR (struct _Unwind_Context *ctx, int num, _Unwind_Ptr gr)
1965 + static void (*SetGR) (struct _Unwind_Context *, int num, _Unwind_Ptr gr);
1967 + if (SetGR == NULL)
1969 + if (libgcc_s_handle == NULL)
1970 + libgcc_s_handle = dlopen ("libgcc_s.so.1", RTLD_LAZY);
1971 + SetGR = (__typeof (SetGR))
1972 + dlsym (libgcc_s_handle, "_Unwind_SetGR");
1974 + SetGR (ctx, num, gr);
1981 struct alignment_test_struct
1984 2005-05-08 Roger Sayle <roger@eyesopen.com>
1987 * stmt.c (expand_asm_operands): Avoid calling force_reg on BLKmode
1990 * gcc.dg/pr8788-1.c: New testcase.
1992 --- gcc/stmt.c (revision 99421)
1993 +++ gcc/stmt.c (revision 99422)
1994 @@ -877,7 +877,7 @@ expand_asm_operands (tree string, tree o
1996 if (asm_operand_ok (op, constraint) <= 0)
1999 + if (allows_reg && TYPE_MODE (type) != BLKmode)
2000 op = force_reg (TYPE_MODE (type), op);
2001 else if (!allows_mem)
2002 warning (0, "asm operand %d probably doesn%'t match constraints",
2003 --- gcc/testsuite/gcc.dg/pr8788-1.c (revision 0)
2004 +++ gcc/testsuite/gcc.dg/pr8788-1.c (revision 99422)
2006 +/* PR inline-asm/8788 */
2007 +/* { dg-do compile } */
2008 +/* { dg-options "-O2" } */
2018 +void switch_to_stack (my_stack *stack){
2019 + asm ( /* { dg-error "impossible constraint" } */
2020 +/* { dg-warning "asm operand 1" "asm operand 1" { target *-*-* } 14 } */
2022 + : "+r" (stack->regs)
2026 2005-11-30 Alexandre Oliva <aoliva@redhat.com>
2028 * gcc.c (find_a_file): Use update_path before access tests.
2029 Mostly from Thomas Walker <thomas.walker@morganstanley.com>
2030 * prefix.c (update_path): Move dir/../-stripping code to...
2031 (maybe_strip_dotdots): New function. Reorganize.
2033 --- gcc/gcc.c.orig 2005-12-01 18:38:38.000000000 -0200
2034 +++ gcc/gcc.c 2005-12-01 18:41:01.000000000 -0200
2035 @@ -2371,7 +2371,7 @@
2036 find_a_file (struct path_prefix *pprefix, const char *name, int mode,
2040 + char *temp, *temp2;
2041 const char *const file_suffix =
2042 ((mode & X_OK) != 0 ? HOST_EXECUTABLE_SUFFIX : "");
2043 struct prefix_list *pl;
2044 @@ -2407,19 +2407,18 @@
2048 - temp = xmalloc (len);
2050 /* Determine the filename to execute (special case for absolute paths). */
2052 if (IS_ABSOLUTE_PATH (name))
2054 - if (access (name, mode) == 0)
2056 - strcpy (temp, name);
2059 + /* IS_ABSOLUTE_PATHNAME lets anything through that starts with '/' */
2060 + temp = update_path (name, NULL);
2061 + if (access (temp, mode) == 0)
2066 + temp = xmalloc (len);
2067 for (pl = pprefix->plist; pl; pl = pl->next)
2069 const char *this_name
2070 @@ -2435,24 +2434,30 @@
2071 strcat (temp, machine_suffix);
2072 strcat (temp, multilib_name);
2073 strcat (temp, file_suffix);
2074 - if (access_check (temp, mode) == 0)
2075 + temp2 = update_path (temp, NULL);
2076 + if (access_check (temp2, mode) == 0)
2078 if (pl->used_flag_ptr != 0)
2079 *pl->used_flag_ptr = 1;
2087 /* Now try just the multilib_name. */
2088 strcpy (temp, pl->prefix);
2089 strcat (temp, machine_suffix);
2090 strcat (temp, multilib_name);
2091 - if (access_check (temp, mode) == 0)
2092 + temp2 = update_path (temp, NULL);
2093 + if (access_check (temp2, mode) == 0)
2095 if (pl->used_flag_ptr != 0)
2096 *pl->used_flag_ptr = 1;
2104 /* Certain prefixes are tried with just the machine type,
2105 @@ -2467,23 +2472,29 @@
2106 strcat (temp, just_machine_suffix);
2107 strcat (temp, multilib_name);
2108 strcat (temp, file_suffix);
2109 - if (access_check (temp, mode) == 0)
2110 + temp2 = update_path (temp, NULL);
2111 + if (access_check (temp2, mode) == 0)
2113 if (pl->used_flag_ptr != 0)
2114 *pl->used_flag_ptr = 1;
2122 strcpy (temp, pl->prefix);
2123 strcat (temp, just_machine_suffix);
2124 strcat (temp, multilib_name);
2125 - if (access_check (temp, mode) == 0)
2126 + temp2 = update_path (temp, NULL);
2127 + if (access_check (temp2, mode) == 0)
2129 if (pl->used_flag_ptr != 0)
2130 *pl->used_flag_ptr = 1;
2138 /* Certain prefixes can't be used without the machine suffix
2139 @@ -2497,24 +2508,31 @@
2140 strcpy (temp, pl->prefix);
2141 strcat (temp, this_name);
2142 strcat (temp, file_suffix);
2143 - if (access_check (temp, mode) == 0)
2144 + temp2 = update_path (temp, NULL);
2145 + if (access_check (temp2, mode) == 0)
2147 if (pl->used_flag_ptr != 0)
2148 *pl->used_flag_ptr = 1;
2156 strcpy (temp, pl->prefix);
2157 strcat (temp, this_name);
2158 - if (access_check (temp, mode) == 0)
2159 + temp2 = update_path (temp, NULL);
2160 + if (access_check (temp2, mode) == 0)
2162 if (pl->used_flag_ptr != 0)
2163 *pl->used_flag_ptr = 1;
2175 --- gcc/prefix.c.orig 2005-12-01 18:38:38.000000000 -0200
2176 +++ gcc/prefix.c 2005-12-01 18:46:37.000000000 -0200
2177 @@ -238,6 +238,105 @@
2181 +/* Strip dir/.. from a pathname when it makes sense, e.g., when this
2182 + would turn an inaccessible pathname into an accessible one.
2184 + We short-circuit dir/.. when dir does not exist, and when
2185 + some/dir/../thing does not exist but some/thing does. In case
2186 + there are multiple possible dir/../ stripping possibilities that
2187 + would turn an inaccessible pathname into an accessible one, the one
2188 + closer to the end of the pathname is preferred.
2190 + RESULT is the pathname that might contain such dotdot sequences to
2191 + be stripped. P points into RESULT, and indicates the location
2192 + where we should start looking for ../ sequences.
2194 + Even though RESULT is const, P is not, and that's because
2195 + characters in it may be temporarily overwritten, so RESULT must not
2196 + be in read-only storage.
2198 + The returned value is either a newly-allocated memory area, holding
2199 + a string that is the result of dotdot-stripping from the original
2200 + input strip, or RESULT itself, in which case any modifications made
2201 + to the string will have been undone. */
2203 +static const char *
2204 +maybe_strip_dotdots (const char *result, char *p)
2207 + const char *path, *before, *after;
2212 + p = strchr (p, '.');
2215 + /* Look for `/../' */
2217 + && IS_DIR_SEPARATOR (p[2])
2218 + && (p != result && IS_DIR_SEPARATOR (p[-1])))
2225 + if (access (result, X_OK) == 0)
2229 + path = maybe_strip_dotdots (result, p + 3);
2230 + if (access (path, F_OK) == 0)
2232 + if (path != result)
2233 + free ((char *) path);
2238 + /* If we couldn't access the dir, or if recursion resulted in a
2239 + non-accessible pathname, we try stripping out dir/../. If `dir'
2240 + turns out to be `.', strip one more path component. */
2245 + while (before != result && IS_DIR_SEPARATOR (*before))
2247 + while (before != result && !IS_DIR_SEPARATOR (before[-1]))
2250 + while (before != result && *before == '.'
2251 + && IS_DIR_SEPARATOR (*(before + 1)));
2252 + /* If we have something like `./..' or `/..', don't
2253 + strip anything more. */
2254 + if (*before == '.' || IS_DIR_SEPARATOR (*before))
2258 + while (IS_DIR_SEPARATOR (*after))
2261 + len = (after - result) + strlen (after);
2263 + temp = xmalloc (len + 1 - (after - before));
2264 + memcpy (temp, result, before - result);
2265 + memcpy (temp + (before - result), after, len + 1 - (after - result));
2267 + path = maybe_strip_dotdots (temp, temp + (before - result));
2272 + if (access (path, F_OK) == 0)
2274 + else if (path != result)
2275 + free ((char *) path);
2280 /* Update PATH using KEY if PATH starts with PREFIX. The returned
2281 string is always malloc-ed, and the caller is responsible for
2285 update_path (const char *path, const char *key)
2288 + char *result, *temp;
2290 if (! strncmp (path, std_prefix, strlen (std_prefix)) && key != 0)
2292 @@ -265,62 +364,11 @@
2294 result = xstrdup (path);
2296 -#ifndef ALWAYS_STRIP_DOTDOT
2297 -#define ALWAYS_STRIP_DOTDOT 0
2300 + result = (char *) maybe_strip_dotdots (temp, temp);
2307 - p = strchr (p, '.');
2310 - /* Look for `/../' */
2312 - && IS_DIR_SEPARATOR (p[2])
2313 - && (p != result && IS_DIR_SEPARATOR (p[-1])))
2316 - if (!ALWAYS_STRIP_DOTDOT && access (result, X_OK) == 0)
2323 - /* We can't access the dir, so we won't be able to
2324 - access dir/.. either. Strip out `dir/../'. If `dir'
2325 - turns out to be `.', strip one more path component. */
2330 - while (dest != result && IS_DIR_SEPARATOR (*dest))
2332 - while (dest != result && !IS_DIR_SEPARATOR (dest[-1]))
2335 - while (dest != result && *dest == '.');
2336 - /* If we have something like `./..' or `/..', don't
2337 - strip anything more. */
2338 - if (*dest == '.' || IS_DIR_SEPARATOR (*dest))
2344 - while (IS_DIR_SEPARATOR (*src))
2347 - while ((*dest++ = *src++) != 0)
2354 + if (result != temp)
2357 #ifdef UPDATE_PATH_HOST_CANONICALIZE
2358 /* Perform host dependent canonicalization when needed. */
2359 2005-09-29 Alexandre Oliva <aoliva@redhat.com>
2361 * error.c (dump_type) <UNKNOWN_TYPE>: Print reworded message.
2363 * g++.dg/overload/unknown1.C: New.
2365 --- gcc/cp/error.c.orig 2004-11-07 11:22:11.000000000 -0200
2366 +++ gcc/cp/error.c 2005-09-29 16:13:20.000000000 -0300
2368 switch (TREE_CODE (t))
2371 - pp_identifier (cxx_pp, "<unknown type>");
2372 + pp_identifier (cxx_pp, "<unresolved overloaded function type>");
2376 --- gcc/testsuite/g++.dg/overload/unknown1.C 1970-01-01 00:00:00.000000000 +0000
2377 +++ gcc/testsuite/g++.dg/overload/unknown1.C 2005-09-29 16:12:49.000000000 -0300
2379 +// { dg-do compile }
2383 +template <typename T> void bar(T f);
2386 + bar(foo); // { dg-error "<unresolved overloaded function type>" }
2388 2005-12-18 Alexandre Oliva <aoliva@redhat.com>
2390 * optabs.c (expand_vector_binop): Do not use a SUBREG to modify
2391 a subword in the output if it matches any of the inputs.
2393 2006-04-20 Jakub Jelinek <jakub@redhat.com>
2395 * gcc.c-torture/execute/20060420-1.c: New test.
2397 --- gcc/optabs.c.orig 2005-11-21 11:43:20.000000000 -0200
2398 +++ gcc/optabs.c 2005-12-18 18:35:14.000000000 -0200
2399 @@ -1933,16 +1933,19 @@
2401 for (i = 0; i < elts; ++i)
2403 - /* If this is part of a register, and not the first item in the
2404 - word, we can't store using a SUBREG - that would clobber
2406 + /* If this is part of a register, and not the first item in
2407 + the word, we can't store using a SUBREG - that would
2408 + clobber previous results, or even the input operands, if
2409 + target matches any of them.
2410 And storing with a SUBREG is only possible for the least
2411 significant part, hence we can't do it for big endian
2412 (unless we want to permute the evaluation order. */
2413 if (GET_CODE (target) == REG
2414 && (BYTES_BIG_ENDIAN
2415 ? subsize < UNITS_PER_WORD
2416 - : ((i * subsize) % UNITS_PER_WORD) != 0))
2417 + : (((i * subsize) % UNITS_PER_WORD) != 0
2418 + || (subsize < UNITS_PER_WORD
2419 + && (target == op0 || target == op1)))))
2422 t = simplify_gen_subreg (submode, target, mode, i * subsize);
2423 --- gcc/testsuite/gcc.c-torture/execute/20060420-1.c.jj 2006-04-20 18:47:19.000000000 +0200
2424 +++ gcc/testsuite/gcc.c-torture/execute/20060420-1.c 2006-04-20 19:07:20.000000000 +0200
2426 +extern void abort (void);
2428 +typedef float v4flt __attribute__ ((vector_size (16)));
2430 +void __attribute__ ((noinline)) foo (float *dst, float **src, int a, int n)
2433 + int z = sizeof (v4flt) / sizeof (float);
2434 + unsigned m = sizeof (v4flt) - 1;
2436 + for (j = 0; j < n && (((unsigned long) dst + j) & m); ++j)
2438 + float t = src[0][j];
2439 + for (i = 1; i < a; ++i)
2444 + for (; j < (n - (4 * z - 1)); j += 4 * z)
2446 + v4flt t0 = *(v4flt *) (src[0] + j + 0 * z);
2447 + v4flt t1 = *(v4flt *) (src[0] + j + 1 * z);
2448 + v4flt t2 = *(v4flt *) (src[0] + j + 2 * z);
2449 + v4flt t3 = *(v4flt *) (src[0] + j + 3 * z);
2450 + for (i = 1; i < a; ++i)
2452 + t0 += *(v4flt *) (src[i] + j + 0 * z);
2453 + t1 += *(v4flt *) (src[i] + j + 1 * z);
2454 + t2 += *(v4flt *) (src[i] + j + 2 * z);
2455 + t3 += *(v4flt *) (src[i] + j + 3 * z);
2457 + *(v4flt *) (dst + j + 0 * z) = t0;
2458 + *(v4flt *) (dst + j + 1 * z) = t1;
2459 + *(v4flt *) (dst + j + 2 * z) = t2;
2460 + *(v4flt *) (dst + j + 3 * z) = t3;
2462 + for (; j < n; ++j)
2464 + float t = src[0][j];
2465 + for (i = 1; i < a; ++i)
2477 + float *dst, *src[2];
2480 + dst += (-(long int) buffer & (16 * sizeof (float) - 1)) / sizeof (float);
2481 + src[0] = dst + 16;
2482 + src[1] = dst + 32;
2483 + for (i = 0; i < 16; ++i)
2485 + src[0][i] = (float) i + 11 * (float) i;
2486 + src[1][i] = (float) i + 12 * (float) i;
2488 + foo (dst, src, 2, 16);
2489 + for (i = 0; i < 16; ++i)
2491 + float e = (float) i + 11 * (float) i + (float) i + 12 * (float) i;
2497 2006-03-01 Alexandre Oliva <aoliva@redhat.com>
2499 * dwarf2out.c (dwarf2out_stack_adjust): Always track the stack
2500 pointer, instead of assuming it is possible to derive the
2501 correct args size from a call insn.
2503 --- gcc/dwarf2out.c.orig 2006-03-01 05:13:50.000000000 -0300
2504 +++ gcc/dwarf2out.c 2006-03-01 05:41:38.000000000 -0300
2505 @@ -1069,26 +1069,6 @@ dwarf2out_stack_adjust (rtx insn)
2506 if (prologue_epilogue_contains (insn) || sibcall_epilogue_contains (insn))
2509 - if (!flag_asynchronous_unwind_tables && GET_CODE (insn) == CALL_INSN)
2511 - /* Extract the size of the args from the CALL rtx itself. */
2512 - insn = PATTERN (insn);
2513 - if (GET_CODE (insn) == PARALLEL)
2514 - insn = XVECEXP (insn, 0, 0);
2515 - if (GET_CODE (insn) == SET)
2516 - insn = SET_SRC (insn);
2517 - if (GET_CODE (insn) != CALL)
2520 - dwarf2out_args_size ("", INTVAL (XEXP (insn, 1)));
2524 - /* If only calls can throw, and we have a frame pointer,
2525 - save up adjustments until we see the CALL_INSN. */
2526 - else if (!flag_asynchronous_unwind_tables && cfa.reg != STACK_POINTER_REGNUM)
2529 if (GET_CODE (insn) == BARRIER)
2531 /* When we see a BARRIER, we know to reset args_size to 0. Usually
2532 @@ -1111,9 +1091,20 @@ dwarf2out_stack_adjust (rtx insn)
2533 if (GET_CODE (XVECEXP (PATTERN (insn), 0, i)) == SET)
2534 offset += stack_adjust_offset (XVECEXP (PATTERN (insn), 0, i));
2536 + else if (GET_CODE (insn) == CALL_INSN)
2541 + /* We handle this separately because we want stack adjustments in a
2542 + CALL_INSN to be handled. */;
2543 + if (GET_CODE (insn) == CALL_INSN)
2545 + /* If only calls can throw, adjust args_size only at call sites. */
2546 + if (!flag_asynchronous_unwind_tables)
2547 + dwarf2out_args_size ("", args_size);
2553 @@ -1128,6 +1119,16 @@ dwarf2out_stack_adjust (rtx insn)
2557 + /* If only calls can throw and we have a frame pointer, we'll save
2558 + up adjustments until we see the CALL_INSN. We used to return
2559 + early and derive args_size from NARGS in the CALL_INSN itself,
2560 + but that doesn't compute the right value if we have nested call
2561 + expansions, e.g., stack adjustments for a call have already been
2562 + emitted, and then we issue another call to compute an argument
2563 + for the enclosing call (i.e., bar (foo ())). */
2564 + if (!flag_asynchronous_unwind_tables && cfa.reg != STACK_POINTER_REGNUM)
2567 label = dwarf2out_cfi_label ();
2568 def_cfa_1 (label, &cfa);
2569 dwarf2out_args_size (label, args_size);
2570 2006-02-25 Alexandre Oliva <aoliva@redhat.com>
2572 * varasm.c (copy_constant): Handle VECTOR_CST.
2574 * gcc.dg/altivec-23.c: New test.
2576 --- gcc/varasm.c 2006-02-25 03:52:54.000000000 -0300
2577 +++ gcc/varasm.c 2006-02-25 03:54:56.000000000 -0300
2578 @@ -2464,6 +2464,19 @@ copy_constant (tree exp)
2584 + tree copy = copy_node (exp);
2585 + tree list = copy_list (TREE_VECTOR_CST_ELTS (exp));
2588 + TREE_VECTOR_CST_ELTS (copy) = list;
2589 + for (tail = list; tail; tail = TREE_CHAIN (tail))
2590 + TREE_VALUE (tail) = copy_constant (TREE_VALUE (tail));
2598 --- gcc/testsuite/gcc.dg/altivec-23.c 1970-01-01 00:00:00.000000000 +0000
2599 +++ gcc/testsuite/gcc.dg/altivec-23.c 2006-02-25 04:10:36.000000000 -0300
2601 +/* Verify that it is possible to define variables of composite types
2602 + containing vector types. We used to crash handling the
2603 + initializer of automatic ones. */
2605 +/* { dg-do compile { target powerpc*-*-* } } */
2606 +/* { dg-xfail-if "" { "powerpc-ibm-aix*" } { "-maltivec" } { "" } } */
2607 +/* { dg-options "-maltivec -mabi=altivec" } */
2609 +#include <altivec.h>
2612 +typedef vector bt vt;
2613 +typedef struct { vt x; bt y[sizeof(vt) / sizeof (bt)]; } st;
2614 +#define INIT { 1, 2, 3, 4 }
2619 + vt y[1] = { INIT };
2620 + st s = { INIT, INIT };
2624 +vt y[1] = { INIT };
2625 +st s = { INIT, INIT };
2626 2006-12-08 Alexandre Oliva <aoliva@redhat.com>
2628 * g++.dg/template/array17.C: New test.
2630 2006-10-27 Alexandre Oliva <aoliva@redhat.com>
2632 * typeck.c (non_reference): Don't dereference NULL type.
2634 --- gcc/cp/typeck.c.orig 2005-11-21 11:56:03.000000000 -0200
2635 +++ gcc/cp/typeck.c 2006-10-27 03:28:04.000000000 -0300
2636 @@ -6443,7 +6443,7 @@ casts_away_constness (tree t1, tree t2)
2638 non_reference (tree t)
2640 - if (TREE_CODE (t) == REFERENCE_TYPE)
2641 + if (t != NULL_TREE && TREE_CODE (t) == REFERENCE_TYPE)
2645 --- gcc/testsuite/g++.dg/template/array17.C 2006-10-04 16:28:56.502613000 +0200
2646 +++ gcc/testsuite/g++.dg/template/array17.C 2006-12-08 12:38:27.000000000 +0100
2648 +// { dg-do compile }
2650 +template <typename T>
2652 + T& operator[](int);
2656 + S operator +(int);
2657 + template <typename T> T value();
2660 +template <typename T>
2663 + v[(S() + 0).template value<int>()][0] = 0;
2671 2006-12-08 Jakub Jelinek <jakub@redhat.com>
2673 * g++.dg/opt/ifcvt1.C: New test.
2675 2005-11-09 Eric Botcazou <ebotcazou@adacore.com>
2677 * ifcvt.c (noce_get_alt_condition): Use prev_nonnote_insn.
2678 (noce_try_abs): Negate if the comparison is reversed.
2679 Look only one instruction backwards for a REG_EQUAL note.
2681 * gcc.dg/ifcvt-fabs-1.c: New test.
2683 --- gcc/ifcvt.c.orig 2005-11-21 11:43:21.000000000 -0200
2684 +++ gcc/ifcvt.c 2006-10-26 02:21:07.000000000 -0300
2685 @@ -1406,7 +1406,7 @@ noce_get_alt_condition (struct noce_if_i
2688 /* First, look to see if we put a constant in a register. */
2689 - prev_insn = PREV_INSN (if_info->cond_earliest);
2690 + prev_insn = prev_nonnote_insn (if_info->cond_earliest);
2692 && INSN_P (prev_insn)
2693 && GET_CODE (PATTERN (prev_insn)) == SET)
2694 @@ -1642,25 +1642,30 @@ noce_try_abs (struct noce_if_info *if_in
2695 if (rtx_equal_p (XEXP (cond, 0), b))
2697 else if (rtx_equal_p (XEXP (cond, 1), b))
2698 - c = XEXP (cond, 0);
2700 + c = XEXP (cond, 0);
2706 - /* Verify that C is zero. Search backward through the block for
2707 - a REG_EQUAL note if necessary. */
2708 + /* Verify that C is zero. Search one step backward for a
2709 + REG_EQUAL note or a simple source if necessary. */
2712 - rtx insn, note = NULL;
2713 - for (insn = earliest;
2714 - insn != BB_HEAD (if_info->test_bb);
2715 - insn = PREV_INSN (insn))
2717 - && ((note = find_reg_note (insn, REG_EQUAL, c))
2718 - || (note = find_reg_note (insn, REG_EQUIV, c))))
2721 + rtx set, insn = prev_nonnote_insn (earliest);
2723 + && (set = single_set (insn))
2724 + && rtx_equal_p (SET_DEST (set), c))
2726 + rtx note = find_reg_equal_equiv_note (insn);
2728 + c = XEXP (note, 0);
2730 + c = SET_SRC (set);
2734 - c = XEXP (note, 0);
2736 if (GET_CODE (c) == MEM
2737 && GET_CODE (XEXP (c, 0)) == SYMBOL_REF
2738 --- gcc/testsuite/gcc.dg/ifcvt-fabs-1.c 1970-01-01 00:00:00.000000000 +0000
2739 +++ gcc/testsuite/gcc.dg/ifcvt-fabs-1.c 2006-10-26 02:20:24.000000000 -0300
2741 +/* { dg-do run } */
2742 +/* { dg-options "-O" } */
2743 +/* { dg-options "-O -march=i686" { target i686-*-* } } */
2745 +extern void abort(void);
2757 + if (foo (-1.0f) != 1.0f)
2762 --- gcc/testsuite/g++.dg/opt/ifcvt1.C 2006-10-04 16:28:56.502613000 +0200
2763 +++ gcc/testsuite/g++.dg/opt/ifcvt1.C 2006-12-08 12:23:23.000000000 +0100
2765 +// { dg-do compile }
2766 +// { dg-options "-O2 -fnon-call-exceptions" }
2768 +struct S { ~S () throw () {} };
2776 + double c = bar ();
2777 + c = c < 0 ? -c : c;
2782 2007-04-02 Jakub Jelinek <jakub@redhat.com>
2784 * expr.c (expand_expr_real) <case COMPLEX_EXPR>: Force op1
2785 into register if target overlaps with op1.
2787 * g77.f-torture/execute/20070402.f: New test.
2789 --- gcc/expr.c.jj 2006-10-05 00:37:01.000000000 +0200
2790 +++ gcc/expr.c 2007-04-02 13:28:52.000000000 +0200
2791 @@ -8949,6 +8949,9 @@ expand_expr_real (tree exp, rtx target,
2794 target = gen_reg_rtx (TYPE_MODE (TREE_TYPE (exp)));
2795 + else if (GET_CODE (target) == MEM
2796 + && reg_overlap_mentioned_p (target, op1))
2797 + op1 = force_reg (mode, op1);
2801 --- gcc/testsuite/g77.f-torture/execute/20070402.f.jj 2007-04-02 13:29:51.000000000 +0200
2802 +++ gcc/testsuite/g77.f-torture/execute/20070402.f 2007-04-02 12:11:00.000000000 +0200
2807 + z = dcmplx(1.0, 2.0)
2810 + end program rh233941
2815 + z = dcmplx(-dimag(z), dreal(z))
2818 + end subroutine sub
2820 + subroutine sub2(z)
2823 + if (dreal(z).ne.-2.0.or.dimag(z).ne.1.0) call abort
2824 + end subroutine sub2
2825 2007-01-24 Steve LoBasso <slobasso@yahoo.com>
2826 Paolo Carlini <pcarlini@suse.de>
2828 * include/bits/deque.tcc (deque<>::erase(iterator, iterator)):
2830 * testsuite/23_containers/deque/modifiers/erase/3.cc: New.
2832 --- libstdc++-v3/include/bits/deque.tcc (revision 121146)
2833 +++ libstdc++-v3/include/bits/deque.tcc (revision 121147)
2834 @@ -140,7 +140,7 @@ namespace _GLIBCXX_STD
2836 const difference_type __n = __last - __first;
2837 const difference_type __elems_before = __first - this->_M_impl._M_start;
2838 - if (static_cast<size_type>(__elems_before) < (size() - __n) / 2)
2839 + if (static_cast<size_type>(__elems_before) <= (size() - __n) / 2)
2841 std::copy_backward(this->_M_impl._M_start, __first, __last);
2842 iterator __new_start = this->_M_impl._M_start + __n;
2843 --- libstdc++-v3/testsuite/23_containers/deque/modifiers/erase/3.cc (revision 0)
2844 +++ libstdc++-v3/testsuite/23_containers/deque/modifiers/erase/3.cc (revision 121147)
2846 +// Copyright (C) 2007 Free Software Foundation, Inc.
2848 +// This file is part of the GNU ISO C++ Library. This library is free
2849 +// software; you can redistribute it and/or modify it under the
2850 +// terms of the GNU General Public License as published by the
2851 +// Free Software Foundation; either version 2, or (at your option)
2852 +// any later version.
2854 +// This library is distributed in the hope that it will be useful,
2855 +// but WITHOUT ANY WARRANTY; without even the implied warranty of
2856 +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2857 +// GNU General Public License for more details.
2859 +// You should have received a copy of the GNU General Public License along
2860 +// with this library; see the file COPYING. If not, write to the Free
2861 +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
2864 +// 23.2.1.3 deque modifiers
2867 +#include <testsuite_hooks.h>
2869 +void erase(size_t num_elm, size_t elm_strt, size_t elm_end)
2871 + bool test __attribute__((unused)) = true;
2872 + using __gnu_test::copy_tracker;
2873 + using __gnu_test::assignment_operator;
2875 + std::deque<copy_tracker> x(num_elm);
2876 + copy_tracker::reset();
2878 + x.erase(x.begin() + elm_strt, x.begin() + elm_end);
2880 + const size_t min_num_cpy = std::min(elm_strt, num_elm - elm_end);
2881 + VERIFY( assignment_operator::count() == min_num_cpy );
2884 +// http://gcc.gnu.org/ml/libstdc++/2007-01/msg00098.html
2887 + for (size_t num_elm = 0; num_elm <= 10; ++num_elm)
2888 + for (size_t elm_strt = 0; elm_strt <= num_elm; ++elm_strt)
2889 + for (size_t elm_end = elm_strt; elm_end <= num_elm; ++elm_end)
2890 + erase(num_elm, elm_strt, elm_end);
2898 2007-04-12 Jakub Jelinek <jakub@redhat.com>
2900 * fr.po: Use %s rather than %S.
2901 * rw.po: Comment out translations with bogus format
2904 --- gcc/po/fr.po.jj 2006-10-05 00:33:36.000000000 +0200
2905 +++ gcc/po/fr.po 2007-04-13 00:23:29.000000000 +0200
2906 @@ -17100,7 +17100,7 @@ msgstr "%s liste d'expressions traitée c
2909 msgid "%s from type `%T' to type `%T' casts away constness"
2910 -msgstr "%S à partir du « %T » vers le type « %T » provoque un transtypage sans constante"
2911 +msgstr "%s à partir du « %T » vers le type « %T » provoque un transtypage sans constante"
2914 msgid "invalid static_cast from type `%T' to type `%T'"
2915 2007-04-21 Alexandre Oliva <aoliva@redhat.com>
2917 * gcse.c (store_killed_in_insn): Handle PARALLELs.
2918 (store_killed_in_pat): New.
2920 * gcc.dg/movsi-sm-1.c: New.
2922 --- gcc/gcse.c.jj 2007-02-23 21:29:12.000000000 +0100
2923 +++ gcc/gcse.c 2007-07-18 20:41:08.000000000 +0200
2924 @@ -7427,6 +7427,40 @@ find_loads (rtx x, rtx store_pattern, in
2929 +store_killed_in_pat (rtx x, rtx pat, int after)
2931 + if (GET_CODE (pat) == SET)
2933 + rtx dest = SET_DEST (pat);
2935 + if (GET_CODE (dest) == SIGN_EXTRACT
2936 + || GET_CODE (dest) == ZERO_EXTRACT)
2937 + dest = XEXP (dest, 0);
2939 + /* Check for memory stores to aliased objects. */
2940 + if (GET_CODE (dest) == MEM
2941 + && !expr_equiv_p (dest, x))
2945 + if (output_dependence (dest, x))
2950 + if (output_dependence (x, dest))
2956 + if (find_loads (pat, x, after))
2962 /* Check if INSN kills the store pattern X (is aliased with it).
2963 AFTER is true if we are checking the case when store X occurs
2964 after the insn. Return true if it it does. */
2965 @@ -7434,7 +7468,7 @@ find_loads (rtx x, rtx store_pattern, in
2967 store_killed_in_insn (rtx x, rtx x_regs, rtx insn, int after)
2969 - rtx reg, base, note;
2970 + rtx reg, base, note, pat;
2974 @@ -7461,33 +7495,20 @@ store_killed_in_insn (rtx x, rtx x_regs,
2978 - if (GET_CODE (PATTERN (insn)) == SET)
2979 + pat = PATTERN (insn);
2980 + if (GET_CODE (pat) == SET)
2982 - rtx pat = PATTERN (insn);
2983 - rtx dest = SET_DEST (pat);
2985 - if (GET_CODE (dest) == SIGN_EXTRACT
2986 - || GET_CODE (dest) == ZERO_EXTRACT)
2987 - dest = XEXP (dest, 0);
2989 - /* Check for memory stores to aliased objects. */
2990 - if (GET_CODE (dest) == MEM
2991 - && !expr_equiv_p (dest, x))
2995 - if (output_dependence (dest, x))
3000 - if (output_dependence (x, dest))
3004 - if (find_loads (SET_SRC (pat), x, after))
3005 + if (store_killed_in_pat (x, pat, after))
3008 + else if (GET_CODE (pat) == PARALLEL)
3012 + for (i = 0; i < XVECLEN (pat, 0); i++)
3013 + if (store_killed_in_pat (x, XVECEXP (pat, 0, i), after))
3016 else if (find_loads (PATTERN (insn), x, after))
3019 --- gcc/testsuite/gcc.dg/movsi-sm-1.c.jj 2007-07-18 20:58:08.000000000 +0200
3020 +++ gcc/testsuite/gcc.dg/movsi-sm-1.c 2007-07-18 21:01:52.000000000 +0200
3022 +/* { dg-do run } */
3023 +/* { dg-options "-O2" } */
3024 +/* { dg-options "-O2 -mtune=i386" { target { { i?86-*-* x86_64-*-* } && ilp32 } } } */
3030 +__attribute__((noinline))
3035 + __builtin_memcpy (str, "Bugged!", 8);
3039 + __builtin_memcpy (str, "This is what we should get!", 28);
3044 + __builtin_memcpy (str, "Broken!", 8);
3046 + __builtin_sprintf (buf, "%s\n", str);
3055 + return __builtin_strcmp (buf, "This is what we should get!\n") != 0;
3057 2007-06-08 Jatin Nansi <jnansi@redhat.com>
3059 * config/locale/ieee_1003.1-2001/codecvt_specializations.h: Make sure
3060 _M_int_enc and _M_ext_enc are '\0' terminated.
3062 --- libstdc++-v3/config/locale/ieee_1003.1-2001/codecvt_specializations.h.jj 2007-02-23 21:29:34.000000000 +0100
3063 +++ libstdc++-v3/config/locale/ieee_1003.1-2001/codecvt_specializations.h 2007-07-19 14:20:20.000000000 +0200
3065 int __ibom = 0, int __ebom = 0)
3066 : _M_in_desc(0), _M_out_desc(0), _M_ext_bom(__ebom), _M_int_bom(__ibom)
3068 - strncpy(_M_int_enc, __int, _S_max_size);
3069 - strncpy(_M_ext_enc, __ext, _S_max_size);
3070 + strncpy(_M_int_enc, __int, _S_max_size - 1);
3071 + strncpy(_M_ext_enc, __ext, _S_max_size - 1);
3072 + _M_int_enc[_S_max_size - 1] = '\0';
3073 + _M_ext_enc[_S_max_size - 1] = '\0';
3079 __enc_traits(const __enc_traits& __obj): _M_in_desc(0), _M_out_desc(0)
3081 - strncpy(_M_int_enc, __obj._M_int_enc, _S_max_size);
3082 - strncpy(_M_ext_enc, __obj._M_ext_enc, _S_max_size);
3083 + strncpy(_M_int_enc, __obj._M_int_enc, _S_max_size - 1);
3084 + strncpy(_M_ext_enc, __obj._M_ext_enc, _S_max_size - 1);
3085 + _M_int_enc[_S_max_size - 1] = '\0';
3086 + _M_ext_enc[_S_max_size - 1] = '\0';
3087 _M_ext_bom = __obj._M_ext_bom;
3088 _M_int_bom = __obj._M_int_bom;
3090 @@ -110,8 +114,10 @@
3092 operator=(const __enc_traits& __obj)
3094 - strncpy(_M_int_enc, __obj._M_int_enc, _S_max_size);
3095 - strncpy(_M_ext_enc, __obj._M_ext_enc, _S_max_size);
3096 + strncpy(_M_int_enc, __obj._M_int_enc, _S_max_size - 1);
3097 + strncpy(_M_ext_enc, __obj._M_ext_enc, _S_max_size - 1);
3098 + _M_int_enc[_S_max_size - 1] = '\0';
3099 + _M_ext_enc[_S_max_size - 1] = '\0';
3100 _M_ext_bom = __obj._M_ext_bom;
3101 _M_int_bom = __obj._M_int_bom;