aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorno-author <no-author@gcc.gnu.org>2005-02-22 21:01:34 +0000
committerno-author <no-author@gcc.gnu.org>2005-02-22 21:01:34 +0000
commit625582f525a393d89fefcee1c622305f6850ee55 (patch)
treec385de79a6c805edc576022321cf48a5bda339c7
parent85040d48eca0b42e200b8733323910c8b5e51c84 (diff)
This commit was manufactured by cvs2svn to create branch
'gcc-3_4-rhl-branch'. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-3_4-rhl-branch@95413 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/config/rs6000/linux-unwind.h324
-rw-r--r--gcc/testsuite/g++.dg/conversion/ambig1.C8
-rw-r--r--gcc/testsuite/g++.dg/ext/attrib19.C10
-rw-r--r--gcc/testsuite/g++.dg/lookup/builtin1.C12
-rw-r--r--gcc/testsuite/g++.dg/other/ptrmem6.C10
-rw-r--r--gcc/testsuite/g++.dg/parse/crash23.C12
-rw-r--r--gcc/testsuite/g++.dg/parse/local-class1.C14
-rw-r--r--gcc/testsuite/g++.dg/parse/typename7.C31
-rw-r--r--gcc/testsuite/g++.dg/template/crash34.C12
-rw-r--r--gcc/testsuite/g++.dg/template/dtor3.C4
-rw-r--r--gcc/testsuite/g++.dg/template/enum5.C16
-rw-r--r--gcc/testsuite/g++.dg/template/explicit6.C8
-rw-r--r--gcc/testsuite/g++.dg/warn/Wbraces1.C3
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/20050124-1.c41
-rw-r--r--gcc/testsuite/gcc.dg/20041216-1.c23
-rw-r--r--gcc/testsuite/gcc.dg/builtins-47.c20
-rw-r--r--gcc/testsuite/gcc.dg/cpp/20050215-1.c10
-rw-r--r--gcc/testsuite/gcc.dg/pr18502-1.c7
-rw-r--r--libstdc++-v3/testsuite/22_locale/ctype/narrow/char/19955.cc105
19 files changed, 670 insertions, 0 deletions
diff --git a/gcc/config/rs6000/linux-unwind.h b/gcc/config/rs6000/linux-unwind.h
new file mode 100644
index 00000000000..1acf738123e
--- /dev/null
+++ b/gcc/config/rs6000/linux-unwind.h
@@ -0,0 +1,324 @@
+/* DWARF2 EH unwinding support for PowerPC and PowerPC64 Linux.
+ Copyright (C) 2004, 2005 Free Software Foundation, Inc.
+
+ This file is part of GCC.
+
+ GCC is free software; you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published
+ by the Free Software Foundation; either version 2, or (at your
+ option) any later version.
+
+ In addition to the permissions in the GNU General Public License,
+ the Free Software Foundation gives you unlimited permission to link
+ the compiled version of this file with other programs, and to
+ distribute those programs without any restriction coming from the
+ use of this file. (The General Public License restrictions do
+ apply in other respects; for example, they cover modification of
+ the file, and distribution when not linked into another program.)
+
+ GCC is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
+ License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with GCC; see the file COPYING. If not, write to the
+ Free Software Foundation, 59 Temple Place - Suite 330, Boston,
+ MA 02111-1307, USA. */
+
+/* This file defines our own versions of various kernel and user
+ structs, so that system headers are not needed, which otherwise
+ can make bootstrapping a new toolchain difficult. Do not use
+ these structs elsewhere; Many fields are missing, particularly
+ from the end of the structures. */
+
+struct gcc_vregs
+{
+ __attribute__ ((vector_size (16))) int vr[32];
+#ifdef __powerpc64__
+ unsigned int pad1[3];
+ unsigned int vscr;
+ unsigned int vsave;
+ unsigned int pad2[3];
+#else
+ unsigned int vsave;
+ unsigned int pad[2];
+ unsigned int vscr;
+#endif
+};
+
+struct gcc_regs
+{
+ unsigned long gpr[32];
+ unsigned long nip;
+ unsigned long msr;
+ unsigned long orig_gpr3;
+ unsigned long ctr;
+ unsigned long link;
+ unsigned long xer;
+ unsigned long ccr;
+ unsigned long softe;
+ unsigned long trap;
+ unsigned long dar;
+ unsigned long dsisr;
+ unsigned long result;
+ unsigned long pad1[4];
+ double fpr[32];
+ unsigned int pad2;
+ unsigned int fpscr;
+#ifdef __powerpc64__
+ struct gcc_vregs *vp;
+#else
+ unsigned int pad3[2];
+#endif
+ struct gcc_vregs vregs;
+};
+
+struct gcc_ucontext
+{
+#ifdef __powerpc64__
+ unsigned long pad[28];
+#else
+ unsigned long pad[12];
+#endif
+ struct gcc_regs *regs;
+ struct gcc_regs rsave;
+};
+
+#ifdef __powerpc64__
+
+enum { SIGNAL_FRAMESIZE = 128 };
+
+/* If the current unwind info (FS) does not contain explicit info
+ saving R2, then we have to do a minor amount of code reading to
+ figure out if it was saved. The big problem here is that the
+ code that does the save/restore is generated by the linker, so
+ we have no good way to determine at compile time what to do. */
+
+#define MD_FROB_UPDATE_CONTEXT frob_update_context
+
+static void
+frob_update_context (struct _Unwind_Context *context, _Unwind_FrameState *fs)
+{
+ if (fs->regs.reg[2].how == REG_UNSAVED)
+ {
+ unsigned int *insn
+ = (unsigned int *) _Unwind_GetGR (context, LINK_REGISTER_REGNUM);
+ if (*insn == 0xE8410028)
+ _Unwind_SetGRPtr (context, 2, context->cfa + 40);
+ }
+}
+
+/* If PC is at a sigreturn trampoline, return a pointer to the
+ regs. Otherwise return NULL. */
+
+static struct gcc_regs *
+get_regs (struct _Unwind_Context *context)
+{
+ const unsigned char *pc = context->ra;
+
+ /* addi r1, r1, 128; li r0, 0x0077; sc (sigreturn) */
+ /* addi r1, r1, 128; li r0, 0x00AC; sc (rt_sigreturn) */
+ if (*(unsigned int *) (pc + 0) != 0x38210000 + SIGNAL_FRAMESIZE
+ || *(unsigned int *) (pc + 8) != 0x44000002)
+ return NULL;
+ if (*(unsigned int *) (pc + 4) == 0x38000077)
+ {
+ struct sigframe {
+ char gap[SIGNAL_FRAMESIZE];
+ unsigned long pad[7];
+ struct gcc_regs *regs;
+ } *frame = (struct sigframe *) context->cfa;
+ return frame->regs;
+ }
+ else if (*(unsigned int *) (pc + 4) == 0x380000AC)
+ {
+ /* This works for 2.4 kernels, but not for 2.6 kernels with vdso
+ because pc isn't pointing into the stack. Can be removed when
+ no one is running 2.4.19 or 2.4.20, the first two ppc64
+ kernels released. */
+ struct rt_sigframe_24 {
+ int tramp[6];
+ void *pinfo;
+ struct gcc_ucontext *puc;
+ } *frame24 = (struct rt_sigframe_24 *) pc;
+
+ /* Test for magic value in *puc of vdso. */
+ if ((long) frame24->puc != -21 * 8)
+ return frame24->puc->regs;
+ else
+ {
+ /* This works for 2.4.21 and later kernels. */
+ struct rt_sigframe {
+ char gap[SIGNAL_FRAMESIZE];
+ struct gcc_ucontext uc;
+ unsigned long pad[2];
+ int tramp[6];
+ void *pinfo;
+ struct gcc_ucontext *puc;
+ } *frame = (struct rt_sigframe *) context->cfa;
+ return frame->uc.regs;
+ }
+ }
+ return NULL;
+}
+
+#else /* !__powerpc64__ */
+
+enum { SIGNAL_FRAMESIZE = 64 };
+
+static struct gcc_regs *
+get_regs (struct _Unwind_Context *context)
+{
+ const unsigned char *pc = context->ra;
+
+ /* li r0, 0x7777; sc (sigreturn old) */
+ /* li r0, 0x0077; sc (sigreturn new) */
+ /* li r0, 0x6666; sc (rt_sigreturn old) */
+ /* li r0, 0x00AC; sc (rt_sigreturn new) */
+ if (*(unsigned int *) (pc + 4) != 0x44000002)
+ return NULL;
+ if (*(unsigned int *) (pc + 0) == 0x38007777
+ || *(unsigned int *) (pc + 0) == 0x38000077)
+ {
+ struct sigframe {
+ char gap[SIGNAL_FRAMESIZE];
+ unsigned long pad[7];
+ struct gcc_regs *regs;
+ } *frame = (struct sigframe *) context->cfa;
+ return frame->regs;
+ }
+ else if (*(unsigned int *) (pc + 0) == 0x38006666
+ || *(unsigned int *) (pc + 0) == 0x380000AC)
+ {
+ struct rt_sigframe {
+ char gap[SIGNAL_FRAMESIZE + 16];
+ char siginfo[128];
+ struct gcc_ucontext uc;
+ } *frame = (struct rt_sigframe *) context->cfa;
+ return frame->uc.regs;
+ }
+ return NULL;
+}
+#endif
+
+/* Find an entry in the process auxiliary vector. The canonical way to
+ test for VMX is to look at AT_HWCAP. */
+
+static long
+ppc_linux_aux_vector (long which)
+{
+ /* __libc_stack_end holds the original stack passed to a process. */
+ extern long *__libc_stack_end;
+ long argc;
+ char **argv;
+ char **envp;
+ struct auxv
+ {
+ long a_type;
+ long a_val;
+ } *auxp;
+
+ /* The Linux kernel puts argc first on the stack. */
+ argc = __libc_stack_end[0];
+ /* Followed by argv, NULL terminated. */
+ argv = (char **) __libc_stack_end + 1;
+ /* Followed by environment string pointers, NULL terminated. */
+ envp = argv + argc + 1;
+ while (*envp++)
+ continue;
+ /* Followed by the aux vector, zero terminated. */
+ for (auxp = (struct auxv *) envp; auxp->a_type != 0; ++auxp)
+ if (auxp->a_type == which)
+ return auxp->a_val;
+ return 0;
+}
+
+/* Do code reading to identify a signal frame, and set the frame
+ state data appropriately. See unwind-dw2.c for the structs. */
+
+#define MD_FALLBACK_FRAME_STATE_FOR ppc_fallback_frame_state
+
+static _Unwind_Reason_Code
+ppc_fallback_frame_state (struct _Unwind_Context *context,
+ _Unwind_FrameState *fs)
+{
+ static long hwcap = 0;
+ struct gcc_regs *regs = get_regs (context);
+ long new_cfa;
+ int i;
+
+ if (regs == NULL)
+ return _URC_END_OF_STACK;
+
+ new_cfa = regs->gpr[STACK_POINTER_REGNUM];
+ fs->cfa_how = CFA_REG_OFFSET;
+ fs->cfa_reg = STACK_POINTER_REGNUM;
+ fs->cfa_offset = new_cfa - (long) context->cfa;
+
+ for (i = 0; i < 32; i++)
+ if (i != STACK_POINTER_REGNUM)
+ {
+ fs->regs.reg[i].how = REG_SAVED_OFFSET;
+ fs->regs.reg[i].loc.offset = (long) &regs->gpr[i] - new_cfa;
+ }
+
+ fs->regs.reg[CR2_REGNO].how = REG_SAVED_OFFSET;
+ fs->regs.reg[CR2_REGNO].loc.offset = (long) &regs->ccr - new_cfa;
+
+ fs->regs.reg[LINK_REGISTER_REGNUM].how = REG_SAVED_OFFSET;
+ fs->regs.reg[LINK_REGISTER_REGNUM].loc.offset = (long) &regs->link - new_cfa;
+
+ fs->regs.reg[ARG_POINTER_REGNUM].how = REG_SAVED_OFFSET;
+ fs->regs.reg[ARG_POINTER_REGNUM].loc.offset = (long) &regs->nip - new_cfa;
+ fs->retaddr_column = ARG_POINTER_REGNUM;
+
+ if (hwcap == 0)
+ {
+ hwcap = ppc_linux_aux_vector (16);
+ /* These will already be set if we found AT_HWCAP. A non-zero
+ value stops us looking again if for some reason we couldn't
+ find AT_HWCAP. */
+#ifdef __powerpc64__
+ hwcap |= 0xc0000000;
+#else
+ hwcap |= 0x80000000;
+#endif
+ }
+
+ /* If we have a FPU... */
+ if (hwcap & 0x08000000)
+ for (i = 0; i < 32; i++)
+ {
+ fs->regs.reg[i + 32].how = REG_SAVED_OFFSET;
+ fs->regs.reg[i + 32].loc.offset = (long) &regs->fpr[i] - new_cfa;
+ }
+
+ /* If we have a VMX unit... */
+ if (hwcap & 0x10000000)
+ {
+ struct gcc_vregs *vregs;
+#ifdef __powerpc64__
+ vregs = regs->vp;
+#else
+ vregs = &regs->vregs;
+#endif
+ if (regs->msr & (1 << 25))
+ {
+ for (i = 0; i < 32; i++)
+ {
+ fs->regs.reg[i + FIRST_ALTIVEC_REGNO].how = REG_SAVED_OFFSET;
+ fs->regs.reg[i + FIRST_ALTIVEC_REGNO].loc.offset
+ = (long) &vregs[i] - new_cfa;
+ }
+
+ fs->regs.reg[VSCR_REGNO].how = REG_SAVED_OFFSET;
+ fs->regs.reg[VSCR_REGNO].loc.offset = (long) &vregs->vscr - new_cfa;
+ }
+
+ fs->regs.reg[VRSAVE_REGNO].how = REG_SAVED_OFFSET;
+ fs->regs.reg[VRSAVE_REGNO].loc.offset = (long) &vregs->vsave - new_cfa;
+ }
+
+ return _URC_NO_REASON;
+}
diff --git a/gcc/testsuite/g++.dg/conversion/ambig1.C b/gcc/testsuite/g++.dg/conversion/ambig1.C
new file mode 100644
index 00000000000..42ac4038ec6
--- /dev/null
+++ b/gcc/testsuite/g++.dg/conversion/ambig1.C
@@ -0,0 +1,8 @@
+// PR c++/19787
+
+struct H {
+ operator char(); // { dg-error "" }
+ operator short(); // { dg-error "" }
+};
+
+int const& ref = H(); // { dg-error "" }
diff --git a/gcc/testsuite/g++.dg/ext/attrib19.C b/gcc/testsuite/g++.dg/ext/attrib19.C
new file mode 100644
index 00000000000..f1362c3b484
--- /dev/null
+++ b/gcc/testsuite/g++.dg/ext/attrib19.C
@@ -0,0 +1,10 @@
+// PR c++/19739
+
+void Dummy() __attribute__(( , ));
+void Dummy() {}
+
+int main (int argc, char **argv)
+{
+ Dummy();
+ return 0;
+}
diff --git a/gcc/testsuite/g++.dg/lookup/builtin1.C b/gcc/testsuite/g++.dg/lookup/builtin1.C
new file mode 100644
index 00000000000..5f25f288965
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lookup/builtin1.C
@@ -0,0 +1,12 @@
+// PR c++/19367
+// { dg-do link }
+
+void abort (void) { throw 3; }
+
+namespace std { using ::abort; }
+
+int main ()
+{
+ using std::abort;
+ abort();
+}
diff --git a/gcc/testsuite/g++.dg/other/ptrmem6.C b/gcc/testsuite/g++.dg/other/ptrmem6.C
new file mode 100644
index 00000000000..5fe796e1c04
--- /dev/null
+++ b/gcc/testsuite/g++.dg/other/ptrmem6.C
@@ -0,0 +1,10 @@
+// PR c++/19666
+// Origin: Volker Reichelt <reichelt@gcc.gnu.org>
+// { dg-do compile }
+
+struct A { int i; };
+
+int foo (A *p)
+{
+ return &p->i - &(p->*&A::i);
+}
diff --git a/gcc/testsuite/g++.dg/parse/crash23.C b/gcc/testsuite/g++.dg/parse/crash23.C
new file mode 100644
index 00000000000..19ad70a6454
--- /dev/null
+++ b/gcc/testsuite/g++.dg/parse/crash23.C
@@ -0,0 +1,12 @@
+// PR c++/19733
+
+struct A {};
+typedef int I;
+void foo() {
+ A().~A; // { dg-error "" }
+ A().A::~A; // { dg-error "" }
+ (int().I::~I, 3); // { dg-error "" }
+ int().I::~I; // { dg-error "" }
+}
+
+
diff --git a/gcc/testsuite/g++.dg/parse/local-class1.C b/gcc/testsuite/g++.dg/parse/local-class1.C
new file mode 100644
index 00000000000..4fc7e6ebb13
--- /dev/null
+++ b/gcc/testsuite/g++.dg/parse/local-class1.C
@@ -0,0 +1,14 @@
+ // Copyright (C) 2005 Free Software Foundation, Inc.
+// Contributed by Nathan Sidwell 14 Feb 2005 <nathan@codesourcery.com>
+
+// Origin: Jorn Wolfgang Rennecke <amylaar@gcc.gnu.org>
+// Bug 19608: ICE on invalid
+
+
+void f ()
+{
+ class c
+ {
+ friend void g () { } // { dg-error "local class definition" "" }
+ };
+}
diff --git a/gcc/testsuite/g++.dg/parse/typename7.C b/gcc/testsuite/g++.dg/parse/typename7.C
new file mode 100644
index 00000000000..56fcc7436a4
--- /dev/null
+++ b/gcc/testsuite/g++.dg/parse/typename7.C
@@ -0,0 +1,31 @@
+// { dg-do compile }
+
+// Origin: Volker Reichelt <reichelt@igpm.rwth-aachen.de> and
+// Alexandre Oliva <aoliva@redhat.com>
+
+// PR c++/18757: ICE in get_innermost_template_args
+
+struct A
+{
+ template<typename> void foo(int);
+ template<typename T> void bar(T t) {
+ this->foo<typename T>(t); } // { dg-error "expected|parse error|no matching" }
+ template<typename T> void bad(T t) {
+ foo<typename T>(t); } // { dg-error "expected|parse error" }
+};
+
+template <typename T>
+struct B
+{
+ void bar(T t) {
+ A().bar<typename T>(t); } // { dg-error "expected|parse error|no matching" }
+ void bad(T t) {
+ B<typename T>::bar(t); } // { dg-error "invalid|not a template" }
+};
+
+void baz()
+{
+ A().bar(0);
+ A().bad(0);
+ B<int>().bar(0);
+}
diff --git a/gcc/testsuite/g++.dg/template/crash34.C b/gcc/testsuite/g++.dg/template/crash34.C
new file mode 100644
index 00000000000..9cca62f0539
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/crash34.C
@@ -0,0 +1,12 @@
+// { dg-do compile }
+
+// PR c++/20028
+
+// We used to crash when referencing TYPE_SIZE_UNIT of the messed-up
+// type used for x, because it was not initialized.
+
+class Foo;
+
+template <typename T> class Foo { }; // { dg-error "not a template type" }
+
+Foo<int> x; // { dg-error "not a template" }
diff --git a/gcc/testsuite/g++.dg/template/dtor3.C b/gcc/testsuite/g++.dg/template/dtor3.C
new file mode 100644
index 00000000000..7f4099861fb
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/dtor3.C
@@ -0,0 +1,4 @@
+// PR c++/19762
+
+template<int> struct A { ~A(){} }; // { dg-error "" }
+template A<>::~A(); // { dg-error "" }
diff --git a/gcc/testsuite/g++.dg/template/enum5.C b/gcc/testsuite/g++.dg/template/enum5.C
new file mode 100644
index 00000000000..b7a49f45d0f
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/enum5.C
@@ -0,0 +1,16 @@
+// { dg-do compile }
+
+// Origin: robertk@mathematik.uni-freiburg.de
+// Wolfgang Bangerth <bangerth@ticam.utexas.edu>
+
+// PR c++/14479: Template header check for enum
+
+template <int dim>
+struct X {
+ enum { dimension = dim };
+ template<int d> void bar ();
+};
+
+template <>
+template <>
+void X<0>::bar<0> () {}
diff --git a/gcc/testsuite/g++.dg/template/explicit6.C b/gcc/testsuite/g++.dg/template/explicit6.C
new file mode 100644
index 00000000000..f740269bb74
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/explicit6.C
@@ -0,0 +1,8 @@
+// Copyright (C) 2005 Free Software Foundation, Inc.
+// Contributed by Nathan Sidwell 14 Feb 2005 <nathan@codesourcery.com>
+
+// Origin: Volker Reichelt <reichelt@gcc.gnu.org>
+// Bug 19895: ICE on invalid
+
+struct A;
+template A<>::A(); // { dg-error "(not a template)|(explicit qualification)" "" }
diff --git a/gcc/testsuite/g++.dg/warn/Wbraces1.C b/gcc/testsuite/g++.dg/warn/Wbraces1.C
new file mode 100644
index 00000000000..0efce7be3ff
--- /dev/null
+++ b/gcc/testsuite/g++.dg/warn/Wbraces1.C
@@ -0,0 +1,3 @@
+// PR c++/19755
+// { dg-options "-Wmissing-braces" }
+int a[2][2] = { 0, 1 , 2, 3 }; // { dg-warning "" }
diff --git a/gcc/testsuite/gcc.c-torture/execute/20050124-1.c b/gcc/testsuite/gcc.c-torture/execute/20050124-1.c
new file mode 100644
index 00000000000..9d039ef6623
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/execute/20050124-1.c
@@ -0,0 +1,41 @@
+/* PR rtl-optimization/19579 */
+
+extern void abort (void);
+
+int
+foo (int i, int j)
+{
+ int k = i + 1;
+
+ if (j)
+ {
+ if (k > 0)
+ k++;
+ else if (k < 0)
+ k--;
+ }
+
+ return k;
+}
+
+int
+main (void)
+{
+ if (foo (-2, 0) != -1)
+ abort ();
+ if (foo (-1, 0) != 0)
+ abort ();
+ if (foo (0, 0) != 1)
+ abort ();
+ if (foo (1, 0) != 2)
+ abort ();
+ if (foo (-2, 1) != -2)
+ abort ();
+ if (foo (-1, 1) != 0)
+ abort ();
+ if (foo (0, 1) != 2)
+ abort ();
+ if (foo (1, 1) != 3)
+ abort ();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/20041216-1.c b/gcc/testsuite/gcc.dg/20041216-1.c
new file mode 100644
index 00000000000..3f892a2e375
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/20041216-1.c
@@ -0,0 +1,23 @@
+/* This test case would get an unresolved symbol during link
+ because stabs referred to an optimized-away literal pool
+ entry. */
+
+/* { dg-do run { target s390*-*-* } } */
+/* { dg-options "-O2 -fno-omit-frame-pointer -gstabs" } */
+
+int main (void)
+{
+ static char buf[4096];
+ char *p;
+
+ do
+ {
+ p = buf;
+ asm volatile ("" : : : "memory", "0", "1", "2", "3", "4", "5", "6",
+ "7", "8", "9", "10", "12");
+ }
+ while (*p);
+
+ return 0;
+}
+
diff --git a/gcc/testsuite/gcc.dg/builtins-47.c b/gcc/testsuite/gcc.dg/builtins-47.c
new file mode 100644
index 00000000000..19ae9736770
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/builtins-47.c
@@ -0,0 +1,20 @@
+/* { dg-do run } */
+/* { dg-options "-ffast-math -fdump-tree-gimple" } */
+
+extern double sqrt (double);
+extern double pow (double, double);
+extern void abort (void);
+
+int main ()
+{
+ double x = -1.0;
+ if (sqrt (pow (x, 2)) != 1.0)
+ abort();
+ if (sqrt (x*x) != 1.0)
+ abort();
+ return 0;
+}
+
+/* { dg-final { scan-tree-dump-times "sqrt" 0 "gimple" } } */
+/* { dg-final { scan-tree-dump-times "pow" 0 "gimple" } } */
+
diff --git a/gcc/testsuite/gcc.dg/cpp/20050215-1.c b/gcc/testsuite/gcc.dg/cpp/20050215-1.c
new file mode 100644
index 00000000000..e5aaf220e3e
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/cpp/20050215-1.c
@@ -0,0 +1,10 @@
+/* Testcase for memory corruption bug in macro processing.
+ See PR preprocessor/19077 for details. */
+
+/* { dg-do compile } */
+/* { dg-options "-g3" } */
+#define FOO(a,b,c,d,e) a b c d e \
+" " \
+" " \
+" "
+int i;
diff --git a/gcc/testsuite/gcc.dg/pr18502-1.c b/gcc/testsuite/gcc.dg/pr18502-1.c
new file mode 100644
index 00000000000..038c8104aa8
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr18502-1.c
@@ -0,0 +1,7 @@
+/* Test that -trigraphs isn't reordered before -std=gnu99. Bug
+ 18502. */
+/* Origin: Joseph Myers <joseph@codesourcery.com> */
+/* { dg-do compile } */
+/* { dg-options "-std=gnu99 -trigraphs" } */
+
+int a??(2??);
diff --git a/libstdc++-v3/testsuite/22_locale/ctype/narrow/char/19955.cc b/libstdc++-v3/testsuite/22_locale/ctype/narrow/char/19955.cc
new file mode 100644
index 00000000000..4ce1da33f01
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/ctype/narrow/char/19955.cc
@@ -0,0 +1,105 @@
+// Copyright (C) 2005 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+// 22.2.1.3.2 ctype<char> members
+
+#include <locale>
+#include <testsuite_hooks.h>
+
+class Ctype1
+: public std::ctype<char>
+{
+protected:
+ const char*
+ do_narrow(const char* lo, const char* hi,
+ char dflt, char* to) const
+ {
+ for (int i = 0; lo != hi; ++lo, ++to, ++i)
+ *to = *lo + i;
+ return hi;
+ }
+};
+
+class Ctype2
+: public std::ctype<char>
+{
+protected:
+ const char*
+ do_narrow(const char* lo, const char* hi,
+ char dflt, char* to) const
+ {
+ for (int i = 0; lo != hi; ++lo, ++to, ++i)
+ if (*lo == '\000')
+ *to = dflt;
+ else
+ *to = *lo;
+ return hi;
+ }
+};
+
+// libstdc++/19955
+void test01()
+{
+ using namespace std;
+ bool test __attribute__((unused)) = true;
+
+ const char src[] = "abcd";
+
+ locale mylocale1(locale::classic(), new Ctype1);
+ const ctype<char>& mc1 = use_facet<ctype<char> >(mylocale1);
+
+ char dst1[sizeof(src)];
+ memset(dst1, 0, sizeof(src));
+ char dst2[sizeof(src)];
+ memset(dst2, 0, sizeof(src));
+
+ mc1.narrow(src, src + sizeof(src), '*', dst1);
+ mc1.narrow(src, src + sizeof(src), '*', dst2);
+
+ VERIFY( !memcmp(dst1, "aceg\004", 5) );
+ VERIFY( !memcmp(dst1, dst2, 5) );
+
+ locale mylocale2(locale::classic(), new Ctype2);
+ const ctype<char>& mc2 = use_facet<ctype<char> >(mylocale2);
+
+ char dst3[sizeof(src)];
+ memset(dst3, 0, sizeof(src));
+ char dst4[sizeof(src)];
+ memset(dst4, 0, sizeof(src));
+
+ mc2.narrow(src, src + sizeof(src), '*', dst3);
+ mc2.narrow(src, src + sizeof(src), '*', dst4);
+
+ VERIFY( !memcmp(dst3, "abcd*", 5) );
+ VERIFY( !memcmp(dst3, dst4, 5) );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}