aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite
diff options
context:
space:
mode:
authorno-author <no-author@gcc.gnu.org>2003-06-03 16:53:07 +0000
committerno-author <no-author@gcc.gnu.org>2003-06-03 16:53:07 +0000
commit6a595b409c4a16bf07bddc89d6713105109548fd (patch)
treef61762dde1bdadf0d316d2d2a7fff23eab68fc73 /gcc/testsuite
parent6b9957dfa3e1468c5c35aea4c39613d562a7a5c9 (diff)
This commit was manufactured by cvs2svn to create branch
'tree-ssa-20020619-branch'. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/tree-ssa-20020619-branch@67385 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/testsuite')
-rw-r--r--gcc/testsuite/g++.dg/cpp/truefalse.C17
-rw-r--r--gcc/testsuite/g++.dg/ext/dllimport2.C15
-rw-r--r--gcc/testsuite/g++.dg/ext/dllimport3.C25
-rw-r--r--gcc/testsuite/g++.dg/ext/pretty1.C67
-rw-r--r--gcc/testsuite/g++.dg/ext/pretty2.C61
-rw-r--r--gcc/testsuite/g++.dg/ext/typeof5.C8
-rw-r--r--gcc/testsuite/g++.dg/lookup/using6.C11
-rw-r--r--gcc/testsuite/g++.dg/opt/life1.C16
-rw-r--r--gcc/testsuite/g++.dg/other/offsetof3.C15
-rw-r--r--gcc/testsuite/g++.dg/other/offsetof4.C15
-rw-r--r--gcc/testsuite/g++.dg/parse/access2.C15
-rw-r--r--gcc/testsuite/g++.dg/template/access10.C16
-rw-r--r--gcc/testsuite/g++.dg/template/access11.C24
-rw-r--r--gcc/testsuite/g++.dg/template/instantiate4.C13
-rw-r--r--gcc/testsuite/g++.dg/template/spec10.C27
-rw-r--r--gcc/testsuite/g++.dg/template/spec9.C21
-rw-r--r--gcc/testsuite/g77.dg/ffixed-form-1.f6
-rw-r--r--gcc/testsuite/g77.dg/ffixed-form-2.f12
-rw-r--r--gcc/testsuite/g77.dg/ffree-form-2.f11
-rw-r--r--gcc/testsuite/g77.dg/ffree-form-3.f20
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/20020129-1.c17
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/20020807-1.c33
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/20021008-1.c11
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/20030220-1.c20
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/20030518-1.c14
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/20020810-1.c38
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/20020920-1.c31
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/20030307-1.c26
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/builtins/builtins.exp30
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/builtins/string-4.c76
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/builtins/string-asm-1.c45
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/builtins/string-asm-2.c47
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/ieee/inf-2.c79
-rw-r--r--gcc/testsuite/gcc.dg/20020525-1.c24
-rw-r--r--gcc/testsuite/gcc.dg/20020729-1.c51
-rw-r--r--gcc/testsuite/gcc.dg/20030217-1.c18
-rw-r--r--gcc/testsuite/gcc.dg/20030225-2.c43
-rw-r--r--gcc/testsuite/gcc.dg/20030309-1.c42
-rw-r--r--gcc/testsuite/gcc.dg/20030405-1.c29
-rw-r--r--gcc/testsuite/gcc.dg/builtins-15.c17
-rw-r--r--gcc/testsuite/gcc.dg/builtins-16.c28
-rw-r--r--gcc/testsuite/gcc.dg/compat/fp-struct-check.h71
-rw-r--r--gcc/testsuite/gcc.dg/compat/fp-struct-defs.h43
-rw-r--r--gcc/testsuite/gcc.dg/compat/fp-struct-init.h54
-rw-r--r--gcc/testsuite/gcc.dg/compat/fp-struct-test-by-value-x.h113
-rw-r--r--gcc/testsuite/gcc.dg/compat/fp-struct-test-by-value-y.h86
-rw-r--r--gcc/testsuite/gcc.dg/compat/scalar-return-1_main.c12
-rw-r--r--gcc/testsuite/gcc.dg/compat/scalar-return-1_x.c110
-rw-r--r--gcc/testsuite/gcc.dg/compat/scalar-return-1_y.c94
-rw-r--r--gcc/testsuite/gcc.dg/compat/scalar-return-2_main.c12
-rw-r--r--gcc/testsuite/gcc.dg/compat/scalar-return-2_x.c88
-rw-r--r--gcc/testsuite/gcc.dg/compat/scalar-return-2_y.c73
-rw-r--r--gcc/testsuite/gcc.dg/compat/small-struct-check.h29
-rw-r--r--gcc/testsuite/gcc.dg/compat/small-struct-defs.h17
-rw-r--r--gcc/testsuite/gcc.dg/compat/small-struct-init.h17
-rw-r--r--gcc/testsuite/gcc.dg/compat/struct-by-value-6_main.c13
-rw-r--r--gcc/testsuite/gcc.dg/compat/struct-by-value-6_x.c63
-rw-r--r--gcc/testsuite/gcc.dg/compat/struct-by-value-6_y.c43
-rw-r--r--gcc/testsuite/gcc.dg/compat/struct-by-value-7_main.c13
-rw-r--r--gcc/testsuite/gcc.dg/compat/struct-by-value-7_x.c63
-rw-r--r--gcc/testsuite/gcc.dg/compat/struct-by-value-7_y.c43
-rw-r--r--gcc/testsuite/gcc.dg/compat/struct-by-value-8_main.c13
-rw-r--r--gcc/testsuite/gcc.dg/compat/struct-by-value-8_x.c210
-rw-r--r--gcc/testsuite/gcc.dg/compat/struct-by-value-8_y.c167
-rw-r--r--gcc/testsuite/gcc.dg/compat/struct-by-value-9_main.c13
-rw-r--r--gcc/testsuite/gcc.dg/compat/struct-by-value-9_x.c210
-rw-r--r--gcc/testsuite/gcc.dg/compat/struct-by-value-9_y.c167
-rw-r--r--gcc/testsuite/gcc.dg/compat/struct-return-2_main.c12
-rw-r--r--gcc/testsuite/gcc.dg/compat/struct-return-2_x.c205
-rw-r--r--gcc/testsuite/gcc.dg/compat/struct-return-2_y.c142
-rw-r--r--gcc/testsuite/gcc.dg/compat/struct-return-3_main.c13
-rw-r--r--gcc/testsuite/gcc.dg/compat/struct-return-3_x.c122
-rw-r--r--gcc/testsuite/gcc.dg/compat/struct-return-3_y.c98
-rw-r--r--gcc/testsuite/gcc.dg/cpp/cxxcom2.h4
-rw-r--r--gcc/testsuite/gcc.dg/cpp/redef3.c21
-rw-r--r--gcc/testsuite/gcc.dg/dollar.c9
-rw-r--r--gcc/testsuite/gcc.dg/duff-4.c60
-rw-r--r--gcc/testsuite/gcc.dg/fwrapv-1.c28
-rw-r--r--gcc/testsuite/gcc.dg/fwrapv-2.c28
-rw-r--r--gcc/testsuite/gcc.dg/i386-loop-3.c76
-rw-r--r--gcc/testsuite/gcc.dg/string-opt-1.c11
-rw-r--r--gcc/testsuite/gcc.dg/tls/opt-1.c28
-rw-r--r--gcc/testsuite/gcc.dg/tls/opt-6.c70
-rw-r--r--gcc/testsuite/gcc.dg/torture/builtin-noret-1.c73
-rw-r--r--gcc/testsuite/gcc.dg/torture/builtin-noret-2.c73
-rw-r--r--gcc/testsuite/gcc.dg/unroll-1.c26
86 files changed, 4070 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.dg/cpp/truefalse.C b/gcc/testsuite/g++.dg/cpp/truefalse.C
new file mode 100644
index 00000000000..d852d4e2f21
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp/truefalse.C
@@ -0,0 +1,17 @@
+/* Copyright (C) 2003 Free Software Foundation, Inc. */
+
+/* Source: Neil Booth, 18 Apr 2003. */
+
+/* { dg-do preprocess } */
+/* { dg-options "-ansi -pedantic -Wundef" } */
+
+/* Check that for C++ we handle true and false correctly, and do not
+ treat them as undefined identifiers. */
+
+#if true /* { dg-bogus "is not defined" } */
+#error foo /* { dg-error "foo" } */
+#endif
+
+#if false /* { dg-bogus "is not defined" } */
+#error foo /* { dg-bogus "foo" } */
+#endif
diff --git a/gcc/testsuite/g++.dg/ext/dllimport2.C b/gcc/testsuite/g++.dg/ext/dllimport2.C
new file mode 100644
index 00000000000..9564be4f74c
--- /dev/null
+++ b/gcc/testsuite/g++.dg/ext/dllimport2.C
@@ -0,0 +1,15 @@
+// { dg-do compile { target i?86-*-cygwin* i?86-*-mingw*} }
+
+// PR 9738 Dllimport attribute is overriden by later definition
+
+void __attribute__((dllimport)) Bar(void);
+
+ void Foo(void)
+ {
+ Bar();
+ }
+
+ void Bar(void)
+ {
+ }
+
diff --git a/gcc/testsuite/g++.dg/ext/dllimport3.C b/gcc/testsuite/g++.dg/ext/dllimport3.C
new file mode 100644
index 00000000000..d5e7955dbff
--- /dev/null
+++ b/gcc/testsuite/g++.dg/ext/dllimport3.C
@@ -0,0 +1,25 @@
+// { dg-do compile { target i?86-*-cygwin* i?86-*-mingw*} }
+
+// PR 10148 Dllimport attribute of object is overriden by later
+// redefinition without attribute.
+
+struct Foo
+ {
+ int a;
+ };
+
+ __attribute__((dllimport)) struct Foo f;
+
+ void Bar(void)
+ {
+ void* dummy = &f;
+ }
+
+ struct Foo f;
+
+// Dllimport sets DECL_NON_ADDR_CONST_P to 1, so following
+// assignment would require static_initialization_and_destruction
+// if attribute is retained.
+
+ void* dummy = &f;
+
diff --git a/gcc/testsuite/g++.dg/ext/pretty1.C b/gcc/testsuite/g++.dg/ext/pretty1.C
new file mode 100644
index 00000000000..06608ae30eb
--- /dev/null
+++ b/gcc/testsuite/g++.dg/ext/pretty1.C
@@ -0,0 +1,67 @@
+// PR c++/6794
+// Test whether __PRETTY_FUNCTION__ works in templates, functions and
+// in initializers at global scope
+// { dg-do compile }
+// { dg-options "" }
+
+extern "C" void __assert_fail (const char *, const char *,
+ unsigned int, const char *)
+ throw() __attribute__((noreturn));
+extern "C" void abort (void);
+extern "C" void exit (int);
+
+#define str(expr) #expr
+#define assert(expr) \
+ ((expr) ? 0 : (__assert_fail (str(expr), __FILE__, __LINE__, \
+ __PRETTY_FUNCTION__), 0))
+
+int __attribute__((noinline))
+foo (void)
+{
+ return 1;
+}
+
+template<class T> int
+bar (T)
+{
+ return (assert (foo ()), 1);
+}
+
+template<> int
+bar<int> (int)
+{
+ return (assert (foo ()), 2);
+}
+
+int a = (assert (foo ()), 1);
+int b = (assert (foo ()), 2);
+
+int
+main ()
+{
+ double c = 1.0;
+ unsigned char *d = 0;
+ int e = (assert (foo ()), 3);
+
+ bar (c);
+ bar (d);
+ bar (e);
+}
+
+namespace N
+{
+ int f = (assert (foo ()), 4);
+}
+
+void __attribute__((noinline))
+__assert_fail (const char *cond, const char *file, unsigned int line,
+ const char *pretty) throw ()
+{
+ abort ();
+}
+
+// { dg-final { scan-assembler "int bar\\(T\\).*with T = int" } }
+// { dg-final { scan-assembler "top level" } }
+// { dg-final { scan-assembler "int main\\(\\)" } }
+// { dg-final { scan-assembler "int bar\\(T\\).*with T = double" } }
+// { dg-final { scan-assembler "int bar\\(T\\).*with T = unsigned char\*" } }
diff --git a/gcc/testsuite/g++.dg/ext/pretty2.C b/gcc/testsuite/g++.dg/ext/pretty2.C
new file mode 100644
index 00000000000..0c05da9b70d
--- /dev/null
+++ b/gcc/testsuite/g++.dg/ext/pretty2.C
@@ -0,0 +1,61 @@
+// PR c++/6794
+// Test whether __PRETTY_FUNCTION__ works in templates, functions and
+// in initializers at global scope
+// { dg-do run }
+// { dg-options "" }
+
+extern "C" void __assert_fail (const char *, const char *,
+ unsigned int, const char *)
+ throw() __attribute__((noreturn));
+extern "C" void abort (void);
+extern "C" void exit (int);
+
+#define str(expr) #expr
+#define assert(expr) \
+ ((expr) ? 0 : (__assert_fail (str(expr), __FILE__, __LINE__, \
+ __PRETTY_FUNCTION__), 0))
+
+int __attribute__((noinline))
+foo (void)
+{
+ return 1;
+}
+
+template<class T> int
+bar (T)
+{
+ return (assert (foo ()), 1);
+}
+
+template<> int
+bar<int> (int)
+{
+ return (assert (foo ()), 2);
+}
+
+int a = (assert (foo ()), 1);
+int b = (assert (foo ()), 2);
+
+int
+main ()
+{
+ double c = 1.0;
+ unsigned char *d = 0;
+ int e = (assert (foo ()), 3);
+
+ bar (c);
+ bar (d);
+ bar (e);
+}
+
+namespace N
+{
+ int f = (assert (foo ()), 4);
+}
+
+void __attribute__((noinline))
+__assert_fail (const char *cond, const char *file, unsigned int line,
+ const char *pretty) throw ()
+{
+ abort ();
+}
diff --git a/gcc/testsuite/g++.dg/ext/typeof5.C b/gcc/testsuite/g++.dg/ext/typeof5.C
new file mode 100644
index 00000000000..d1ee4f718d1
--- /dev/null
+++ b/gcc/testsuite/g++.dg/ext/typeof5.C
@@ -0,0 +1,8 @@
+// { dg-options "" }
+
+int foo;
+
+template <class T> struct Base {};
+
+template <class T>
+struct Derived : public Base<typeof(foo)> {};
diff --git a/gcc/testsuite/g++.dg/lookup/using6.C b/gcc/testsuite/g++.dg/lookup/using6.C
new file mode 100644
index 00000000000..416f0b5256c
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lookup/using6.C
@@ -0,0 +1,11 @@
+// { dg-do compile }
+
+// Origin: Wolfgang Bangerth <bangerth@ticam.utexas.edu>
+
+// PR c++/9022, nested namespace in using declaration
+
+namespace gnu {
+ namespace gcc {
+ }
+}
+using gnu::gcc; // { dg-error "namespace" }
diff --git a/gcc/testsuite/g++.dg/opt/life1.C b/gcc/testsuite/g++.dg/opt/life1.C
new file mode 100644
index 00000000000..ac7a9f26d00
--- /dev/null
+++ b/gcc/testsuite/g++.dg/opt/life1.C
@@ -0,0 +1,16 @@
+// This testcase did not set up the pic register on IA-32 due
+// to bug in calculate_global_regs_live EH edge handling.
+// { dg-do compile { target i?86-*-linux* } }
+// { dg-options "-O2 -fPIC" }
+
+struct A { };
+
+void foo (A (*fn)())
+{
+ try {
+ A a = fn ();
+ } catch (...) {
+ }
+}
+
+// { dg-final { scan-assembler "GLOBAL_OFFSET_TABLE" } }
diff --git a/gcc/testsuite/g++.dg/other/offsetof3.C b/gcc/testsuite/g++.dg/other/offsetof3.C
new file mode 100644
index 00000000000..f600765fd90
--- /dev/null
+++ b/gcc/testsuite/g++.dg/other/offsetof3.C
@@ -0,0 +1,15 @@
+/* Verify that offsetof warns if given a non-POD */
+/* Copyright (C) 2003 Free Software Foundation, Inc. */
+/* Contributed by Matt Austern <austern@apple.com> 15 May 2003 */
+/* { dg-do compile } */
+
+struct X
+{
+ X() : x(3), y(4) { }
+ int x, y;
+};
+
+typedef X* pX;
+
+int yoff = int(&(pX(0)->y)); /* { dg-warning "invalid access" "" } */
+/* { dg-warning "macro was used incorrectly" "" { target *-*-* } 14 } */
diff --git a/gcc/testsuite/g++.dg/other/offsetof4.C b/gcc/testsuite/g++.dg/other/offsetof4.C
new file mode 100644
index 00000000000..587231ef88e
--- /dev/null
+++ b/gcc/testsuite/g++.dg/other/offsetof4.C
@@ -0,0 +1,15 @@
+/* Verify that -Wno-invalid-offsetof disables warning */
+/* Copyright (C) 2003 Free Software Foundation, Inc. */
+/* Contributed by Matt Austern <austern@apple.com> 15 May 2003 */
+/* { dg-do compile } */
+/* { dg-options "-Wno-invalid-offsetof" } */
+
+struct X
+{
+ X() : x(3), y(4) { }
+ int x, y;
+};
+
+typedef X* pX;
+
+int yoff = int(&(pX(0)->y));
diff --git a/gcc/testsuite/g++.dg/parse/access2.C b/gcc/testsuite/g++.dg/parse/access2.C
new file mode 100644
index 00000000000..ee8cd234e07
--- /dev/null
+++ b/gcc/testsuite/g++.dg/parse/access2.C
@@ -0,0 +1,15 @@
+// Copyright (C) 2003 Free Software Foundation
+// Contributed by Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
+// { dg-do compile }
+
+// Deferred access checking of variable declaration.
+
+class A {
+ typedef int X; // { dg-error "private" }
+ static X a, b, c;
+};
+
+A::X A::a;
+A::X A::b, x; // { dg-error "this context" }
+A::X y, A::c; // { dg-error "this context" }
+A::X z; // { dg-error "this context" }
diff --git a/gcc/testsuite/g++.dg/template/access10.C b/gcc/testsuite/g++.dg/template/access10.C
new file mode 100644
index 00000000000..8b4883c254b
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/access10.C
@@ -0,0 +1,16 @@
+// { dg-do compile }
+
+// Origin: Giovanni Bajo <giovannibajo@libero.it>
+
+// PR c++/10849: Incorrect access checking on template specialization.
+
+class X {
+ private:
+ template <typename T> struct Y;
+};
+
+template <> struct X::Y<int> {};
+
+template <typename T> struct X::Y {};
+
+template struct X::Y<int>;
diff --git a/gcc/testsuite/g++.dg/template/access11.C b/gcc/testsuite/g++.dg/template/access11.C
new file mode 100644
index 00000000000..f061f6616eb
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/access11.C
@@ -0,0 +1,24 @@
+// Copyright (C) 2003 Free Software Foundation
+// Contributed by Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
+// { dg-do compile }
+
+// Access checking during explicit instantiation.
+
+class A {
+ typedef int X; // { dg-error "private" }
+};
+
+class X {
+ private:
+ template <typename T> struct Y;
+};
+
+template <> struct X::Y<int> {
+ A::X x; // { dg-error "this context" }
+};
+
+template <typename T> struct X::Y {
+ typename T::X x; // { dg-error "this context" }
+};
+
+template struct X::Y<A>; // { dg-error "instantiated" }
diff --git a/gcc/testsuite/g++.dg/template/instantiate4.C b/gcc/testsuite/g++.dg/template/instantiate4.C
new file mode 100644
index 00000000000..732b8529de2
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/instantiate4.C
@@ -0,0 +1,13 @@
+// { dg-do compile }
+
+// Origin: Wolfgang Bangerth <bangerth@ticam.utexas.edu>
+
+// PR c++/10682: Typedef to enum template instantiation logic.
+
+template <typename T>
+struct Foo {
+ enum E {a,b,c};
+ typedef E EE;
+};
+
+void Baz(Foo<int>::EE x);
diff --git a/gcc/testsuite/g++.dg/template/spec10.C b/gcc/testsuite/g++.dg/template/spec10.C
new file mode 100644
index 00000000000..f790155dce2
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/spec10.C
@@ -0,0 +1,27 @@
+// { dg-do run }
+
+// Origin: Lynn Akers <lakers@peachtree.com>
+
+// PR c++/10940: Problem handling parameter list for static member
+// that is a specialization of a member template of a template class.
+
+template<int b>
+class o
+{
+public:
+ template<typename T> static void do_add(T* p, T v);
+};
+
+template<>
+template<typename T>
+inline void o<32>::do_add(T* p, T v)
+{
+ *p += v;
+}
+
+int main()
+{
+ int a = 0x1000;
+ o<32>().do_add<int>(&a, 0x2000);
+ return a;
+}
diff --git a/gcc/testsuite/g++.dg/template/spec9.C b/gcc/testsuite/g++.dg/template/spec9.C
new file mode 100644
index 00000000000..013fa0d9920
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/spec9.C
@@ -0,0 +1,21 @@
+// { dg-do compile }
+
+// Origin: Lynn Akers <lakers@peachtree.com>
+// Wolfgang Bangerth <bangerth@ticam.utexas.edu>
+
+// PR c++/10956: Incorrect template substitution for member template
+// specialization inside template class.
+
+template <int> struct C {
+ template<typename T> void pre_add(T);
+};
+
+template<>
+template<typename T>
+void C<32>::pre_add(T) {
+ T pre;
+}
+
+int main() {
+ C<32>().pre_add<int>(1);
+}
diff --git a/gcc/testsuite/g77.dg/ffixed-form-1.f b/gcc/testsuite/g77.dg/ffixed-form-1.f
new file mode 100644
index 00000000000..4b5f72301da
--- /dev/null
+++ b/gcc/testsuite/g77.dg/ffixed-form-1.f
@@ -0,0 +1,6 @@
+! Test compiler flags: -ffixed-form
+! Origin: David Billinghurst <David.Billinghurst@riotinto.com>
+!
+! { dg-do compile }
+! { dg-options "-ffixed-form" }
+ end
diff --git a/gcc/testsuite/g77.dg/ffixed-form-2.f b/gcc/testsuite/g77.dg/ffixed-form-2.f
new file mode 100644
index 00000000000..5f6980ca0ac
--- /dev/null
+++ b/gcc/testsuite/g77.dg/ffixed-form-2.f
@@ -0,0 +1,12 @@
+! PR fortran/10843
+! Origin: Brad Davis <bdavis9659@comcast.net>
+!
+! { dg-do compile }
+! { dg-options "-ffixed-form" }
+ GO TO 3
+ GOTO 3
+ 3 CONTINUE
+ GOTO = 55
+ GO TO = 55
+ END
+
diff --git a/gcc/testsuite/g77.dg/ffree-form-2.f b/gcc/testsuite/g77.dg/ffree-form-2.f
new file mode 100644
index 00000000000..b07db218789
--- /dev/null
+++ b/gcc/testsuite/g77.dg/ffree-form-2.f
@@ -0,0 +1,11 @@
+! PR fortran/10843
+! Origin: Brad Davis <bdavis9659@comcast.net>
+!
+! { dg-do compile }
+! { dg-options "-ffree-form" }
+ GO TO 3
+ GOTO 3
+ 3 CONTINUE
+ GOTO = 55
+ END
+
diff --git a/gcc/testsuite/g77.dg/ffree-form-3.f b/gcc/testsuite/g77.dg/ffree-form-3.f
new file mode 100644
index 00000000000..a30d6046081
--- /dev/null
+++ b/gcc/testsuite/g77.dg/ffree-form-3.f
@@ -0,0 +1,20 @@
+! Test acceptance of keywords in free format
+! Origin: David Billinghurst <David.Billinghurst@riotinto.com>
+!
+! { dg-do compile }
+! { dg-options "-ffree-form" }
+ integer i, j
+ i = 1
+ if ( i .eq. 1 ) then
+ go = 2
+ endif
+ if ( i .eq. 3 ) then
+ i = 4
+ end if
+ do i = 1, 3
+ j = i
+ end do
+ do j = 1, 3
+ i = j
+ enddo
+ end
diff --git a/gcc/testsuite/gcc.c-torture/compile/20020129-1.c b/gcc/testsuite/gcc.c-torture/compile/20020129-1.c
new file mode 100644
index 00000000000..7b17ba475e4
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/20020129-1.c
@@ -0,0 +1,17 @@
+/* Test call to static variable. */
+
+typedef struct
+{
+ long long a[10];
+} A;
+
+void bar (A *);
+
+typedef int (*B)(int);
+
+void foo (void)
+{
+ static A a;
+ bar (&a);
+ (*(B)&a) (1);
+}
diff --git a/gcc/testsuite/gcc.c-torture/compile/20020807-1.c b/gcc/testsuite/gcc.c-torture/compile/20020807-1.c
new file mode 100644
index 00000000000..c1cc81504e8
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/20020807-1.c
@@ -0,0 +1,33 @@
+int x;
+
+static int
+__attribute__ ((noinline))
+foo (void)
+{
+ return 0;
+}
+
+static void
+__attribute__ ((noinline))
+bar (void)
+{
+}
+
+static inline void
+baz (void)
+{
+ char arr[x];
+
+lab:
+ if (foo () == -1)
+ {
+ bar ();
+ goto lab;
+ }
+}
+
+void
+test (void)
+{
+ baz ();
+}
diff --git a/gcc/testsuite/gcc.c-torture/compile/20021008-1.c b/gcc/testsuite/gcc.c-torture/compile/20021008-1.c
new file mode 100644
index 00000000000..9d5a7f27633
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/20021008-1.c
@@ -0,0 +1,11 @@
+/* Origin: PR target/7434 Gwenole Beauchesne <gbeauchesne@mandrakesoft.com> */
+
+int main(void)
+{
+ static const int align_g[] = { 1, 2, 4, 8, 16 };
+ char * buf;
+ int i = 0;
+ volatile long double val = 0;
+ val = *((long double *)(buf + align_g[i]));
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.c-torture/compile/20030220-1.c b/gcc/testsuite/gcc.c-torture/compile/20030220-1.c
new file mode 100644
index 00000000000..59a03e42c45
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/20030220-1.c
@@ -0,0 +1,20 @@
+/* PR optimization/9768 */
+/* Originator: Randolph Chung <tausq@debian.org> */
+
+inline int fixfloor (long x)
+{
+ if (x >= 0)
+ return (x >> 16);
+ else
+ return ~((~x) >> 16);
+}
+
+inline int fixtoi (long x)
+{
+ return fixfloor(x) + ((x & 0x8000) >> 15);
+}
+
+int foo(long x, long y)
+{
+ return fixtoi(x*y);
+}
diff --git a/gcc/testsuite/gcc.c-torture/compile/20030518-1.c b/gcc/testsuite/gcc.c-torture/compile/20030518-1.c
new file mode 100644
index 00000000000..8cf2034518f
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/20030518-1.c
@@ -0,0 +1,14 @@
+/* Test case from PR middle-end/10472 */
+
+extern void f (char *);
+
+void foo (char *s)
+{
+ f (__builtin_stpcpy (s, "hi"));
+}
+
+void bar (char *s)
+{
+ f (__builtin_mempcpy (s, "hi", 3));
+}
+
diff --git a/gcc/testsuite/gcc.c-torture/execute/20020810-1.c b/gcc/testsuite/gcc.c-torture/execute/20020810-1.c
new file mode 100644
index 00000000000..d3386973a70
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/execute/20020810-1.c
@@ -0,0 +1,38 @@
+/* PR target/7559
+ This testcase was miscompiled on x86-64, because classify_argument
+ wrongly computed the offset of nested structure fields. */
+
+extern void abort (void);
+
+struct A
+{
+ long x;
+};
+
+struct R
+{
+ struct A a, b;
+};
+
+struct R R = { 100, 200 };
+
+void f (struct R r)
+{
+ if (r.a.x != R.a.x || r.b.x != R.b.x)
+ abort ();
+}
+
+struct R g (void)
+{
+ return R;
+}
+
+int main (void)
+{
+ struct R r;
+ f(R);
+ r = g();
+ if (r.a.x != R.a.x || r.b.x != R.b.x)
+ abort ();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.c-torture/execute/20020920-1.c b/gcc/testsuite/gcc.c-torture/execute/20020920-1.c
new file mode 100644
index 00000000000..4539742dd38
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/execute/20020920-1.c
@@ -0,0 +1,31 @@
+extern void abort (void);
+extern void exit (int);
+
+struct B
+{
+ int x;
+ int y;
+};
+
+struct A
+{
+ int z;
+ struct B b;
+};
+
+struct A
+f ()
+{
+ struct B b = { 0, 1 };
+ struct A a = { 2, b };
+ return a;
+}
+
+int
+main (void)
+{
+ struct A a = f ();
+ if (a.z != 2 || a.b.x != 0 || a.b.y != 1)
+ abort ();
+ exit (0);
+}
diff --git a/gcc/testsuite/gcc.c-torture/execute/20030307-1.c b/gcc/testsuite/gcc.c-torture/execute/20030307-1.c
new file mode 100644
index 00000000000..3f4eb864d6c
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/execute/20030307-1.c
@@ -0,0 +1,26 @@
+/* PR optimization/8726 */
+/* Originator: Paul Eggert <eggert@twinsun.com> */
+
+/* Verify that GCC doesn't miscompile tail calls on Sparc. */
+
+extern void abort(void);
+
+int fcntl_lock(int fd, int op, long long offset, long long count, int type);
+
+int vfswrap_lock(char *fsp, int fd, int op, long long offset, long long count, int type)
+{
+ return fcntl_lock(fd, op, offset, count, type);
+}
+
+int fcntl_lock(int fd, int op, long long offset, long long count, int type)
+{
+ return type;
+}
+
+int main(void)
+{
+ if (vfswrap_lock (0, 1, 2, 3, 4, 5) != 5)
+ abort();
+
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/builtins.exp b/gcc/testsuite/gcc.c-torture/execute/builtins/builtins.exp
new file mode 100644
index 00000000000..5aff873451f
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/execute/builtins/builtins.exp
@@ -0,0 +1,30 @@
+# This harness is for testing builtin support. Each test has two files:
+#
+# - foo.c defines the main testing function, main_test().
+# - foo-lib.c implements the library functions that foo.c is testing.
+#
+# The functions in foo-lib.c will often want to abort on certain inputs.
+# They can use the global variable inside_main to see whether they are
+# being called from the test program or part of the common runtime.
+#
+# In many cases, the library functions will behave as normal at -O0
+# and abort when optimisation is enabled. Such implementations should
+# go into the lib/ directory so that they can be included by any test
+# that needs them. They shouldn't call any external functions in case
+# those functions were overridden too.
+
+load_lib c-torture.exp
+
+set additional_flags ""
+if [istarget "powerpc-*-darwin*"] {
+ lappend additional_flags "-Wl,-multiply_defined,suppress"
+}
+
+foreach src [lsort [find $srcdir/$subdir *.c]] {
+ if {![string match *-lib.c $src] && [runtest_file_p $runtests $src]} {
+ c-torture-execute [list $src \
+ [file root $src]-lib.c \
+ $srcdir/$subdir/lib/main.c] \
+ $additional_flags
+ }
+}
diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/string-4.c b/gcc/testsuite/gcc.c-torture/execute/builtins/string-4.c
new file mode 100644
index 00000000000..0d0544e3de2
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/execute/builtins/string-4.c
@@ -0,0 +1,76 @@
+/* Copyright (C) 2003 Free Software Foundation.
+
+ Ensure builtin mempcpy and stpcpy perform correctly.
+
+ Written by Kaveh Ghazi, 4/11/2003. */
+
+extern void abort (void);
+extern char *strcpy (char *, const char *);
+extern char *stpcpy (char *, const char *);
+typedef __SIZE_TYPE__ size_t;
+extern size_t strlen(const char *);
+extern void *memcpy (void *, const void *, size_t);
+extern void *mempcpy (void *, const void *, size_t);
+extern int memcmp (const void *, const void *, size_t);
+
+const char s1[] = "123";
+char p[32] = "";
+char *s2 = "defg";
+char *s3 = "FGH";
+size_t l1 = 1;
+
+void
+main_test (void)
+{
+ int i;
+
+ if (stpcpy (p, "abcde") != p + 5 || memcmp (p, "abcde", 6))
+ abort ();
+ if (stpcpy (p + 16, "vwxyz" + 1) != p + 16 + 4 || memcmp (p + 16, "wxyz", 5))
+ abort ();
+ if (stpcpy (p + 1, "") != p + 1 + 0 || memcmp (p, "a\0cde", 6))
+ abort ();
+ if (stpcpy (p + 3, "fghij") != p + 3 + 5 || memcmp (p, "a\0cfghij", 9))
+ abort ();
+ if (mempcpy (p, "ABCDE", 6) != p + 6 || memcmp (p, "ABCDE", 6))
+ abort ();
+ if (mempcpy (p + 16, "VWX" + 1, 2) != p + 16 + 2 || memcmp (p + 16, "WXyz", 5))
+ abort ();
+ if (mempcpy (p + 1, "", 1) != p + 1 + 1 || memcmp (p, "A\0CDE", 6))
+ abort ();
+ if (mempcpy (p + 3, "FGHI", 4) != p + 3 + 4 || memcmp (p, "A\0CFGHIj", 9))
+ abort ();
+
+ i = 8;
+ memcpy (p + 20, "qrstu", 6);
+ if (stpcpy ((i++, p + 20 + 1), "23") != (p + 20 + 1 + 2) || i != 9 || memcmp (p + 20, "q23\0u", 6))
+ abort ();
+
+ memcpy (p + 25, "QRSTU", 6);
+ if (mempcpy (p + 25 + 1, s1, 3) != (p + 25 + 1 + 3) || memcmp (p + 25, "Q123U", 6))
+ abort ();
+
+ if (stpcpy (stpcpy (p, "ABCD"), "EFG") != p + 7 || memcmp (p, "ABCDEFG", 8))
+ abort();
+ if (mempcpy (mempcpy (p, "abcdEFG", 4), "efg", 4) != p + 8 || memcmp (p, "abcdefg", 8))
+ abort();
+
+ /* Test at least one instance of the __builtin_ style. We do this
+ to ensure that it works and that the prototype is correct. */
+ if (__builtin_stpcpy (p, "abcde") != p + 5 || memcmp (p, "abcde", 6))
+ abort ();
+ if (__builtin_mempcpy (p, "ABCDE", 6) != p + 6 || memcmp (p, "ABCDE", 6))
+ abort ();
+
+ /* If the result of stpcpy/mempcpy is ignored, gcc should use
+ strcpy/memcpy. */
+ stpcpy (p + 3, s2);
+ if (memcmp (p, "ABCdefg", 8))
+ abort ();
+ mempcpy (p + 5, s3, 1);
+ if (memcmp (p, "ABCdeFg", 8))
+ abort ();
+ mempcpy (p + 6, s3 + 1, l1);
+ if (memcmp (p, "ABCdeFG", 8))
+ abort ();
+}
diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/string-asm-1.c b/gcc/testsuite/gcc.c-torture/execute/builtins/string-asm-1.c
new file mode 100644
index 00000000000..3c3e45dfa5d
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/execute/builtins/string-asm-1.c
@@ -0,0 +1,45 @@
+/* Copyright (C) 2000, 2003 Free Software Foundation.
+
+ Ensure all expected transformations of builtin strstr occur and
+ perform correctly in presence of redirect. */
+
+#define ASMNAME(cname) ASMNAME2 (__USER_LABEL_PREFIX__, cname)
+#define ASMNAME2(prefix, cname) STRING (prefix) cname
+#define STRING(x) #x
+
+typedef __SIZE_TYPE__ size_t;
+extern void abort (void);
+extern char *strstr (const char *, const char *)
+ __asm (ASMNAME ("my_strstr"));
+
+const char *p = "rld", *q = "hello world";
+
+void
+main_test (void)
+{
+ const char *const foo = "hello world";
+
+ if (strstr (foo, "") != foo)
+ abort ();
+ if (strstr (foo + 4, "") != foo + 4)
+ abort ();
+ if (strstr (foo, "h") != foo)
+ abort ();
+ if (strstr (foo, "w") != foo + 6)
+ abort ();
+ if (strstr (foo + 6, "o") != foo + 7)
+ abort ();
+ if (strstr (foo + 1, "world") != foo + 6)
+ abort ();
+ if (strstr (foo + 2, p) != foo + 8)
+ abort ();
+ if (strstr (q, "") != q)
+ abort ();
+ if (strstr (q + 1, "o") != q + 4)
+ abort ();
+
+ /* Test at least one instance of the __builtin_ style. We do this
+ to ensure that it works and that the prototype is correct. */
+ if (__builtin_strstr (foo + 1, "world") != foo + 6)
+ abort ();
+}
diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/string-asm-2.c b/gcc/testsuite/gcc.c-torture/execute/builtins/string-asm-2.c
new file mode 100644
index 00000000000..e793778053a
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/execute/builtins/string-asm-2.c
@@ -0,0 +1,47 @@
+/* Copyright (C) 2003 Free Software Foundation.
+
+ Test memcpy and memset in presence of redirect. */
+
+#define ASMNAME(cname) ASMNAME2 (__USER_LABEL_PREFIX__, cname)
+#define ASMNAME2(prefix, cname) STRING (prefix) cname
+#define STRING(x) #x
+
+typedef __SIZE_TYPE__ size_t;
+extern void abort (void);
+extern void *memcpy (void *, const void *, size_t)
+ __asm (ASMNAME ("my_memcpy"));
+extern void bcopy (const void *, void *, size_t)
+ __asm (ASMNAME ("my_bcopy"));
+extern void *memset (void *, int, size_t)
+ __asm (ASMNAME ("my_memset"));
+extern void bzero (void *, size_t)
+ __asm (ASMNAME ("my_bzero"));
+extern int memcmp (const void *, const void *, size_t);
+
+struct A { char c[32]; } a = { "foobar" };
+char x[64] = "foobar", y[64];
+int i = 39, j = 6, k = 4;
+
+void
+main_test (void)
+{
+ struct A b = a;
+ struct A c = { { 'x' } };
+
+ if (memcmp (b.c, x, 32) || c.c[0] != 'x' || memcmp (c.c + 1, x + 32, 31))
+ abort ();
+ if (__builtin_memcpy (y, x, i) != y || memcmp (x, y, 64))
+ abort ();
+ if (memcpy (y + 6, x, j) != y + 6
+ || memcmp (x, y, 6) || memcmp (x, y + 6, 58))
+ abort ();
+ if (__builtin_memset (y + 2, 'X', k) != y + 2
+ || memcmp (y, "foXXXXfoobar", 13))
+ abort ();
+ bcopy (y + 1, y + 2, 6);
+ if (memcmp (y, "fooXXXXfobar", 13))
+ abort ();
+ __builtin_bzero (y + 4, 2);
+ if (memcmp (y, "fooX\0\0Xfobar", 13))
+ abort ();
+}
diff --git a/gcc/testsuite/gcc.c-torture/execute/ieee/inf-2.c b/gcc/testsuite/gcc.c-torture/execute/ieee/inf-2.c
new file mode 100644
index 00000000000..40270c0f6ab
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/execute/ieee/inf-2.c
@@ -0,0 +1,79 @@
+extern void abort (void);
+
+void test(double f, double i)
+{
+ if (f == __builtin_inf())
+ abort ();
+ if (f == -__builtin_inf())
+ abort ();
+ if (i == -__builtin_inf())
+ abort ();
+ if (i != __builtin_inf())
+ abort ();
+
+ if (f >= __builtin_inf())
+ abort ();
+ if (f > __builtin_inf())
+ abort ();
+ if (i > __builtin_inf())
+ abort ();
+ if (f <= -__builtin_inf())
+ abort ();
+ if (f < -__builtin_inf())
+ abort ();
+}
+
+void testf(float f, float i)
+{
+ if (f == __builtin_inff())
+ abort ();
+ if (f == -__builtin_inff())
+ abort ();
+ if (i == -__builtin_inff())
+ abort ();
+ if (i != __builtin_inff())
+ abort ();
+
+ if (f >= __builtin_inff())
+ abort ();
+ if (f > __builtin_inff())
+ abort ();
+ if (i > __builtin_inff())
+ abort ();
+ if (f <= -__builtin_inff())
+ abort ();
+ if (f < -__builtin_inff())
+ abort ();
+}
+
+void testl(long double f, long double i)
+{
+ if (f == __builtin_infl())
+ abort ();
+ if (f == -__builtin_infl())
+ abort ();
+ if (i == -__builtin_infl())
+ abort ();
+ if (i != __builtin_infl())
+ abort ();
+
+ if (f >= __builtin_infl())
+ abort ();
+ if (f > __builtin_infl())
+ abort ();
+ if (i > __builtin_infl())
+ abort ();
+ if (f <= -__builtin_infl())
+ abort ();
+ if (f < -__builtin_infl())
+ abort ();
+}
+
+int main()
+{
+ test (34.0, __builtin_inf());
+ testf (34.0f, __builtin_inff());
+ testf (34.0l, __builtin_infl());
+ return 0;
+}
+
diff --git a/gcc/testsuite/gcc.dg/20020525-1.c b/gcc/testsuite/gcc.dg/20020525-1.c
new file mode 100644
index 00000000000..5f2e8c9de91
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/20020525-1.c
@@ -0,0 +1,24 @@
+/* PR optimization/6703
+ Origin: Glen Nakamura <glen@imodulo.com> */
+/* { dg-do run } */
+/* { dg-options "-O2" } */
+
+extern void abort (void);
+extern void exit (int);
+
+void foo (int *x, int y)
+{
+ __builtin_memset (x, 0, y);
+}
+
+int main ()
+{
+ int x[2] = { 0x5a5a5a5a, 0x5a5a5a5a };
+
+ if (x[1] != 0x5a5a5a5a)
+ abort ();
+ foo (x, sizeof (int) + 1);
+ if (x[1] == 0x5a5a5a5a)
+ abort ();
+ exit (0);
+}
diff --git a/gcc/testsuite/gcc.dg/20020729-1.c b/gcc/testsuite/gcc.dg/20020729-1.c
new file mode 100644
index 00000000000..da1ed1b7153
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/20020729-1.c
@@ -0,0 +1,51 @@
+/* { dg-do compile { target i?86-*-* } } */
+/* { dg-options "-O2 -march=k6" } */
+
+static inline void *
+baz (void *s, unsigned long c, unsigned int count)
+{
+ int d0, d1;
+ __asm__ __volatile__ (""
+ : "=&c" (d0), "=&D" (d1)
+ :"a" (c), "q" (count), "0" (count / 4), "1" ((long) s)
+ :"memory");
+ return s;
+}
+
+struct A
+{
+ unsigned long *a;
+};
+
+inline static void *
+bar (struct A *x, int y)
+{
+ char *ptr;
+
+ ptr = (void *) x->a[y >> 12];
+ ptr += y % (1UL << 12);
+ return (void *) ptr;
+}
+
+int
+foo (struct A *x, unsigned int *y, int z, int u)
+{
+ int a, b, c, d, e;
+
+ z += *y;
+ c = z + u;
+ a = (z >> 12) + 1;
+ do
+ {
+ b = (a << 12);
+ d = b - z;
+ e = c - z;
+ if (e < d)
+ d = e;
+ baz (bar (x, z), 0, d);
+ z = b;
+ a++;
+ }
+ while (z < c);
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/20030217-1.c b/gcc/testsuite/gcc.dg/20030217-1.c
new file mode 100644
index 00000000000..d0cd91316c4
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/20030217-1.c
@@ -0,0 +1,18 @@
+/* Test whether denormal floating point constants in hexadecimal notation
+ are parsed correctly. */
+/* { dg-do run { target i?86-*-linux* x86_64-*-* } } */
+/* { dg-options "-std=c99" } */
+
+long double d = 0x0.0000003ffffffff00000p-16357L;
+long double e = 0x0.0000003ffffffff00000p-16356L;
+
+extern void abort (void);
+extern void exit (int);
+
+int
+main (void)
+{
+ if (d != e / 2.0)
+ abort ();
+ exit (0);
+}
diff --git a/gcc/testsuite/gcc.dg/20030225-2.c b/gcc/testsuite/gcc.dg/20030225-2.c
new file mode 100644
index 00000000000..a21660de71f
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/20030225-2.c
@@ -0,0 +1,43 @@
+/* { dg-do run { target ia64-*-linux* } } */
+/* { dg-options "-O3" } */
+
+int __attribute__((noinline, const))
+ret4 (float value)
+{
+ return 4;
+}
+
+int __attribute__((noinline, const))
+ret0 (float value)
+{
+ return 0;
+}
+
+float __attribute__((noinline))
+test (float x, float y)
+{
+ int clsx = ret4 (x);
+ int clsy = ret0 (y);
+
+ if (clsx == 0 || clsy == 0
+ || (y < 0 && clsx == 1 && clsy == 1))
+ return x - y;
+
+ return x < y ? 0 : x - y;
+}
+
+float a = 0.0, b;
+
+int main (void)
+{
+ unsigned long e;
+ b = a / a;
+ __asm__ __volatile__ ("mov.m %0=ar.fpsr" : "=r" (e));
+ e &= ~0x7e000UL;
+ __asm__ __volatile__ ("mov.m ar.fpsr=%0" :: "r" (e) : "memory");
+ a = test (0, b);
+ __asm__ __volatile__ ("mov.m %0=ar.fpsr" : "=r" (e));
+ if (e & 0x2000)
+ abort ();
+ exit (0);
+}
diff --git a/gcc/testsuite/gcc.dg/20030309-1.c b/gcc/testsuite/gcc.dg/20030309-1.c
new file mode 100644
index 00000000000..2431bc1b52f
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/20030309-1.c
@@ -0,0 +1,42 @@
+/* { dg-do link } */
+/* { dg-options "-O2" } */
+
+struct A0 { int x; };
+struct A1 { int x; int y[1]; };
+struct A2 { int x; int y[2]; };
+struct A3 { int x; int y[3]; };
+struct A4 { int x; int y[4]; };
+
+void *s;
+int u;
+
+int
+main (void)
+{
+ int x;
+ void *t = s;
+
+ switch (u)
+ {
+ case 0:
+ x = ((struct A0 *) t)->x;
+ break;
+ case 1:
+ x = ((struct A1 *) t)->x;
+ break;
+ case 2:
+ x = ((struct A2 *) t)->x;
+ break;
+ case 3:
+ x = ((struct A3 *) t)->x;
+ break;
+ case 4:
+ x = ((struct A4 *) t)->x;
+ break;
+ default:
+ x = 0;
+ break;
+ }
+
+ return x;
+}
diff --git a/gcc/testsuite/gcc.dg/20030405-1.c b/gcc/testsuite/gcc.dg/20030405-1.c
new file mode 100644
index 00000000000..ec19d5c7870
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/20030405-1.c
@@ -0,0 +1,29 @@
+/* { dg-do compile { target ia64-*-* } } */
+/* { dg-options "-O2" } */
+
+int
+foo (int x, int y)
+{
+ if (y == 0)
+ {
+ register long r8 asm ("r8");
+ register long r15 asm ("r15") = 1;
+ long retval;
+ __asm __volatile ("foo" : "=r" (r8), "=r" (r15) : "1" (r15));
+ retval = r8;
+ y = retval;
+ }
+
+ {
+ register long r8 asm ("r8");
+ register long r15 asm ("r15") = 2;
+ long retval;
+ register long _out1 asm ("out1") = x;
+ register long _out0 asm ("out0") = y;
+ __asm __volatile ("foo"
+ : "=r" (r8), "=r" (r15) , "=r" (_out0), "=r" (_out1)
+ : "1" (r15) , "2" (_out0), "3" (_out1));
+ retval = r8;
+ return retval;
+ }
+}
diff --git a/gcc/testsuite/gcc.dg/builtins-15.c b/gcc/testsuite/gcc.dg/builtins-15.c
new file mode 100644
index 00000000000..6d94c7edc51
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/builtins-15.c
@@ -0,0 +1,17 @@
+/* Derived from PR optimization/10764 */
+
+/* { dg-do compile } */
+/* { dg-options "-O2 -ffast-math" } */
+
+double log(double x);
+
+double ndtri(double y0)
+{
+ double x;
+
+ x = log(y0);
+ x = log(x);
+
+ return x;
+}
+
diff --git a/gcc/testsuite/gcc.dg/builtins-16.c b/gcc/testsuite/gcc.dg/builtins-16.c
new file mode 100644
index 00000000000..e7ffe935067
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/builtins-16.c
@@ -0,0 +1,28 @@
+/* Copyright (C) 2003 Free Software Foundation.
+
+ Verify that all the __builtin_cabs? functions are recognized
+ by the compiler. Complex numbers are not supported with the
+ gcc.dg default "-pedantic-errors" option, so the dg-options
+ overrides this.
+
+ Written by Roger Sayle, 1st June 2003. */
+
+/* { dg-do compile } */
+/* { dg-options "-O -ansi" } */
+/* { dg-final { scan-assembler-not "__builtin_" } } */
+
+double test(__complex__ double x)
+{
+ return __builtin_cabs (x);
+}
+
+float testf(__complex__ float x)
+{
+ return __builtin_cabsf (x);
+}
+
+long double testl(__complex__ long double x)
+{
+ return __builtin_cabsl (x);
+}
+
diff --git a/gcc/testsuite/gcc.dg/compat/fp-struct-check.h b/gcc/testsuite/gcc.dg/compat/fp-struct-check.h
new file mode 100644
index 00000000000..e907c7f0468
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/compat/fp-struct-check.h
@@ -0,0 +1,71 @@
+/* Function definitions that are used by multiple tests. */
+
+#define CHECKS(NAME,TYPEM) \
+void checkS##NAME##1 (S##NAME##1 x, TYPEM y) \
+{ if (x.a != y) { DEBUG_NL; DEBUG_NL; abort (); } } \
+void checkS##NAME##2 (S##NAME##2 x, TYPEM y) \
+{ if (x.a != y || x.b != y+1 ) { DEBUG_NL; abort (); } } \
+void checkS##NAME##3 (S##NAME##3 x, TYPEM y) \
+{ if (x.a != y || x.b != y+1 || x.c != y+2 ) \
+ { DEBUG_NL; abort (); } } \
+void checkS##NAME##4 (S##NAME##4 x, TYPEM y) \
+{ if (x.a != y || x.b != y+1 || x.c != y+2 || x.d != y+3) \
+ { DEBUG_NL; abort (); } } \
+void checkS##NAME##5 (S##NAME##5 x, TYPEM y) \
+{ if (x.a != y || x.b != y+1 || x.c != y+2 || x.d != y+3 \
+ || x.e != y+4) { DEBUG_NL; abort (); } } \
+void checkS##NAME##6 (S##NAME##6 x, TYPEM y) \
+{ if (x.a != y || x.b != y+1 || x.c != y+2 || x.d != y+3 \
+ || x.e != y+4 || x.f != y+5) { DEBUG_NL; abort (); } } \
+void checkS##NAME##7 (S##NAME##7 x, TYPEM y) \
+{ if (x.a != y || x.b != y+1 || x.c != y+2 || x.d != y+3 \
+ || x.e != y+4 || x.f != y+5 || x.g != y+6) \
+ { DEBUG_NL; abort (); } } \
+void checkS##NAME##8 (S##NAME##8 x, TYPEM y) \
+{ if (x.a != y || x.b != y+1 || x.c != y+2 || x.d != y+3 \
+ || x.e != y+4 || x.f != y+5 || x.g != y+6 \
+ || x.h != y+7) { DEBUG_NL; abort (); } } \
+void checkS##NAME##9 (S##NAME##9 x, TYPEM y) \
+{ if (x.a != y || x.b != y+1 || x.c != y+2 || x.d != y+3 \
+ || x.e != y+4 || x.f != y+5 || x.g != y+6 \
+ || x.h != y+7 || x.i != y+8) { DEBUG_NL; abort (); } } \
+void checkS##NAME##10 (S##NAME##10 x, TYPEM y) \
+{ if (x.a != y || x.b != y+1 || x.c != y+2 || x.d != y+3 \
+ || x.e != y+4 || x.f != y+5 || x.g != y+6 \
+ || x.h != y+7 || x.i != y+8 || x.j != y+9) \
+ { DEBUG_NL; abort (); } } \
+void checkS##NAME##11 (S##NAME##11 x, TYPEM y) \
+{ if (x.a != y || x.b != y+1 || x.c != y+2 || x.d != y+3 \
+ || x.e != y+4 || x.f != y+5 || x.g != y+6 \
+ || x.h != y+7 || x.i != y+8 || x.j != y+9 \
+ || x.k != y+10) { DEBUG_NL; abort (); } } \
+void checkS##NAME##12 (S##NAME##12 x, TYPEM y) \
+{ if (x.a != y || x.b != y+1 || x.c != y+2 || x.d != y+3 \
+ || x.e != y+4 || x.f != y+5 || x.g != y+6 \
+ || x.h != y+7 || x.i != y+8 || x.j != y+9 \
+ || x.k != y+10 || x.l != y+11) { DEBUG_NL; abort (); } } \
+void checkS##NAME##13 (S##NAME##13 x, TYPEM y) \
+{ if (x.a != y || x.b != y+1 || x.c != y+2 || x.d != y+3 \
+ || x.e != y+4 || x.f != y+5 || x.g != y+6 \
+ || x.h != y+7 || x.i != y+8 || x.j != y+9 \
+ || x.k != y+10 || x.l != y+11 || x.m != y+12) \
+ { DEBUG_NL; abort (); } } \
+void checkS##NAME##14 (S##NAME##14 x, TYPEM y) \
+{ if (x.a != y || x.b != y+1 || x.c != y+2 || x.d != y+3 \
+ || x.e != y+4 || x.f != y+5 || x.g != y+6 \
+ || x.h != y+7 || x.i != y+8 || x.j != y+9 \
+ || x.k != y+10 || x.l != y+11 || x.m != y+12 \
+ || x.n != y+13) { DEBUG_NL; abort (); } } \
+void checkS##NAME##15 (S##NAME##15 x, TYPEM y) \
+{ if (x.a != y || x.b != y+1 || x.c != y+2 || x.d != y+3 \
+ || x.e != y+4 || x.f != y+5 || x.g != y+6 \
+ || x.h != y+7 || x.i != y+8 || x.j != y+9 \
+ || x.k != y+10 || x.l != y+11 || x.m != y+12 \
+ || x.n != y+13 || x.o != y+14) { DEBUG_NL; abort (); } } \
+void checkS##NAME##16 (S##NAME##16 x, TYPEM y) \
+{ if (x.a != y || x.b != y+1 || x.c != y+2 || x.d != y+3 \
+ || x.e != y+4 || x.f != y+5 || x.g != y+6 \
+ || x.h != y+7 || x.i != y+8 || x.j != y+9 \
+ || x.k != y+10 || x.l != y+11 || x.m != y+12 \
+ || x.n != y+13 || x.o != y+14 || x.p != y+15) \
+ { DEBUG_NL; abort (); } }
diff --git a/gcc/testsuite/gcc.dg/compat/fp-struct-defs.h b/gcc/testsuite/gcc.dg/compat/fp-struct-defs.h
new file mode 100644
index 00000000000..67d63f23b4f
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/compat/fp-struct-defs.h
@@ -0,0 +1,43 @@
+/* Type definitions that are used by multiple tests. */
+
+#define DEFS(NAME,TYPEM) \
+typedef struct { TYPEM a; } S##NAME##1; \
+typedef struct { TYPEM a; TYPEM b; } S##NAME##2; \
+typedef struct { TYPEM a; TYPEM b; TYPEM c; } S##NAME##3; \
+typedef struct { TYPEM a; TYPEM b; TYPEM c; TYPEM d; } \
+ S##NAME##4; \
+typedef struct { TYPEM a; TYPEM b; TYPEM c; TYPEM d; TYPEM e; } \
+ S##NAME##5; \
+typedef struct { TYPEM a; TYPEM b; TYPEM c; TYPEM d; TYPEM e; \
+ TYPEM f; } S##NAME##6; \
+typedef struct { TYPEM a; TYPEM b; TYPEM c; TYPEM d; TYPEM e; \
+ TYPEM f; TYPEM g; } S##NAME##7; \
+typedef struct { TYPEM a; TYPEM b; TYPEM c; TYPEM d; TYPEM e; \
+ TYPEM f; TYPEM g; TYPEM h; } S##NAME##8; \
+typedef struct { TYPEM a; TYPEM b; TYPEM c; TYPEM d; TYPEM e; \
+ TYPEM f; TYPEM g; TYPEM h; TYPEM i; } \
+ S##NAME##9; \
+typedef struct { TYPEM a; TYPEM b; TYPEM c; TYPEM d; TYPEM e; \
+ TYPEM f; TYPEM g; TYPEM h; TYPEM i; TYPEM j; } \
+ S##NAME##10; \
+typedef struct { TYPEM a; TYPEM b; TYPEM c; TYPEM d; TYPEM e; \
+ TYPEM f; TYPEM g; TYPEM h; TYPEM i; TYPEM j; \
+ TYPEM k; } S##NAME##11; \
+typedef struct { TYPEM a; TYPEM b; TYPEM c; TYPEM d; TYPEM e; \
+ TYPEM f; TYPEM g; TYPEM h; TYPEM i; TYPEM j; \
+ TYPEM k; TYPEM l; } S##NAME##12; \
+typedef struct { TYPEM a; TYPEM b; TYPEM c; TYPEM d; TYPEM e; \
+ TYPEM f; TYPEM g; TYPEM h; TYPEM i; TYPEM j; \
+ TYPEM k; TYPEM l; TYPEM m; } S##NAME##13; \
+typedef struct { TYPEM a; TYPEM b; TYPEM c; TYPEM d; TYPEM e; \
+ TYPEM f; TYPEM g; TYPEM h; TYPEM i; TYPEM j; \
+ TYPEM k; TYPEM l; TYPEM m; TYPEM n; } \
+ S##NAME##14; \
+typedef struct { TYPEM a; TYPEM b; TYPEM c; TYPEM d; TYPEM e; \
+ TYPEM f; TYPEM g; TYPEM h; TYPEM i; TYPEM j; \
+ TYPEM k; TYPEM l; TYPEM m; TYPEM n; TYPEM o; } \
+ S##NAME##15; \
+typedef struct { TYPEM a; TYPEM b; TYPEM c; TYPEM d; TYPEM e; \
+ TYPEM f; TYPEM g; TYPEM h; TYPEM i; TYPEM j; \
+ TYPEM k; TYPEM l; TYPEM m; TYPEM n; TYPEM o; \
+ TYPEM p; } S##NAME##16;
diff --git a/gcc/testsuite/gcc.dg/compat/fp-struct-init.h b/gcc/testsuite/gcc.dg/compat/fp-struct-init.h
new file mode 100644
index 00000000000..46a0cef1d03
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/compat/fp-struct-init.h
@@ -0,0 +1,54 @@
+/* Function definitions that are used by multiple tests. */
+
+#define INITS(NAME,TYPEM) \
+void initS##NAME##1 (S##NAME##1 *p, TYPEM y) \
+{ p->a = y; } \
+void initS##NAME##2 (S##NAME##2 *p, TYPEM y) \
+{ p->a = y; p->b = y+1; } \
+void initS##NAME##3 (S##NAME##3 *p, TYPEM y) \
+{ p->a = y; p->b = y+1; p->c = y+2; } \
+void initS##NAME##4 (S##NAME##4 *p, TYPEM y) \
+{ p->a = y; p->b = y+1; p->c = y+2; p->d = y+3; } \
+void initS##NAME##5 (S##NAME##5 *p, TYPEM y) \
+{ p->a = y; p->b = y+1; p->c = y+2; p->d = y+3; p->e = y+4; } \
+void initS##NAME##6 (S##NAME##6 *p, TYPEM y) \
+{ p->a = y; p->b = y+1; p->c = y+2; p->d = y+3; p->e = y+4; \
+ p->f = y+5; } \
+void initS##NAME##7 (S##NAME##7 *p, TYPEM y) \
+{ p->a = y; p->b = y+1; p->c = y+2; p->d = y+3; p->e = y+4; \
+ p->f = y+5; p->g = y+6; } \
+void initS##NAME##8 (S##NAME##8 *p, TYPEM y) \
+{ p->a = y; p->b = y+1; p->c = y+2; p->d = y+3; p->e = y+4; \
+ p->f = y+5; p->g = y+6; p->h = y+7; } \
+void initS##NAME##9 (S##NAME##9 *p, TYPEM y) \
+{ p->a = y; p->b = y+1; p->c = y+2; p->d = y+3; p->e = y+4; \
+ p->f = y+5; p->g = y+6; p->h = y+7; p->i = y+8; } \
+void initS##NAME##10 (S##NAME##10 *p, TYPEM y) \
+{ p->a = y; p->b = y+1; p->c = y+2; p->d = y+3; p->e = y+4; \
+ p->f = y+5; p->g = y+6; p->h = y+7; p->i = y+8; p->j = y+9; } \
+void initS##NAME##11 (S##NAME##11 *p, TYPEM y) \
+{ p->a = y; p->b = y+1; p->c = y+2; p->d = y+3; p->e = y+4; \
+ p->f = y+5; p->g = y+6; p->h = y+7; p->i = y+8; p->j = y+9; \
+ p->k = y+10; } \
+void initS##NAME##12 (S##NAME##12 *p, TYPEM y) \
+{ p->a = y; p->b = y+1; p->c = y+2; p->d = y+3; p->e = y+4; \
+ p->f = y+5; p->g = y+6; p->h = y+7; p->i = y+8; p->j = y+9; \
+ p->k = y+10; p->l = y+11; } \
+void initS##NAME##13 (S##NAME##13 *p, TYPEM y) \
+{ p->a = y; p->b = y+1; p->c = y+2; p->d = y+3; p->e = y+4; \
+ p->f = y+5; p->g = y+6; p->h = y+7; p->i = y+8; p->j = y+9; \
+ p->k = y+10; p->l = y+11; p->m = y+12; } \
+void initS##NAME##14 (S##NAME##14 *p, TYPEM y) \
+{ p->a = y; p->b = y+1; p->c = y+2; p->d = y+3; p->e = y+4; \
+ p->f = y+5; p->g = y+6; p->h = y+7; p->i = y+8; p->j = y+9; \
+ p->k = y+10; p->l = y+11; p->m = y+12; p->n = y+13; } \
+void initS##NAME##15 (S##NAME##15 *p, TYPEM y) \
+{ p->a = y; p->b = y+1; p->c = y+2; p->d = y+3; p->e = y+4; \
+ p->f = y+5; p->g = y+6; p->h = y+7; p->i = y+8; p->j = y+9; \
+ p->k = y+10; p->l = y+11; p->m = y+12; p->n = y+13; \
+ p->o = y+14; } \
+void initS##NAME##16 (S##NAME##16 *p, TYPEM y) \
+{ p->a = y; p->b = y+1; p->c = y+2; p->d = y+3; p->e = y+4; \
+ p->f = y+5; p->g = y+6; p->h = y+7; p->i = y+8; p->j = y+9; \
+ p->k = y+10; p->l = y+11; p->m = y+12; p->n = y+13; \
+ p->o = y+14; p->p = y+15; }
diff --git a/gcc/testsuite/gcc.dg/compat/fp-struct-test-by-value-x.h b/gcc/testsuite/gcc.dg/compat/fp-struct-test-by-value-x.h
new file mode 100644
index 00000000000..867c75b01ca
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/compat/fp-struct-test-by-value-x.h
@@ -0,0 +1,113 @@
+#define TEST(TYPE,MTYPE) \
+TYPE g1s##TYPE, g2s##TYPE, g3s##TYPE, g4s##TYPE; \
+TYPE g5s##TYPE, g6s##TYPE, g7s##TYPE, g8s##TYPE; \
+TYPE g9s##TYPE, g10s##TYPE, g11s##TYPE, g12s##TYPE; \
+TYPE g13s##TYPE, g14s##TYPE, g15s##TYPE, g16s##TYPE; \
+ \
+extern void init##TYPE (TYPE *p, MTYPE x); \
+extern void checkg##TYPE (void); \
+extern void \
+test##TYPE (TYPE s1, TYPE s2, TYPE s3, TYPE s4, \
+ TYPE s5, TYPE s6, TYPE s7, TYPE s8, \
+ TYPE s9, TYPE s10, TYPE s11, TYPE s12, \
+ TYPE s13, TYPE s14, TYPE s15, TYPE s16); \
+extern void testva##TYPE (int n, ...); \
+ \
+void \
+test2_##TYPE (TYPE s1, TYPE s2, TYPE s3, TYPE s4, \
+ TYPE s5, TYPE s6, TYPE s7, TYPE s8) \
+{ \
+ test##TYPE (s1, g2s##TYPE, s2, g4s##TYPE, \
+ s3, g6s##TYPE, s4, g8s##TYPE, \
+ s5, g10s##TYPE, s6, g12s##TYPE, \
+ s7, g14s##TYPE, s8, g16s##TYPE); \
+} \
+ \
+void \
+testit##TYPE (void) \
+{ \
+ DEBUG_FPUTS (#TYPE); \
+ init##TYPE ( &g1s##TYPE, (MTYPE)1); \
+ init##TYPE ( &g2s##TYPE, (MTYPE)2); \
+ init##TYPE ( &g3s##TYPE, (MTYPE)3); \
+ init##TYPE ( &g4s##TYPE, (MTYPE)4); \
+ init##TYPE ( &g5s##TYPE, (MTYPE)5); \
+ init##TYPE ( &g6s##TYPE, (MTYPE)6); \
+ init##TYPE ( &g7s##TYPE, (MTYPE)7); \
+ init##TYPE ( &g8s##TYPE, (MTYPE)8); \
+ init##TYPE ( &g9s##TYPE, (MTYPE)9); \
+ init##TYPE (&g10s##TYPE, (MTYPE)10); \
+ init##TYPE (&g11s##TYPE, (MTYPE)11); \
+ init##TYPE (&g12s##TYPE, (MTYPE)12); \
+ init##TYPE (&g13s##TYPE, (MTYPE)13); \
+ init##TYPE (&g14s##TYPE, (MTYPE)14); \
+ init##TYPE (&g15s##TYPE, (MTYPE)15); \
+ init##TYPE (&g16s##TYPE, (MTYPE)16); \
+ checkg##TYPE (); \
+ DEBUG_FPUTS (" test"); \
+ test##TYPE (g1s##TYPE, g2s##TYPE, g3s##TYPE, g4s##TYPE, \
+ g5s##TYPE, g6s##TYPE, g7s##TYPE, g8s##TYPE, \
+ g9s##TYPE, g10s##TYPE, g11s##TYPE, g12s##TYPE, \
+ g13s##TYPE, g14s##TYPE, g15s##TYPE, g16s##TYPE); \
+ DEBUG_FPUTS (" testva"); \
+ testva##TYPE (1, \
+ g1s##TYPE); \
+ testva##TYPE (2, \
+ g1s##TYPE, g2s##TYPE); \
+ testva##TYPE (3, \
+ g1s##TYPE, g2s##TYPE, g3s##TYPE); \
+ testva##TYPE (4, \
+ g1s##TYPE, g2s##TYPE, g3s##TYPE, g4s##TYPE); \
+ testva##TYPE (5, \
+ g1s##TYPE, g2s##TYPE, g3s##TYPE, g4s##TYPE, \
+ g5s##TYPE); \
+ testva##TYPE (6, \
+ g1s##TYPE, g2s##TYPE, g3s##TYPE, g4s##TYPE, \
+ g5s##TYPE, g6s##TYPE); \
+ testva##TYPE (7, \
+ g1s##TYPE, g2s##TYPE, g3s##TYPE, g4s##TYPE, \
+ g5s##TYPE, g6s##TYPE, g7s##TYPE); \
+ testva##TYPE (8, \
+ g1s##TYPE, g2s##TYPE, g3s##TYPE, g4s##TYPE, \
+ g5s##TYPE, g6s##TYPE, g7s##TYPE, g8s##TYPE); \
+ testva##TYPE (9, \
+ g1s##TYPE, g2s##TYPE, g3s##TYPE, g4s##TYPE, \
+ g5s##TYPE, g6s##TYPE, g7s##TYPE, g8s##TYPE, \
+ g9s##TYPE); \
+ testva##TYPE (10, \
+ g1s##TYPE, g2s##TYPE, g3s##TYPE, g4s##TYPE, \
+ g5s##TYPE, g6s##TYPE, g7s##TYPE, g8s##TYPE, \
+ g9s##TYPE, g10s##TYPE); \
+ testva##TYPE (11, \
+ g1s##TYPE, g2s##TYPE, g3s##TYPE, g4s##TYPE, \
+ g5s##TYPE, g6s##TYPE, g7s##TYPE, g8s##TYPE, \
+ g9s##TYPE, g10s##TYPE, g11s##TYPE); \
+ testva##TYPE (12, \
+ g1s##TYPE, g2s##TYPE, g3s##TYPE, g4s##TYPE, \
+ g5s##TYPE, g6s##TYPE, g7s##TYPE, g8s##TYPE, \
+ g9s##TYPE, g10s##TYPE, g11s##TYPE, g12s##TYPE); \
+ testva##TYPE (13, \
+ g1s##TYPE, g2s##TYPE, g3s##TYPE, g4s##TYPE, \
+ g5s##TYPE, g6s##TYPE, g7s##TYPE, g8s##TYPE, \
+ g9s##TYPE, g10s##TYPE, g11s##TYPE, g12s##TYPE, \
+ g13s##TYPE); \
+ testva##TYPE (14, \
+ g1s##TYPE, g2s##TYPE, g3s##TYPE, g4s##TYPE, \
+ g5s##TYPE, g6s##TYPE, g7s##TYPE, g8s##TYPE, \
+ g9s##TYPE, g10s##TYPE, g11s##TYPE, g12s##TYPE, \
+ g13s##TYPE, g14s##TYPE); \
+ testva##TYPE (15, \
+ g1s##TYPE, g2s##TYPE, g3s##TYPE, g4s##TYPE, \
+ g5s##TYPE, g6s##TYPE, g7s##TYPE, g8s##TYPE, \
+ g9s##TYPE, g10s##TYPE, g11s##TYPE, g12s##TYPE, \
+ g13s##TYPE, g14s##TYPE, g15s##TYPE); \
+ testva##TYPE (16, \
+ g1s##TYPE, g2s##TYPE, g3s##TYPE, g4s##TYPE, \
+ g5s##TYPE, g6s##TYPE, g7s##TYPE, g8s##TYPE, \
+ g9s##TYPE, g10s##TYPE, g11s##TYPE, g12s##TYPE, \
+ g13s##TYPE, g14s##TYPE, g15s##TYPE, g16s##TYPE); \
+ DEBUG_FPUTS (" test2"); \
+ test2_##TYPE (g1s##TYPE, g3s##TYPE, g5s##TYPE, g7s##TYPE, \
+ g9s##TYPE, g11s##TYPE, g13s##TYPE, g15s##TYPE); \
+ DEBUG_NL; \
+}
diff --git a/gcc/testsuite/gcc.dg/compat/fp-struct-test-by-value-y.h b/gcc/testsuite/gcc.dg/compat/fp-struct-test-by-value-y.h
new file mode 100644
index 00000000000..89d2faa8618
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/compat/fp-struct-test-by-value-y.h
@@ -0,0 +1,86 @@
+#define TEST(TYPE,TYPE2) \
+extern TYPE g1s##TYPE, g2s##TYPE, g3s##TYPE, g4s##TYPE; \
+extern TYPE g5s##TYPE, g6s##TYPE, g7s##TYPE, g8s##TYPE; \
+extern TYPE g9s##TYPE, g10s##TYPE, g11s##TYPE, g12s##TYPE; \
+extern TYPE g13s##TYPE, g14s##TYPE, g15s##TYPE, g16s##TYPE; \
+ \
+extern void check##TYPE (TYPE x, TYPE2 y); \
+ \
+void \
+checkg##TYPE (void) \
+{ \
+ check##TYPE ( g1s##TYPE, (TYPE2)1); \
+ check##TYPE ( g2s##TYPE, (TYPE2)2); \
+ check##TYPE ( g3s##TYPE, (TYPE2)3); \
+ check##TYPE ( g4s##TYPE, (TYPE2)4); \
+ check##TYPE ( g5s##TYPE, (TYPE2)5); \
+ check##TYPE ( g6s##TYPE, (TYPE2)6); \
+ check##TYPE ( g7s##TYPE, (TYPE2)7); \
+ check##TYPE ( g8s##TYPE, (TYPE2)8); \
+ check##TYPE ( g9s##TYPE, (TYPE2)9); \
+ check##TYPE ( g10s##TYPE, (TYPE2)10); \
+ check##TYPE ( g11s##TYPE, (TYPE2)11); \
+ check##TYPE ( g12s##TYPE, (TYPE2)12); \
+ check##TYPE ( g13s##TYPE, (TYPE2)13); \
+ check##TYPE ( g14s##TYPE, (TYPE2)14); \
+ check##TYPE ( g15s##TYPE, (TYPE2)15); \
+ check##TYPE ( g16s##TYPE, (TYPE2)16); \
+} \
+ \
+void \
+test##TYPE (TYPE s1, TYPE s2, TYPE s3, TYPE s4, \
+ TYPE s5, TYPE s6, TYPE s7, TYPE s8, \
+ TYPE s9, TYPE s10, TYPE s11, TYPE s12, \
+ TYPE s13, TYPE s14, TYPE s15, TYPE s16) \
+{ \
+ DEBUG_DOT; \
+ check##TYPE (s1, (TYPE2)1); \
+ DEBUG_DOT; \
+ check##TYPE (s2, (TYPE2)2); \
+ DEBUG_DOT; \
+ check##TYPE (s3, (TYPE2)3); \
+ DEBUG_DOT; \
+ check##TYPE (s4, (TYPE2)4); \
+ DEBUG_DOT; \
+ check##TYPE (s5, (TYPE2)5); \
+ DEBUG_DOT; \
+ check##TYPE (s6, (TYPE2)6); \
+ DEBUG_DOT; \
+ check##TYPE (s7, (TYPE2)7); \
+ DEBUG_DOT; \
+ check##TYPE (s8, (TYPE2)8); \
+ DEBUG_DOT; \
+ check##TYPE (s9, (TYPE2)9); \
+ DEBUG_DOT; \
+ check##TYPE (s10, (TYPE2)10); \
+ DEBUG_DOT; \
+ check##TYPE (s11, (TYPE2)11); \
+ DEBUG_DOT; \
+ check##TYPE (s12, (TYPE2)12); \
+ DEBUG_DOT; \
+ check##TYPE (s13, (TYPE2)13); \
+ DEBUG_DOT; \
+ check##TYPE (s14, (TYPE2)14); \
+ DEBUG_DOT; \
+ check##TYPE (s15, (TYPE2)15); \
+ DEBUG_DOT; \
+ check##TYPE (s16, (TYPE2)16); \
+} \
+ \
+void \
+testva##TYPE (int n, ...) \
+{ \
+ int i; \
+ va_list ap; \
+ if (test_va) \
+ { \
+ va_start (ap, n); \
+ for (i = 0; i < n; i++) \
+ { \
+ TYPE t = va_arg (ap, TYPE); \
+ DEBUG_DOT; \
+ check##TYPE (t, (TYPE2)i+1); \
+ } \
+ va_end (ap); \
+ } \
+}
diff --git a/gcc/testsuite/gcc.dg/compat/scalar-return-1_main.c b/gcc/testsuite/gcc.dg/compat/scalar-return-1_main.c
new file mode 100644
index 00000000000..0dca50b1c8a
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/compat/scalar-return-1_main.c
@@ -0,0 +1,12 @@
+/* Test function return values. This test includes scalar types that
+ are supported by va_arg. */
+
+extern void scalar_return_1_x (void);
+extern void exit (int);
+
+int
+main ()
+{
+ scalar_return_1_x ();
+ exit (0);
+}
diff --git a/gcc/testsuite/gcc.dg/compat/scalar-return-1_x.c b/gcc/testsuite/gcc.dg/compat/scalar-return-1_x.c
new file mode 100644
index 00000000000..aaa634e81b6
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/compat/scalar-return-1_x.c
@@ -0,0 +1,110 @@
+#ifdef DBG
+#include <stdio.h>
+#define DEBUG_FPUTS(x) fputs (x, stdout)
+#define DEBUG_DOT putc ('.', stdout)
+#define DEBUG_NL putc ('\n', stdout)
+#else
+#define DEBUG_FPUTS(x)
+#define DEBUG_DOT
+#define DEBUG_NL
+#endif
+
+#define T(NAME, TYPE, INITVAL) \
+TYPE g01##NAME, g02##NAME, g03##NAME, g04##NAME; \
+TYPE g05##NAME, g06##NAME, g07##NAME, g08##NAME; \
+TYPE g09##NAME, g10##NAME, g11##NAME, g12##NAME; \
+TYPE g13##NAME, g14##NAME, g15##NAME, g16##NAME; \
+ \
+extern void init##NAME (TYPE *p, TYPE v); \
+extern void checkg##NAME (void); \
+extern TYPE test0##NAME (void); \
+extern TYPE test1##NAME (TYPE); \
+extern TYPE testva##NAME (int n, ...); \
+ \
+void \
+check##NAME (TYPE x, TYPE v) \
+{ \
+ if (x != v) \
+ { \
+ DEBUG_NL; \
+ abort (); \
+ } \
+} \
+ \
+void \
+testit##NAME (void) \
+{ \
+ TYPE rslt; \
+ DEBUG_FPUTS (#NAME); \
+ init##NAME (&g01##NAME, 1); \
+ init##NAME (&g02##NAME, 2); \
+ init##NAME (&g03##NAME, 3); \
+ init##NAME (&g04##NAME, 4); \
+ init##NAME (&g05##NAME, 5); \
+ init##NAME (&g06##NAME, 6); \
+ init##NAME (&g07##NAME, 7); \
+ init##NAME (&g08##NAME, 8); \
+ init##NAME (&g09##NAME, 9); \
+ init##NAME (&g10##NAME, 10); \
+ init##NAME (&g11##NAME, 11); \
+ init##NAME (&g12##NAME, 12); \
+ init##NAME (&g13##NAME, 13); \
+ init##NAME (&g14##NAME, 14); \
+ init##NAME (&g15##NAME, 15); \
+ init##NAME (&g16##NAME, 16); \
+ checkg##NAME (); \
+ DEBUG_FPUTS (" test0"); \
+ rslt = test0##NAME (); \
+ check##NAME (rslt, g01##NAME); \
+ DEBUG_FPUTS (" test1"); \
+ rslt = test1##NAME (g01##NAME); \
+ check##NAME (rslt, g01##NAME); \
+ DEBUG_FPUTS (" testva"); \
+ rslt = testva##NAME (1, g01##NAME); \
+ check##NAME (rslt, g01##NAME); \
+ rslt = testva##NAME (5, g01##NAME, g02##NAME, g03##NAME, \
+ g04##NAME, g05##NAME); \
+ check##NAME (rslt, g05##NAME); \
+ rslt = testva##NAME (9, g01##NAME, g02##NAME, g03##NAME, \
+ g04##NAME, g05##NAME, g06##NAME, \
+ g07##NAME, g08##NAME, g09##NAME); \
+ check##NAME (rslt, g09##NAME); \
+ rslt = testva##NAME (16, g01##NAME, g02##NAME, g03##NAME, \
+ g04##NAME, g05##NAME, g06##NAME, \
+ g07##NAME, g08##NAME, g09##NAME, \
+ g10##NAME, g11##NAME, g12##NAME, \
+ g13##NAME, g14##NAME, g15##NAME, \
+ g16##NAME); \
+ check##NAME (rslt, g16##NAME); \
+ DEBUG_NL; \
+}
+
+extern void abort (void);
+
+T(ui, unsigned int, 51)
+T(si, int, (-55))
+T(ul, unsigned long, 61)
+T(sl, long, (-66))
+T(ull, unsigned long long, 71)
+T(sll, long long, (-77))
+T(d, double, 91.0)
+T(ld, long double, 92.0)
+
+#undef T
+
+void
+scalar_return_1_x ()
+{
+#define T(NAME) testit##NAME ();
+
+T(ui)
+T(si)
+T(ul)
+T(sl)
+T(ull)
+T(sll)
+T(d)
+T(ld)
+
+#undef T
+}
diff --git a/gcc/testsuite/gcc.dg/compat/scalar-return-1_y.c b/gcc/testsuite/gcc.dg/compat/scalar-return-1_y.c
new file mode 100644
index 00000000000..edf332bd370
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/compat/scalar-return-1_y.c
@@ -0,0 +1,94 @@
+#include <stdarg.h>
+
+#ifdef DBG
+#include <stdio.h>
+#define DEBUG_FPUTS(x) fputs (x, stdout)
+#define DEBUG_DOT putc ('.', stdout)
+#define DEBUG_NL putc ('\n', stdout)
+#else
+#define DEBUG_FPUTS(x)
+#define DEBUG_DOT
+#define DEBUG_NL
+#endif
+
+/* Turn off checking for variable arguments with -DSKIPVA. */
+#ifdef SKIPVA
+const int test_va = 0;
+#else
+const int test_va = 1;
+#endif
+
+#define T(NAME, TYPE, INITVAL) \
+extern TYPE g01##NAME, g02##NAME, g03##NAME, g04##NAME; \
+extern TYPE g05##NAME, g06##NAME, g07##NAME, g08##NAME; \
+extern TYPE g09##NAME, g10##NAME, g11##NAME, g12##NAME; \
+extern TYPE g13##NAME, g14##NAME, g15##NAME, g16##NAME; \
+ \
+extern void check##NAME (TYPE x, TYPE v); \
+ \
+void \
+init##NAME (TYPE *p, TYPE v) \
+{ \
+ *p = v + INITVAL; \
+} \
+ \
+void \
+checkg##NAME (void) \
+{ \
+ check##NAME (g01##NAME, 1+INITVAL); \
+ check##NAME (g02##NAME, 2+INITVAL); \
+ check##NAME (g03##NAME, 3+INITVAL); \
+ check##NAME (g04##NAME, 4+INITVAL); \
+ check##NAME (g05##NAME, 5+INITVAL); \
+ check##NAME (g06##NAME, 6+INITVAL); \
+ check##NAME (g07##NAME, 7+INITVAL); \
+ check##NAME (g08##NAME, 8+INITVAL); \
+ check##NAME (g09##NAME, 9+INITVAL); \
+ check##NAME (g10##NAME, 10+INITVAL); \
+ check##NAME (g11##NAME, 11+INITVAL); \
+ check##NAME (g12##NAME, 12+INITVAL); \
+ check##NAME (g13##NAME, 13+INITVAL); \
+ check##NAME (g14##NAME, 14+INITVAL); \
+ check##NAME (g15##NAME, 15+INITVAL); \
+ check##NAME (g16##NAME, 16+INITVAL); \
+} \
+ \
+TYPE \
+test0##NAME (void) \
+{ \
+ return g01##NAME; \
+} \
+ \
+TYPE \
+test1##NAME (TYPE x01) \
+{ \
+ return x01; \
+} \
+ \
+TYPE \
+testva##NAME (int n, ...) \
+{ \
+ int i; \
+ TYPE rslt; \
+ va_list ap; \
+ if (test_va) \
+ { \
+ va_start (ap, n); \
+ for (i = 0; i < n; i++) \
+ { \
+ rslt = va_arg (ap, TYPE); \
+ DEBUG_DOT; \
+ } \
+ va_end (ap); \
+ } \
+ return rslt; \
+}
+
+T(ui, unsigned int, 51)
+T(si, int, (-55))
+T(ul, unsigned long, 61)
+T(sl, long, (-66))
+T(ull, unsigned long long, 71)
+T(sll, long long, (-77))
+T(d, double, 91.0)
+T(ld, long double, 92.0)
diff --git a/gcc/testsuite/gcc.dg/compat/scalar-return-2_main.c b/gcc/testsuite/gcc.dg/compat/scalar-return-2_main.c
new file mode 100644
index 00000000000..56325e3dab7
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/compat/scalar-return-2_main.c
@@ -0,0 +1,12 @@
+/* Test function return values. This test includes scalar types that
+ are not supported by va_arg. */
+
+extern void scalar_return_2_x (void);
+extern void exit (int);
+
+int
+main ()
+{
+ scalar_return_2_x ();
+ exit (0);
+}
diff --git a/gcc/testsuite/gcc.dg/compat/scalar-return-2_x.c b/gcc/testsuite/gcc.dg/compat/scalar-return-2_x.c
new file mode 100644
index 00000000000..16b4dd8c32a
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/compat/scalar-return-2_x.c
@@ -0,0 +1,88 @@
+#ifdef DBG
+#include <stdio.h>
+#define DEBUG_FPUTS(x) fputs (x, stdout)
+#define DEBUG_DOT putc ('.', stdout)
+#define DEBUG_NL putc ('\n', stdout)
+#else
+#define DEBUG_FPUTS(x)
+#define DEBUG_DOT
+#define DEBUG_NL
+#endif
+
+#define T(NAME, TYPE, INITVAL) \
+TYPE g01##NAME, g02##NAME, g03##NAME, g04##NAME; \
+TYPE g05##NAME, g06##NAME, g07##NAME, g08##NAME; \
+TYPE g09##NAME, g10##NAME, g11##NAME, g12##NAME; \
+TYPE g13##NAME, g14##NAME, g15##NAME, g16##NAME; \
+ \
+extern void init##NAME (TYPE *p, TYPE v); \
+extern void checkg##NAME (void); \
+extern TYPE test0##NAME (void); \
+extern TYPE test1##NAME (TYPE); \
+ \
+void \
+check##NAME (TYPE x, TYPE v) \
+{ \
+ if (x != v) \
+ { \
+ DEBUG_NL; \
+ abort (); \
+ } \
+} \
+ \
+void \
+testit##NAME (void) \
+{ \
+ TYPE rslt; \
+ DEBUG_FPUTS (#NAME); \
+ init##NAME (&g01##NAME, 1); \
+ init##NAME (&g02##NAME, 2); \
+ init##NAME (&g03##NAME, 3); \
+ init##NAME (&g04##NAME, 4); \
+ init##NAME (&g05##NAME, 5); \
+ init##NAME (&g06##NAME, 6); \
+ init##NAME (&g07##NAME, 7); \
+ init##NAME (&g08##NAME, 8); \
+ init##NAME (&g09##NAME, 9); \
+ init##NAME (&g10##NAME, 10); \
+ init##NAME (&g11##NAME, 11); \
+ init##NAME (&g12##NAME, 12); \
+ init##NAME (&g13##NAME, 13); \
+ init##NAME (&g14##NAME, 14); \
+ init##NAME (&g15##NAME, 15); \
+ init##NAME (&g16##NAME, 16); \
+ checkg##NAME (); \
+ DEBUG_FPUTS (" test0"); \
+ rslt = test0##NAME (); \
+ check##NAME (rslt, g01##NAME); \
+ DEBUG_FPUTS (" test1"); \
+ rslt = test1##NAME (g01##NAME); \
+ check##NAME (rslt, g01##NAME); \
+ DEBUG_NL; \
+}
+
+extern void abort (void);
+
+T(c, char, 21)
+T(uc, unsigned char, 22)
+T(sc, signed char, (-33))
+T(us, unsigned short, 41)
+T(ss, short, (-44))
+T(f, float, 90.0)
+
+#undef T
+
+void
+scalar_return_2_x ()
+{
+#define T(NAME) testit##NAME ();
+
+T(c)
+T(uc)
+T(sc)
+T(us)
+T(ss)
+T(f)
+
+#undef T
+}
diff --git a/gcc/testsuite/gcc.dg/compat/scalar-return-2_y.c b/gcc/testsuite/gcc.dg/compat/scalar-return-2_y.c
new file mode 100644
index 00000000000..89a824c9245
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/compat/scalar-return-2_y.c
@@ -0,0 +1,73 @@
+#include <stdarg.h>
+
+#ifdef DBG
+#include <stdio.h>
+#define DEBUG_FPUTS(x) fputs (x, stdout)
+#define DEBUG_DOT putc ('.', stdout)
+#define DEBUG_NL putc ('\n', stdout)
+#else
+#define DEBUG_FPUTS(x)
+#define DEBUG_DOT
+#define DEBUG_NL
+#endif
+
+/* Turn off checking for variable arguments with -DSKIPVA. */
+#ifdef SKIPVA
+const int test_va = 0;
+#else
+const int test_va = 1;
+#endif
+
+#define T(NAME, TYPE, INITVAL) \
+extern TYPE g01##NAME, g02##NAME, g03##NAME, g04##NAME; \
+extern TYPE g05##NAME, g06##NAME, g07##NAME, g08##NAME; \
+extern TYPE g09##NAME, g10##NAME, g11##NAME, g12##NAME; \
+extern TYPE g13##NAME, g14##NAME, g15##NAME, g16##NAME; \
+ \
+extern void check##NAME (TYPE x, TYPE v); \
+ \
+void \
+init##NAME (TYPE *p, TYPE v) \
+{ \
+ *p = v + INITVAL; \
+} \
+ \
+void \
+checkg##NAME (void) \
+{ \
+ check##NAME (g01##NAME, 1+INITVAL); \
+ check##NAME (g02##NAME, 2+INITVAL); \
+ check##NAME (g03##NAME, 3+INITVAL); \
+ check##NAME (g04##NAME, 4+INITVAL); \
+ check##NAME (g05##NAME, 5+INITVAL); \
+ check##NAME (g06##NAME, 6+INITVAL); \
+ check##NAME (g07##NAME, 7+INITVAL); \
+ check##NAME (g08##NAME, 8+INITVAL); \
+ check##NAME (g09##NAME, 9+INITVAL); \
+ check##NAME (g10##NAME, 10+INITVAL); \
+ check##NAME (g11##NAME, 11+INITVAL); \
+ check##NAME (g12##NAME, 12+INITVAL); \
+ check##NAME (g13##NAME, 13+INITVAL); \
+ check##NAME (g14##NAME, 14+INITVAL); \
+ check##NAME (g15##NAME, 15+INITVAL); \
+ check##NAME (g16##NAME, 16+INITVAL); \
+} \
+ \
+TYPE \
+test0##NAME (void) \
+{ \
+ return g01##NAME; \
+} \
+ \
+TYPE \
+test1##NAME (TYPE x01) \
+{ \
+ return x01; \
+}
+
+T(c, char, 21)
+T(uc, unsigned char, 22)
+T(sc, signed char, (-33))
+T(us, unsigned short, 41)
+T(ss, short, (-44))
+T(f, float, 90.0)
diff --git a/gcc/testsuite/gcc.dg/compat/small-struct-check.h b/gcc/testsuite/gcc.dg/compat/small-struct-check.h
new file mode 100644
index 00000000000..9ae103f987e
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/compat/small-struct-check.h
@@ -0,0 +1,29 @@
+/* Function definitions that are used by multiple tests. */
+
+void checkSc (Sc x, int i) { if (x.c != (char)i) { DEBUG_NL; abort (); } }
+void checkSs (Ss x, int i) { if (x.s != i) { DEBUG_NL; abort (); } }
+void checkSi (Si x, int i) { if (x.i != i) { DEBUG_NL; abort (); } }
+void checkSsc (Ssc x, int i)
+{ if (x.s != i || x.c != (char)i+1) { DEBUG_NL; abort (); } }
+void checkScs (Scs x, int i)
+{ if (x.c != (char)i || x.s != i+1) { DEBUG_NL; abort (); } }
+void checkSsi (Ssi x, int i)
+{ if (x.s != i || x.i != i+1) { DEBUG_NL; abort (); } }
+void checkSis (Sis x, int i)
+{ if (x.i != i || x.s != i+1) { DEBUG_NL; abort (); } }
+void checkSic (Sic x, int i)
+{ if (x.i != i || x.c != (char)i+1) { DEBUG_NL; abort (); } }
+void checkSci (Sci x, int i)
+{ if (x.c != (char)i || x.i != i+1) { DEBUG_NL; abort (); } }
+void checkScsi (Scsi x, int i)
+{ if (x.c != (char)i || x.s != i+1 || x.i != i+2) { DEBUG_NL; abort (); } }
+void checkScis (Scis x, int i)
+{ if (x.c != (char)i || x.i != i+1 || x.s != i+2) { DEBUG_NL; abort (); } }
+void checkSsci (Ssci x, int i)
+{ if (x.s != i || x.c != (char)i+1 || x.i != i+2) { DEBUG_NL; abort (); } }
+void checkSsic (Ssic x, int i)
+{ if (x.s != i || x.i != i+1 || x.c != (char)i+2) { DEBUG_NL; abort (); } }
+void checkSisc (Sisc x, int i)
+{ if (x.i != i || x.s != i+1 || x.c != (char)i+2) { DEBUG_NL; abort (); } }
+void checkSics (Sics x, int i)
+{ if (x.i != i || x.c != (char)i+1 || x.s != i+2) { DEBUG_NL; abort (); } }
diff --git a/gcc/testsuite/gcc.dg/compat/small-struct-defs.h b/gcc/testsuite/gcc.dg/compat/small-struct-defs.h
new file mode 100644
index 00000000000..1a46b26e805
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/compat/small-struct-defs.h
@@ -0,0 +1,17 @@
+/* Type definitions that are used by multiple tests. */
+
+typedef struct { char c; } Sc;
+typedef struct { short s; } Ss;
+typedef struct { int i; } Si;
+typedef struct { short s; char c; } Ssc;
+typedef struct { char c; short s; } Scs;
+typedef struct { int i; char c; } Sic;
+typedef struct { char c; int i; } Sci;
+typedef struct { short s; int i; } Ssi;
+typedef struct { int i; short s; } Sis;
+typedef struct { char c; short s; int i; } Scsi;
+typedef struct { char c; int i; short s; } Scis;
+typedef struct { short s; char c; int i; } Ssci;
+typedef struct { short s; int i; char c; } Ssic;
+typedef struct { int i; short s; char c; } Sisc;
+typedef struct { int i; char c; short s; } Sics;
diff --git a/gcc/testsuite/gcc.dg/compat/small-struct-init.h b/gcc/testsuite/gcc.dg/compat/small-struct-init.h
new file mode 100644
index 00000000000..97009b6ee32
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/compat/small-struct-init.h
@@ -0,0 +1,17 @@
+/* Function definitions that are used by multiple tests. */
+
+void initSc (Sc *p, int i) { p->c = (char)i; }
+void initSs (Ss *p, int i) { p->s = i; }
+void initSi (Si *p, int i) { p->i = i; }
+void initSsc (Ssc *p, int i) { p->s = i; p->c = (char)i+1; }
+void initScs (Scs *p, int i) { p->c = (char)i; p->s = i+1; }
+void initSsi (Ssi *p, int i) { p->s = i; p->i = i+1; }
+void initSis (Sis *p, int i) { p->i = i; p->s = i+1; }
+void initSic (Sic *p, int i) { p->i = i; p->c = (char)i+1; }
+void initSci (Sci *p, int i) { p->c = (char)i; p->i = i+1; }
+void initScsi (Scsi *p, int i) { p->c = (char)i; p->s = i+1; p->i = i+2; }
+void initScis (Scis *p, int i) { p->c = (char)i; p->i = i+1; p->s = i+2; }
+void initSsci (Ssci *p, int i) { p->s = i; p->c = (char)i+1; p->i = i+2; }
+void initSsic (Ssic *p, int i) { p->s = i; p->i = i+1; p->c = (char)i+2; }
+void initSisc (Sisc *p, int i) { p->i = i; p->s = i+1; p->c = (char)i+2; }
+void initSics (Sics *p, int i) { p->i = i; p->c = (char)i+1; p->s = i+2; }
diff --git a/gcc/testsuite/gcc.dg/compat/struct-by-value-6_main.c b/gcc/testsuite/gcc.dg/compat/struct-by-value-6_main.c
new file mode 100644
index 00000000000..4e7308fbf3b
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/compat/struct-by-value-6_main.c
@@ -0,0 +1,13 @@
+/* Test structures passed by value, including to a function with a
+ variable-length argument lists. All struct members are double
+ scalars. */
+
+extern void struct_by_value_6_x (void);
+extern void exit (int);
+
+int
+main ()
+{
+ struct_by_value_6_x ();
+ exit (0);
+}
diff --git a/gcc/testsuite/gcc.dg/compat/struct-by-value-6_x.c b/gcc/testsuite/gcc.dg/compat/struct-by-value-6_x.c
new file mode 100644
index 00000000000..4b87017cfeb
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/compat/struct-by-value-6_x.c
@@ -0,0 +1,63 @@
+#ifdef DBG
+#include <stdio.h>
+#define DEBUG_FPUTS(x) fputs (x, stdout)
+#define DEBUG_DOT putc ('.', stdout)
+#define DEBUG_NL putc ('\n', stdout)
+#else
+#define DEBUG_FPUTS(x)
+#define DEBUG_DOT
+#define DEBUG_NL
+#endif
+
+#include "fp-struct-defs.h"
+#include "fp-struct-check.h"
+#include "fp-struct-test-by-value-x.h"
+
+extern void abort (void);
+
+DEFS(d, double)
+CHECKS(d, double)
+
+TEST(Sd1, double)
+TEST(Sd2, double)
+TEST(Sd3, double)
+TEST(Sd4, double)
+TEST(Sd5, double)
+TEST(Sd6, double)
+TEST(Sd7, double)
+TEST(Sd8, double)
+TEST(Sd9, double)
+TEST(Sd10, double)
+TEST(Sd11, double)
+TEST(Sd12, double)
+TEST(Sd13, double)
+TEST(Sd14, double)
+TEST(Sd15, double)
+TEST(Sd16, double)
+
+#undef T
+
+void
+struct_by_value_6_x ()
+{
+#define T(TYPE, MTYPE) testit##TYPE ();
+
+T(Sd1, double)
+T(Sd2, double)
+T(Sd3, double)
+T(Sd4, double)
+T(Sd5, double)
+T(Sd6, double)
+T(Sd7, double)
+T(Sd8, double)
+T(Sd9, double)
+T(Sd10, double)
+T(Sd11, double)
+T(Sd12, double)
+T(Sd13, double)
+T(Sd14, double)
+T(Sd15, double)
+T(Sd16, double)
+
+#undef T
+}
diff --git a/gcc/testsuite/gcc.dg/compat/struct-by-value-6_y.c b/gcc/testsuite/gcc.dg/compat/struct-by-value-6_y.c
new file mode 100644
index 00000000000..49cc5d2211d
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/compat/struct-by-value-6_y.c
@@ -0,0 +1,43 @@
+#include <stdarg.h>
+
+#ifdef DBG
+#include <stdio.h>
+#define DEBUG_FPUTS(x) fputs (x, stdout)
+#define DEBUG_DOT putc ('.', stdout)
+#define DEBUG_NL putc ('\n', stdout)
+#else
+#define DEBUG_FPUTS(x)
+#define DEBUG_DOT
+#define DEBUG_NL
+#endif
+
+/* Turn off checking for variable arguments with -DSKIPVA. */
+#ifdef SKIPVA
+const int test_va = 0;
+#else
+const int test_va = 1;
+#endif
+
+#include "fp-struct-defs.h"
+#include "fp-struct-init.h"
+#include "fp-struct-test-by-value-y.h"
+
+DEFS(d, double)
+INITS(d, double)
+
+TEST(Sd1, double)
+TEST(Sd2, double)
+TEST(Sd3, double)
+TEST(Sd4, double)
+TEST(Sd5, double)
+TEST(Sd6, double)
+TEST(Sd7, double)
+TEST(Sd8, double)
+TEST(Sd9, double)
+TEST(Sd10, double)
+TEST(Sd11, double)
+TEST(Sd12, double)
+TEST(Sd13, double)
+TEST(Sd14, double)
+TEST(Sd15, double)
+TEST(Sd16, double)
diff --git a/gcc/testsuite/gcc.dg/compat/struct-by-value-7_main.c b/gcc/testsuite/gcc.dg/compat/struct-by-value-7_main.c
new file mode 100644
index 00000000000..7f0264c0f4b
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/compat/struct-by-value-7_main.c
@@ -0,0 +1,13 @@
+/* Test structures passed by value, including to a function with a
+ variable-length argument lists. All struct members are long double
+ scalars. */
+
+extern void struct_by_value_7_x (void);
+extern void exit (int);
+
+int
+main ()
+{
+ struct_by_value_7_x ();
+ exit (0);
+}
diff --git a/gcc/testsuite/gcc.dg/compat/struct-by-value-7_x.c b/gcc/testsuite/gcc.dg/compat/struct-by-value-7_x.c
new file mode 100644
index 00000000000..7f9d09a9d65
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/compat/struct-by-value-7_x.c
@@ -0,0 +1,63 @@
+#ifdef DBG
+#include <stdio.h>
+#define DEBUG_FPUTS(x) fputs (x, stdout)
+#define DEBUG_DOT putc ('.', stdout)
+#define DEBUG_NL putc ('\n', stdout)
+#else
+#define DEBUG_FPUTS(x)
+#define DEBUG_DOT
+#define DEBUG_NL
+#endif
+
+#include "fp-struct-defs.h"
+#include "fp-struct-check.h"
+#include "fp-struct-test-by-value-x.h"
+
+extern void abort (void);
+
+DEFS(ld, long double)
+CHECKS(ld, long double)
+
+TEST(Sld1, long double)
+TEST(Sld2, long double)
+TEST(Sld3, long double)
+TEST(Sld4, long double)
+TEST(Sld5, long double)
+TEST(Sld6, long double)
+TEST(Sld7, long double)
+TEST(Sld8, long double)
+TEST(Sld9, long double)
+TEST(Sld10, long double)
+TEST(Sld11, long double)
+TEST(Sld12, long double)
+TEST(Sld13, long double)
+TEST(Sld14, long double)
+TEST(Sld15, long double)
+TEST(Sld16, long double)
+
+#undef T
+
+void
+struct_by_value_7_x ()
+{
+#define T(TYPE, MTYPE) testit##TYPE ();
+
+T(Sld1, long double)
+T(Sld2, long double)
+T(Sld3, long double)
+T(Sld4, long double)
+T(Sld5, long double)
+T(Sld6, long double)
+T(Sld7, long double)
+T(Sld8, long double)
+T(Sld9, long double)
+T(Sld10, long double)
+T(Sld11, long double)
+T(Sld12, long double)
+T(Sld13, long double)
+T(Sld14, long double)
+T(Sld15, long double)
+T(Sld16, long double)
+
+#undef T
+}
diff --git a/gcc/testsuite/gcc.dg/compat/struct-by-value-7_y.c b/gcc/testsuite/gcc.dg/compat/struct-by-value-7_y.c
new file mode 100644
index 00000000000..bccff5decd9
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/compat/struct-by-value-7_y.c
@@ -0,0 +1,43 @@
+#include <stdarg.h>
+
+#ifdef DBG
+#include <stdio.h>
+#define DEBUG_FPUTS(x) fputs (x, stdout)
+#define DEBUG_DOT putc ('.', stdout)
+#define DEBUG_NL putc ('\n', stdout)
+#else
+#define DEBUG_FPUTS(x)
+#define DEBUG_DOT
+#define DEBUG_NL
+#endif
+
+/* Turn off checking for variable arguments with -DSKIPVA. */
+#ifdef SKIPVA
+const int test_va = 0;
+#else
+const int test_va = 1;
+#endif
+
+#include "fp-struct-defs.h"
+#include "fp-struct-init.h"
+#include "fp-struct-test-by-value-y.h"
+
+DEFS(ld, long double)
+INITS(ld, long double)
+
+TEST(Sld1, long double)
+TEST(Sld2, long double)
+TEST(Sld3, long double)
+TEST(Sld4, long double)
+TEST(Sld5, long double)
+TEST(Sld6, long double)
+TEST(Sld7, long double)
+TEST(Sld8, long double)
+TEST(Sld9, long double)
+TEST(Sld10, long double)
+TEST(Sld11, long double)
+TEST(Sld12, long double)
+TEST(Sld13, long double)
+TEST(Sld14, long double)
+TEST(Sld15, long double)
+TEST(Sld16, long double)
diff --git a/gcc/testsuite/gcc.dg/compat/struct-by-value-8_main.c b/gcc/testsuite/gcc.dg/compat/struct-by-value-8_main.c
new file mode 100644
index 00000000000..6ede893d4fe
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/compat/struct-by-value-8_main.c
@@ -0,0 +1,13 @@
+/* Test structures passed by value, including to a function with a
+ variable-length argument list. Each struct contains an array
+ of small structs with two scalar members. */
+
+extern void struct_by_value_8_x (void);
+extern void exit (int);
+
+int
+main ()
+{
+ struct_by_value_8_x ();
+ exit (0);
+}
diff --git a/gcc/testsuite/gcc.dg/compat/struct-by-value-8_x.c b/gcc/testsuite/gcc.dg/compat/struct-by-value-8_x.c
new file mode 100644
index 00000000000..8695e895c3a
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/compat/struct-by-value-8_x.c
@@ -0,0 +1,210 @@
+#ifdef DBG
+#include <stdio.h>
+#define DEBUG_FPUTS(x) fputs (x, stdout)
+#define DEBUG_DOT putc ('.', stdout)
+#define DEBUG_NL putc ('\n', stdout)
+#else
+#define DEBUG_FPUTS(x)
+#define DEBUG_DOT
+#define DEBUG_NL
+#endif
+
+#define T(N, TYPE) \
+struct S##TYPE##N { TYPE i[N]; }; \
+ \
+struct S##TYPE##N g1s##TYPE##N, g2s##TYPE##N; \
+struct S##TYPE##N g3s##TYPE##N, g4s##TYPE##N; \
+struct S##TYPE##N g5s##TYPE##N, g6s##TYPE##N; \
+struct S##TYPE##N g7s##TYPE##N, g8s##TYPE##N; \
+struct S##TYPE##N g9s##TYPE##N, g10s##TYPE##N; \
+struct S##TYPE##N g11s##TYPE##N, g12s##TYPE##N; \
+struct S##TYPE##N g13s##TYPE##N, g14s##TYPE##N; \
+struct S##TYPE##N g15s##TYPE##N, g16s##TYPE##N; \
+ \
+extern void init##TYPE (TYPE *p, int i); \
+extern void checkg##TYPE##N (void); \
+extern void \
+test##TYPE##N (struct S##TYPE##N s1, struct S##TYPE##N s2, \
+ struct S##TYPE##N s3, struct S##TYPE##N s4, \
+ struct S##TYPE##N s5, struct S##TYPE##N s6, \
+ struct S##TYPE##N s7, struct S##TYPE##N s8, \
+ struct S##TYPE##N s9, struct S##TYPE##N s10, \
+ struct S##TYPE##N s11, struct S##TYPE##N s12, \
+ struct S##TYPE##N s13, struct S##TYPE##N s14, \
+ struct S##TYPE##N s15, struct S##TYPE##N s16); \
+extern void testva##TYPE##N (int n, ...); \
+ \
+ \
+void \
+init##TYPE##N (struct S##TYPE##N *p, int i) \
+{ \
+ int j; \
+ for (j = 0; j < N; j++) \
+ init##TYPE(&p->i[j], i+j); \
+} \
+ \
+void \
+check##TYPE##N (struct S##TYPE##N *p, int i) \
+{ \
+ int j; \
+ for (j = 0; j < N; j++) \
+ check##TYPE(p->i[j], i+j); \
+} \
+ \
+void \
+test2_##TYPE##N (struct S##TYPE##N s1, struct S##TYPE##N s2, \
+ struct S##TYPE##N s3, struct S##TYPE##N s4, \
+ struct S##TYPE##N s5, struct S##TYPE##N s6, \
+ struct S##TYPE##N s7, struct S##TYPE##N s8) \
+{ \
+ test##TYPE##N (s1, g2s##TYPE##N, s2, g4s##TYPE##N, \
+ s3, g6s##TYPE##N, s4, g8s##TYPE##N, \
+ s5, g10s##TYPE##N, s6, g12s##TYPE##N, \
+ s7, g14s##TYPE##N, s8, g16s##TYPE##N); \
+} \
+ \
+void \
+testit##TYPE##N (void) \
+{ \
+ DEBUG_FPUTS (#TYPE "[" #N "]"); \
+ init##TYPE##N ( &g1s##TYPE##N, 1*16); \
+ init##TYPE##N ( &g2s##TYPE##N, 2*16); \
+ init##TYPE##N ( &g3s##TYPE##N, 3*16); \
+ init##TYPE##N ( &g4s##TYPE##N, 4*16); \
+ init##TYPE##N ( &g5s##TYPE##N, 5*16); \
+ init##TYPE##N ( &g6s##TYPE##N, 6*16); \
+ init##TYPE##N ( &g7s##TYPE##N, 7*16); \
+ init##TYPE##N ( &g8s##TYPE##N, 8*16); \
+ init##TYPE##N ( &g9s##TYPE##N, 9*16); \
+ init##TYPE##N (&g10s##TYPE##N, 10*16); \
+ init##TYPE##N (&g11s##TYPE##N, 11*16); \
+ init##TYPE##N (&g12s##TYPE##N, 12*16); \
+ init##TYPE##N (&g13s##TYPE##N, 13*16); \
+ init##TYPE##N (&g14s##TYPE##N, 14*16); \
+ init##TYPE##N (&g15s##TYPE##N, 15*16); \
+ init##TYPE##N (&g16s##TYPE##N, 16*16); \
+ checkg##TYPE##N (); \
+ DEBUG_FPUTS (" test"); \
+ test##TYPE##N (g1s##TYPE##N, g2s##TYPE##N, \
+ g3s##TYPE##N, g4s##TYPE##N, \
+ g5s##TYPE##N, g6s##TYPE##N, \
+ g7s##TYPE##N, g8s##TYPE##N, \
+ g9s##TYPE##N, g10s##TYPE##N, \
+ g11s##TYPE##N, g12s##TYPE##N, \
+ g13s##TYPE##N, g14s##TYPE##N, \
+ g15s##TYPE##N, g16s##TYPE##N); \
+ DEBUG_FPUTS (" testva"); \
+ testva##TYPE##N (16, \
+ g1s##TYPE##N, g2s##TYPE##N, \
+ g3s##TYPE##N, g4s##TYPE##N, \
+ g5s##TYPE##N, g6s##TYPE##N, \
+ g7s##TYPE##N, g8s##TYPE##N, \
+ g9s##TYPE##N, g10s##TYPE##N, \
+ g11s##TYPE##N, g12s##TYPE##N, \
+ g13s##TYPE##N, g14s##TYPE##N, \
+ g15s##TYPE##N, g16s##TYPE##N); \
+ DEBUG_FPUTS (" test2"); \
+ test2_##TYPE##N (g1s##TYPE##N, g3s##TYPE##N, \
+ g5s##TYPE##N, g7s##TYPE##N, \
+ g9s##TYPE##N, g11s##TYPE##N, \
+ g13s##TYPE##N, g15s##TYPE##N); \
+ DEBUG_NL; \
+}
+
+typedef struct { char c; } Sc;
+typedef struct { short s; } Ss;
+typedef struct { int i; } Si;
+typedef struct { short s; char c; } Ssc;
+typedef struct { int i; short s; } Sis;
+typedef struct { char c; short s; int i; } Scsi;
+typedef struct { char c; int i; short s; } Scis;
+
+extern void abort (void);
+
+void checkSc (Sc x, int i) { if (x.c != i/16) { DEBUG_NL; abort (); } }
+void checkSs (Ss x, int i) { if (x.s != i) { DEBUG_NL; abort (); } }
+void checkSi (Si x, int i) { if (x.i != i) { DEBUG_NL; abort (); } }
+void checkSsc (Ssc x, int i)
+{ if (x.s != i || x.c != (i/16)+1) { DEBUG_NL; abort (); } }
+void checkSis (Sis x, int i)
+{ if (x.i != i || x.s != i+1) { DEBUG_NL; abort (); } }
+void checkScsi (Scsi x, int i)
+{ if (x.c != i/16 || x.s != i+1 || x.i != i+2) { DEBUG_NL; abort (); } }
+void checkScis (Scis x, int i)
+{ if (x.c != i/16 || x.i != i+1 || x.s != i+2) { DEBUG_NL; abort (); } }
+
+T(0, Ssc)
+T(1, Ssc)
+T(2, Ssc)
+T(3, Ssc)
+T(4, Ssc)
+T(5, Ssc)
+T(6, Ssc)
+T(7, Ssc)
+T(8, Ssc)
+T(9, Ssc)
+T(10, Ssc)
+T(11, Ssc)
+T(12, Ssc)
+T(13, Ssc)
+T(14, Ssc)
+T(15, Ssc)
+T(0, Sis)
+T(1, Sis)
+T(2, Sis)
+T(3, Sis)
+T(4, Sis)
+T(5, Sis)
+T(6, Sis)
+T(7, Sis)
+T(8, Sis)
+T(9, Sis)
+T(10, Sis)
+T(11, Sis)
+T(12, Sis)
+T(13, Sis)
+T(14, Sis)
+T(15, Sis)
+
+#undef T
+
+void
+struct_by_value_8_x ()
+{
+#define T(N, TYPE) testit##TYPE##N ();
+
+T(0, Ssc)
+T(1, Ssc)
+T(2, Ssc)
+T(3, Ssc)
+T(4, Ssc)
+T(5, Ssc)
+T(6, Ssc)
+T(7, Ssc)
+T(8, Ssc)
+T(9, Ssc)
+T(10, Ssc)
+T(11, Ssc)
+T(12, Ssc)
+T(13, Ssc)
+T(14, Ssc)
+T(15, Ssc)
+T(0, Sis)
+T(1, Sis)
+T(2, Sis)
+T(3, Sis)
+T(4, Sis)
+T(5, Sis)
+T(6, Sis)
+T(7, Sis)
+T(8, Sis)
+T(9, Sis)
+T(10, Sis)
+T(11, Sis)
+T(12, Sis)
+T(13, Sis)
+T(14, Sis)
+T(15, Sis)
+
+#undef T
+}
diff --git a/gcc/testsuite/gcc.dg/compat/struct-by-value-8_y.c b/gcc/testsuite/gcc.dg/compat/struct-by-value-8_y.c
new file mode 100644
index 00000000000..e776fc3e398
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/compat/struct-by-value-8_y.c
@@ -0,0 +1,167 @@
+#include <stdarg.h>
+
+#ifdef DBG
+#include <stdio.h>
+#define DEBUG_FPUTS(x) fputs (x, stdout)
+#define DEBUG_DOT putc ('.', stdout)
+#define DEBUG_NL putc ('\n', stdout)
+#else
+#define DEBUG_FPUTS(x)
+#define DEBUG_DOT
+#define DEBUG_NL
+#endif
+
+/* Turn off checking for variable arguments with -DSKIPVA. */
+#ifdef SKIPVA
+const int test_va = 0;
+#else
+const int test_va = 1;
+#endif
+
+typedef struct { char c; } Sc;
+typedef struct { short s; } Ss;
+typedef struct { int i; } Si;
+typedef struct { short s; char c; } Ssc;
+typedef struct { int i; short s; } Sis;
+typedef struct { char c; short s; int i; } Scsi;
+typedef struct { char c; int i; short s; } Scis;
+
+void initSc (Sc *p, int i) { p->c = i/16; }
+void initSs (Ss *p, int i) { p->s = i; }
+void initSi (Si *p, int i) { p->i = i; }
+void initSsc (Ssc *p, int i) { p->s = i; p->c = (i/16)+1; }
+void initSis (Sis *p, int i) { p->i = i; p->s = i+1; }
+void initScsi (Scsi *p, int i) { p->c = i/16; p->s = i+1; p->i = i+2; }
+void initScis (Scis *p, int i) { p->c = i/16; p->i = i+1; p->s = i+2; }
+
+#define T(N, TYPE) \
+struct S##TYPE##N { TYPE i[N]; }; \
+ \
+extern struct S##TYPE##N g1s##TYPE##N, g2s##TYPE##N; \
+extern struct S##TYPE##N g3s##TYPE##N, g4s##TYPE##N; \
+extern struct S##TYPE##N g5s##TYPE##N, g6s##TYPE##N; \
+extern struct S##TYPE##N g7s##TYPE##N, g8s##TYPE##N; \
+extern struct S##TYPE##N g9s##TYPE##N, g10s##TYPE##N; \
+extern struct S##TYPE##N g11s##TYPE##N, g12s##TYPE##N; \
+extern struct S##TYPE##N g13s##TYPE##N, g14s##TYPE##N; \
+extern struct S##TYPE##N g15s##TYPE##N, g16s##TYPE##N; \
+ \
+extern void check##TYPE (TYPE x, int i); \
+extern void \
+check##TYPE##N (struct S##TYPE##N *p, int i); \
+ \
+void \
+checkg##TYPE##N (void) \
+{ \
+ check##TYPE##N ( &g1s##TYPE##N, 1*16); \
+ check##TYPE##N ( &g2s##TYPE##N, 2*16); \
+ check##TYPE##N ( &g3s##TYPE##N, 3*16); \
+ check##TYPE##N ( &g4s##TYPE##N, 4*16); \
+ check##TYPE##N ( &g5s##TYPE##N, 5*16); \
+ check##TYPE##N ( &g6s##TYPE##N, 6*16); \
+ check##TYPE##N ( &g7s##TYPE##N, 7*16); \
+ check##TYPE##N ( &g8s##TYPE##N, 8*16); \
+ check##TYPE##N ( &g9s##TYPE##N, 9*16); \
+ check##TYPE##N (&g10s##TYPE##N, 10*16); \
+ check##TYPE##N (&g11s##TYPE##N, 11*16); \
+ check##TYPE##N (&g12s##TYPE##N, 12*16); \
+ check##TYPE##N (&g13s##TYPE##N, 13*16); \
+ check##TYPE##N (&g14s##TYPE##N, 14*16); \
+ check##TYPE##N (&g15s##TYPE##N, 15*16); \
+ check##TYPE##N (&g16s##TYPE##N, 16*16); \
+} \
+ \
+void \
+test##TYPE##N (struct S##TYPE##N s1, struct S##TYPE##N s2, \
+ struct S##TYPE##N s3, struct S##TYPE##N s4, \
+ struct S##TYPE##N s5, struct S##TYPE##N s6, \
+ struct S##TYPE##N s7, struct S##TYPE##N s8, \
+ struct S##TYPE##N s9, struct S##TYPE##N s10, \
+ struct S##TYPE##N s11, struct S##TYPE##N s12, \
+ struct S##TYPE##N s13, struct S##TYPE##N s14, \
+ struct S##TYPE##N s15, struct S##TYPE##N s16) \
+{ \
+ DEBUG_DOT; \
+ check##TYPE##N (&s1, 1*16); \
+ DEBUG_DOT; \
+ check##TYPE##N (&s2, 2*16); \
+ DEBUG_DOT; \
+ check##TYPE##N (&s3, 3*16); \
+ DEBUG_DOT; \
+ check##TYPE##N (&s4, 4*16); \
+ DEBUG_DOT; \
+ check##TYPE##N (&s5, 5*16); \
+ DEBUG_DOT; \
+ check##TYPE##N (&s6, 6*16); \
+ DEBUG_DOT; \
+ check##TYPE##N (&s7, 7*16); \
+ DEBUG_DOT; \
+ check##TYPE##N (&s8, 8*16); \
+ DEBUG_DOT; \
+ check##TYPE##N (&s9, 9*16); \
+ DEBUG_DOT; \
+ check##TYPE##N (&s10, 10*16); \
+ DEBUG_DOT; \
+ check##TYPE##N (&s11, 11*16); \
+ DEBUG_DOT; \
+ check##TYPE##N (&s12, 12*16); \
+ DEBUG_DOT; \
+ check##TYPE##N (&s13, 13*16); \
+ DEBUG_DOT; \
+ check##TYPE##N (&s14, 14*16); \
+ DEBUG_DOT; \
+ check##TYPE##N (&s15, 15*16); \
+ DEBUG_DOT; \
+ check##TYPE##N (&s16, 16*16); \
+} \
+ \
+void \
+testva##TYPE##N (int n, ...) \
+{ \
+ int i; \
+ va_list ap; \
+ if (test_va) \
+ { \
+ va_start (ap, n); \
+ for (i = 0; i < n; i++) \
+ { \
+ struct S##TYPE##N t = va_arg (ap, struct S##TYPE##N); \
+ DEBUG_DOT; \
+ check##TYPE##N (&t, (i+1)*16); \
+ } \
+ va_end (ap); \
+ } \
+}
+
+T(0, Ssc)
+T(1, Ssc)
+T(2, Ssc)
+T(3, Ssc)
+T(4, Ssc)
+T(5, Ssc)
+T(6, Ssc)
+T(7, Ssc)
+T(8, Ssc)
+T(9, Ssc)
+T(10, Ssc)
+T(11, Ssc)
+T(12, Ssc)
+T(13, Ssc)
+T(14, Ssc)
+T(15, Ssc)
+T(0, Sis)
+T(1, Sis)
+T(2, Sis)
+T(3, Sis)
+T(4, Sis)
+T(5, Sis)
+T(6, Sis)
+T(7, Sis)
+T(8, Sis)
+T(9, Sis)
+T(10, Sis)
+T(11, Sis)
+T(12, Sis)
+T(13, Sis)
+T(14, Sis)
+T(15, Sis)
diff --git a/gcc/testsuite/gcc.dg/compat/struct-by-value-9_main.c b/gcc/testsuite/gcc.dg/compat/struct-by-value-9_main.c
new file mode 100644
index 00000000000..676ab027656
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/compat/struct-by-value-9_main.c
@@ -0,0 +1,13 @@
+/* Test structures passed by value, including to a function with a
+ variable-length argument list. Each struct contains an array
+ of small structs, each with three scalar members. */
+
+extern void struct_by_value_9_x (void);
+extern void exit (int);
+
+int
+main ()
+{
+ struct_by_value_9_x ();
+ exit (0);
+}
diff --git a/gcc/testsuite/gcc.dg/compat/struct-by-value-9_x.c b/gcc/testsuite/gcc.dg/compat/struct-by-value-9_x.c
new file mode 100644
index 00000000000..ff8f057ecb6
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/compat/struct-by-value-9_x.c
@@ -0,0 +1,210 @@
+#ifdef DBG
+#include <stdio.h>
+#define DEBUG_FPUTS(x) fputs (x, stdout)
+#define DEBUG_DOT putc ('.', stdout)
+#define DEBUG_NL putc ('\n', stdout)
+#else
+#define DEBUG_FPUTS(x)
+#define DEBUG_DOT
+#define DEBUG_NL
+#endif
+
+#define T(N, TYPE) \
+struct S##TYPE##N { TYPE i[N]; }; \
+ \
+struct S##TYPE##N g1s##TYPE##N, g2s##TYPE##N; \
+struct S##TYPE##N g3s##TYPE##N, g4s##TYPE##N; \
+struct S##TYPE##N g5s##TYPE##N, g6s##TYPE##N; \
+struct S##TYPE##N g7s##TYPE##N, g8s##TYPE##N; \
+struct S##TYPE##N g9s##TYPE##N, g10s##TYPE##N; \
+struct S##TYPE##N g11s##TYPE##N, g12s##TYPE##N; \
+struct S##TYPE##N g13s##TYPE##N, g14s##TYPE##N; \
+struct S##TYPE##N g15s##TYPE##N, g16s##TYPE##N; \
+ \
+extern void init##TYPE (TYPE *p, int i); \
+extern void checkg##TYPE##N (void); \
+extern void \
+test##TYPE##N (struct S##TYPE##N s1, struct S##TYPE##N s2, \
+ struct S##TYPE##N s3, struct S##TYPE##N s4, \
+ struct S##TYPE##N s5, struct S##TYPE##N s6, \
+ struct S##TYPE##N s7, struct S##TYPE##N s8, \
+ struct S##TYPE##N s9, struct S##TYPE##N s10, \
+ struct S##TYPE##N s11, struct S##TYPE##N s12, \
+ struct S##TYPE##N s13, struct S##TYPE##N s14, \
+ struct S##TYPE##N s15, struct S##TYPE##N s16); \
+extern void testva##TYPE##N (int n, ...); \
+ \
+ \
+void \
+init##TYPE##N (struct S##TYPE##N *p, int i) \
+{ \
+ int j; \
+ for (j = 0; j < N; j++) \
+ init##TYPE(&p->i[j], i+j); \
+} \
+ \
+void \
+check##TYPE##N (struct S##TYPE##N *p, int i) \
+{ \
+ int j; \
+ for (j = 0; j < N; j++) \
+ check##TYPE(p->i[j], i+j); \
+} \
+ \
+void \
+test2_##TYPE##N (struct S##TYPE##N s1, struct S##TYPE##N s2, \
+ struct S##TYPE##N s3, struct S##TYPE##N s4, \
+ struct S##TYPE##N s5, struct S##TYPE##N s6, \
+ struct S##TYPE##N s7, struct S##TYPE##N s8) \
+{ \
+ test##TYPE##N (s1, g2s##TYPE##N, s2, g4s##TYPE##N, \
+ s3, g6s##TYPE##N, s4, g8s##TYPE##N, \
+ s5, g10s##TYPE##N, s6, g12s##TYPE##N, \
+ s7, g14s##TYPE##N, s8, g16s##TYPE##N); \
+} \
+ \
+void \
+testit##TYPE##N (void) \
+{ \
+ DEBUG_FPUTS (#TYPE "[" #N "]"); \
+ init##TYPE##N ( &g1s##TYPE##N, 1*16); \
+ init##TYPE##N ( &g2s##TYPE##N, 2*16); \
+ init##TYPE##N ( &g3s##TYPE##N, 3*16); \
+ init##TYPE##N ( &g4s##TYPE##N, 4*16); \
+ init##TYPE##N ( &g5s##TYPE##N, 5*16); \
+ init##TYPE##N ( &g6s##TYPE##N, 6*16); \
+ init##TYPE##N ( &g7s##TYPE##N, 7*16); \
+ init##TYPE##N ( &g8s##TYPE##N, 8*16); \
+ init##TYPE##N ( &g9s##TYPE##N, 9*16); \
+ init##TYPE##N (&g10s##TYPE##N, 10*16); \
+ init##TYPE##N (&g11s##TYPE##N, 11*16); \
+ init##TYPE##N (&g12s##TYPE##N, 12*16); \
+ init##TYPE##N (&g13s##TYPE##N, 13*16); \
+ init##TYPE##N (&g14s##TYPE##N, 14*16); \
+ init##TYPE##N (&g15s##TYPE##N, 15*16); \
+ init##TYPE##N (&g16s##TYPE##N, 16*16); \
+ checkg##TYPE##N (); \
+ DEBUG_FPUTS (" test"); \
+ test##TYPE##N (g1s##TYPE##N, g2s##TYPE##N, \
+ g3s##TYPE##N, g4s##TYPE##N, \
+ g5s##TYPE##N, g6s##TYPE##N, \
+ g7s##TYPE##N, g8s##TYPE##N, \
+ g9s##TYPE##N, g10s##TYPE##N, \
+ g11s##TYPE##N, g12s##TYPE##N, \
+ g13s##TYPE##N, g14s##TYPE##N, \
+ g15s##TYPE##N, g16s##TYPE##N); \
+ DEBUG_FPUTS (" testva"); \
+ testva##TYPE##N (16, \
+ g1s##TYPE##N, g2s##TYPE##N, \
+ g3s##TYPE##N, g4s##TYPE##N, \
+ g5s##TYPE##N, g6s##TYPE##N, \
+ g7s##TYPE##N, g8s##TYPE##N, \
+ g9s##TYPE##N, g10s##TYPE##N, \
+ g11s##TYPE##N, g12s##TYPE##N, \
+ g13s##TYPE##N, g14s##TYPE##N, \
+ g15s##TYPE##N, g16s##TYPE##N); \
+ DEBUG_FPUTS (" test2"); \
+ test2_##TYPE##N (g1s##TYPE##N, g3s##TYPE##N, \
+ g5s##TYPE##N, g7s##TYPE##N, \
+ g9s##TYPE##N, g11s##TYPE##N, \
+ g13s##TYPE##N, g15s##TYPE##N); \
+ DEBUG_NL; \
+}
+
+typedef struct { char c; } Sc;
+typedef struct { short s; } Ss;
+typedef struct { int i; } Si;
+typedef struct { short s; char c; } Ssc;
+typedef struct { int i; short s; } Sis;
+typedef struct { char c; short s; int i; } Scsi;
+typedef struct { char c; int i; short s; } Scis;
+
+extern void abort (void);
+
+void checkSc (Sc x, int i) { if (x.c != i/16) { DEBUG_NL; abort (); } }
+void checkSs (Ss x, int i) { if (x.s != i) { DEBUG_NL; abort (); } }
+void checkSi (Si x, int i) { if (x.i != i) { DEBUG_NL; abort (); } }
+void checkSsc (Ssc x, int i)
+{ if (x.s != i || x.c != (i/16)+1) { DEBUG_NL; abort (); } }
+void checkSis (Sis x, int i)
+{ if (x.i != i || x.s != i+1) { DEBUG_NL; abort (); } }
+void checkScsi (Scsi x, int i)
+{ if (x.c != i/16 || x.s != i+1 || x.i != i+2) { DEBUG_NL; abort (); } }
+void checkScis (Scis x, int i)
+{ if (x.c != i/16 || x.i != i+1 || x.s != i+2) { DEBUG_NL; abort (); } }
+
+T(0, Scsi)
+T(1, Scsi)
+T(2, Scsi)
+T(3, Scsi)
+T(4, Scsi)
+T(5, Scsi)
+T(6, Scsi)
+T(7, Scsi)
+T(8, Scsi)
+T(9, Scsi)
+T(10, Scsi)
+T(11, Scsi)
+T(12, Scsi)
+T(13, Scsi)
+T(14, Scsi)
+T(15, Scsi)
+T(0, Scis)
+T(1, Scis)
+T(2, Scis)
+T(3, Scis)
+T(4, Scis)
+T(5, Scis)
+T(6, Scis)
+T(7, Scis)
+T(8, Scis)
+T(9, Scis)
+T(10, Scis)
+T(11, Scis)
+T(12, Scis)
+T(13, Scis)
+T(14, Scis)
+T(15, Scis)
+
+#undef T
+
+void
+struct_by_value_9_x ()
+{
+#define T(N, TYPE) testit##TYPE##N ();
+
+T(0, Scsi)
+T(1, Scsi)
+T(2, Scsi)
+T(3, Scsi)
+T(4, Scsi)
+T(5, Scsi)
+T(6, Scsi)
+T(7, Scsi)
+T(8, Scsi)
+T(9, Scsi)
+T(10, Scsi)
+T(11, Scsi)
+T(12, Scsi)
+T(13, Scsi)
+T(14, Scsi)
+T(15, Scsi)
+T(0, Scis)
+T(1, Scis)
+T(2, Scis)
+T(3, Scis)
+T(4, Scis)
+T(5, Scis)
+T(6, Scis)
+T(7, Scis)
+T(8, Scis)
+T(9, Scis)
+T(10, Scis)
+T(11, Scis)
+T(12, Scis)
+T(13, Scis)
+T(14, Scis)
+T(15, Scis)
+
+#undef T
+}
diff --git a/gcc/testsuite/gcc.dg/compat/struct-by-value-9_y.c b/gcc/testsuite/gcc.dg/compat/struct-by-value-9_y.c
new file mode 100644
index 00000000000..a98e5c95eb6
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/compat/struct-by-value-9_y.c
@@ -0,0 +1,167 @@
+#include <stdarg.h>
+
+#ifdef DBG
+#include <stdio.h>
+#define DEBUG_FPUTS(x) fputs (x, stdout)
+#define DEBUG_DOT putc ('.', stdout)
+#define DEBUG_NL putc ('\n', stdout)
+#else
+#define DEBUG_FPUTS(x)
+#define DEBUG_DOT
+#define DEBUG_NL
+#endif
+
+/* Turn off checking for variable arguments with -DSKIPVA. */
+#ifdef SKIPVA
+const int test_va = 0;
+#else
+const int test_va = 1;
+#endif
+
+typedef struct { char c; } Sc;
+typedef struct { short s; } Ss;
+typedef struct { int i; } Si;
+typedef struct { short s; char c; } Ssc;
+typedef struct { int i; short s; } Sis;
+typedef struct { char c; short s; int i; } Scsi;
+typedef struct { char c; int i; short s; } Scis;
+
+void initSc (Sc *p, int i) { p->c = i/16; }
+void initSs (Ss *p, int i) { p->s = i; }
+void initSi (Si *p, int i) { p->i = i; }
+void initSsc (Ssc *p, int i) { p->s = i; p->c = (i/16)+1; }
+void initSis (Sis *p, int i) { p->i = i; p->s = i+1; }
+void initScsi (Scsi *p, int i) { p->c = i/16; p->s = i+1; p->i = i+2; }
+void initScis (Scis *p, int i) { p->c = i/16; p->i = i+1; p->s = i+2; }
+
+#define T(N, TYPE) \
+struct S##TYPE##N { TYPE i[N]; }; \
+ \
+extern struct S##TYPE##N g1s##TYPE##N, g2s##TYPE##N; \
+extern struct S##TYPE##N g3s##TYPE##N, g4s##TYPE##N; \
+extern struct S##TYPE##N g5s##TYPE##N, g6s##TYPE##N; \
+extern struct S##TYPE##N g7s##TYPE##N, g8s##TYPE##N; \
+extern struct S##TYPE##N g9s##TYPE##N, g10s##TYPE##N; \
+extern struct S##TYPE##N g11s##TYPE##N, g12s##TYPE##N; \
+extern struct S##TYPE##N g13s##TYPE##N, g14s##TYPE##N; \
+extern struct S##TYPE##N g15s##TYPE##N, g16s##TYPE##N; \
+ \
+extern void check##TYPE (TYPE x, int i); \
+extern void \
+check##TYPE##N (struct S##TYPE##N *p, int i); \
+ \
+void \
+checkg##TYPE##N (void) \
+{ \
+ check##TYPE##N ( &g1s##TYPE##N, 1*16); \
+ check##TYPE##N ( &g2s##TYPE##N, 2*16); \
+ check##TYPE##N ( &g3s##TYPE##N, 3*16); \
+ check##TYPE##N ( &g4s##TYPE##N, 4*16); \
+ check##TYPE##N ( &g5s##TYPE##N, 5*16); \
+ check##TYPE##N ( &g6s##TYPE##N, 6*16); \
+ check##TYPE##N ( &g7s##TYPE##N, 7*16); \
+ check##TYPE##N ( &g8s##TYPE##N, 8*16); \
+ check##TYPE##N ( &g9s##TYPE##N, 9*16); \
+ check##TYPE##N (&g10s##TYPE##N, 10*16); \
+ check##TYPE##N (&g11s##TYPE##N, 11*16); \
+ check##TYPE##N (&g12s##TYPE##N, 12*16); \
+ check##TYPE##N (&g13s##TYPE##N, 13*16); \
+ check##TYPE##N (&g14s##TYPE##N, 14*16); \
+ check##TYPE##N (&g15s##TYPE##N, 15*16); \
+ check##TYPE##N (&g16s##TYPE##N, 16*16); \
+} \
+ \
+void \
+test##TYPE##N (struct S##TYPE##N s1, struct S##TYPE##N s2, \
+ struct S##TYPE##N s3, struct S##TYPE##N s4, \
+ struct S##TYPE##N s5, struct S##TYPE##N s6, \
+ struct S##TYPE##N s7, struct S##TYPE##N s8, \
+ struct S##TYPE##N s9, struct S##TYPE##N s10, \
+ struct S##TYPE##N s11, struct S##TYPE##N s12, \
+ struct S##TYPE##N s13, struct S##TYPE##N s14, \
+ struct S##TYPE##N s15, struct S##TYPE##N s16) \
+{ \
+ DEBUG_DOT; \
+ check##TYPE##N (&s1, 1*16); \
+ DEBUG_DOT; \
+ check##TYPE##N (&s2, 2*16); \
+ DEBUG_DOT; \
+ check##TYPE##N (&s3, 3*16); \
+ DEBUG_DOT; \
+ check##TYPE##N (&s4, 4*16); \
+ DEBUG_DOT; \
+ check##TYPE##N (&s5, 5*16); \
+ DEBUG_DOT; \
+ check##TYPE##N (&s6, 6*16); \
+ DEBUG_DOT; \
+ check##TYPE##N (&s7, 7*16); \
+ DEBUG_DOT; \
+ check##TYPE##N (&s8, 8*16); \
+ DEBUG_DOT; \
+ check##TYPE##N (&s9, 9*16); \
+ DEBUG_DOT; \
+ check##TYPE##N (&s10, 10*16); \
+ DEBUG_DOT; \
+ check##TYPE##N (&s11, 11*16); \
+ DEBUG_DOT; \
+ check##TYPE##N (&s12, 12*16); \
+ DEBUG_DOT; \
+ check##TYPE##N (&s13, 13*16); \
+ DEBUG_DOT; \
+ check##TYPE##N (&s14, 14*16); \
+ DEBUG_DOT; \
+ check##TYPE##N (&s15, 15*16); \
+ DEBUG_DOT; \
+ check##TYPE##N (&s16, 16*16); \
+} \
+ \
+void \
+testva##TYPE##N (int n, ...) \
+{ \
+ int i; \
+ va_list ap; \
+ if (test_va) \
+ { \
+ va_start (ap, n); \
+ for (i = 0; i < n; i++) \
+ { \
+ struct S##TYPE##N t = va_arg (ap, struct S##TYPE##N); \
+ DEBUG_DOT; \
+ check##TYPE##N (&t, (i+1)*16); \
+ } \
+ va_end (ap); \
+ } \
+}
+
+T(0, Scsi)
+T(1, Scsi)
+T(2, Scsi)
+T(3, Scsi)
+T(4, Scsi)
+T(5, Scsi)
+T(6, Scsi)
+T(7, Scsi)
+T(8, Scsi)
+T(9, Scsi)
+T(10, Scsi)
+T(11, Scsi)
+T(12, Scsi)
+T(13, Scsi)
+T(14, Scsi)
+T(15, Scsi)
+T(0, Scis)
+T(1, Scis)
+T(2, Scis)
+T(3, Scis)
+T(4, Scis)
+T(5, Scis)
+T(6, Scis)
+T(7, Scis)
+T(8, Scis)
+T(9, Scis)
+T(10, Scis)
+T(11, Scis)
+T(12, Scis)
+T(13, Scis)
+T(14, Scis)
+T(15, Scis)
diff --git a/gcc/testsuite/gcc.dg/compat/struct-return-2_main.c b/gcc/testsuite/gcc.dg/compat/struct-return-2_main.c
new file mode 100644
index 00000000000..6089c02555a
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/compat/struct-return-2_main.c
@@ -0,0 +1,12 @@
+/* Test function return values. This test includes structs that are
+ arrays of unsigned integral scalars. */
+
+extern void struct_return_2_x (void);
+extern void exit (int);
+
+int
+main ()
+{
+ struct_return_2_x ();
+ exit (0);
+}
diff --git a/gcc/testsuite/gcc.dg/compat/struct-return-2_x.c b/gcc/testsuite/gcc.dg/compat/struct-return-2_x.c
new file mode 100644
index 00000000000..aa2c34ad5c1
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/compat/struct-return-2_x.c
@@ -0,0 +1,205 @@
+#ifdef DBG
+#include <stdio.h>
+#define DEBUG_FPUTS(x) fputs (x, stdout)
+#define DEBUG_DOT putc ('.', stdout)
+#define DEBUG_NL putc ('\n', stdout)
+#else
+#define DEBUG_FPUTS(x)
+#define DEBUG_DOT
+#define DEBUG_NL
+#endif
+
+#define T(N, NAME, TYPE) \
+struct S##NAME##N { TYPE i[N]; }; \
+struct S##NAME##N g1s##NAME##N, g2s##NAME##N; \
+struct S##NAME##N g3s##NAME##N, g4s##NAME##N; \
+struct S##NAME##N g5s##NAME##N, g6s##NAME##N; \
+struct S##NAME##N g7s##NAME##N, g8s##NAME##N; \
+struct S##NAME##N g9s##NAME##N, g10s##NAME##N; \
+struct S##NAME##N g11s##NAME##N, g12s##NAME##N; \
+struct S##NAME##N g13s##NAME##N, g14s##NAME##N; \
+struct S##NAME##N g15s##NAME##N, g16s##NAME##N; \
+ \
+extern void init##NAME##N (struct S##NAME##N *p, int i); \
+extern void checkg##NAME##N (void); \
+extern struct S##NAME##N test0##NAME##N (void); \
+extern struct S##NAME##N test1##NAME##N (struct S##NAME##N); \
+extern struct S##NAME##N testva##NAME##N (int n, ...); \
+ \
+void \
+check##NAME##N (struct S##NAME##N *p, int i) \
+{ \
+ int j; \
+ for (j = 0; j < N; j++) \
+ if (p->i[j] != (TYPE) (i + j)) \
+ { \
+ DEBUG_NL; \
+ abort (); \
+ } \
+} \
+ \
+void \
+testit##NAME##N (void) \
+{ \
+ struct S##NAME##N rslt; \
+ DEBUG_FPUTS (#NAME "[" #N "]"); \
+ init##NAME##N ( &g1s##NAME##N, 1*16); \
+ init##NAME##N ( &g2s##NAME##N, 2*16); \
+ init##NAME##N ( &g3s##NAME##N, 3*16); \
+ init##NAME##N ( &g4s##NAME##N, 4*16); \
+ init##NAME##N ( &g5s##NAME##N, 5*16); \
+ init##NAME##N ( &g6s##NAME##N, 6*16); \
+ init##NAME##N ( &g7s##NAME##N, 7*16); \
+ init##NAME##N ( &g8s##NAME##N, 8*16); \
+ init##NAME##N ( &g9s##NAME##N, 9*16); \
+ init##NAME##N (&g10s##NAME##N, 10*16); \
+ init##NAME##N (&g11s##NAME##N, 11*16); \
+ init##NAME##N (&g12s##NAME##N, 12*16); \
+ init##NAME##N (&g13s##NAME##N, 13*16); \
+ init##NAME##N (&g14s##NAME##N, 14*16); \
+ init##NAME##N (&g15s##NAME##N, 15*16); \
+ init##NAME##N (&g16s##NAME##N, 16*16); \
+ checkg##NAME##N (); \
+ DEBUG_FPUTS (" test0"); \
+ rslt = test0##NAME##N (); \
+ check##NAME##N (&rslt, 1*16); \
+ DEBUG_FPUTS (" test1"); \
+ rslt = test1##NAME##N (g1s##NAME##N); \
+ check##NAME##N (&rslt, 1*16); \
+ DEBUG_FPUTS (" testva"); \
+ rslt = testva##NAME##N (1, g1s##NAME##N); \
+ check##NAME##N (&rslt, 1*16); \
+ rslt = testva##NAME##N (5, \
+ g1s##NAME##N, g2s##NAME##N, \
+ g3s##NAME##N, g4s##NAME##N, \
+ g5s##NAME##N); \
+ check##NAME##N (&rslt, 5*16); \
+ rslt = testva##NAME##N (9, \
+ g1s##NAME##N, g2s##NAME##N, \
+ g3s##NAME##N, g4s##NAME##N, \
+ g5s##NAME##N, g6s##NAME##N, \
+ g7s##NAME##N, g8s##NAME##N, \
+ g9s##NAME##N); \
+ check##NAME##N (&rslt, 9*16); \
+ rslt = testva##NAME##N (16, \
+ g1s##NAME##N, g2s##NAME##N, \
+ g3s##NAME##N, g4s##NAME##N, \
+ g5s##NAME##N, g6s##NAME##N, \
+ g7s##NAME##N, g8s##NAME##N, \
+ g9s##NAME##N, g10s##NAME##N, \
+ g11s##NAME##N, g12s##NAME##N, \
+ g13s##NAME##N, g14s##NAME##N, \
+ g15s##NAME##N, g16s##NAME##N); \
+ check##NAME##N (&rslt, 16*16); \
+ DEBUG_NL; \
+}
+
+extern void abort (void);
+
+T(0, uc, unsigned char)
+T(1, uc, unsigned char)
+T(2, uc, unsigned char)
+T(3, uc, unsigned char)
+T(4, uc, unsigned char)
+T(5, uc, unsigned char)
+T(6, uc, unsigned char)
+T(7, uc, unsigned char)
+T(8, uc, unsigned char)
+T(9, uc, unsigned char)
+T(10, uc, unsigned char)
+T(11, uc, unsigned char)
+T(12, uc, unsigned char)
+T(13, uc, unsigned char)
+T(14, uc, unsigned char)
+T(15, uc, unsigned char)
+T(0, us, unsigned short)
+T(1, us, unsigned short)
+T(2, us, unsigned short)
+T(3, us, unsigned short)
+T(4, us, unsigned short)
+T(5, us, unsigned short)
+T(6, us, unsigned short)
+T(7, us, unsigned short)
+T(8, us, unsigned short)
+T(9, us, unsigned short)
+T(10, us, unsigned short)
+T(11, us, unsigned short)
+T(12, us, unsigned short)
+T(13, us, unsigned short)
+T(14, us, unsigned short)
+T(15, us, unsigned short)
+T(0, ui, unsigned int)
+T(1, ui, unsigned int)
+T(2, ui, unsigned int)
+T(3, ui, unsigned int)
+T(4, ui, unsigned int)
+T(5, ui, unsigned int)
+T(6, ui, unsigned int)
+T(7, ui, unsigned int)
+T(8, ui, unsigned int)
+T(9, ui, unsigned int)
+T(10, ui, unsigned int)
+T(11, ui, unsigned int)
+T(12, ui, unsigned int)
+T(13, ui, unsigned int)
+T(14, ui, unsigned int)
+T(15, ui, unsigned int)
+
+#undef T
+
+void
+struct_return_2_x ()
+{
+#define T(N, NAME, TYPE) testit##NAME##N ();
+
+T(0, uc, unsigned char)
+T(1, uc, unsigned char)
+T(2, uc, unsigned char)
+T(3, uc, unsigned char)
+T(4, uc, unsigned char)
+T(5, uc, unsigned char)
+T(6, uc, unsigned char)
+T(7, uc, unsigned char)
+T(8, uc, unsigned char)
+T(9, uc, unsigned char)
+T(10, uc, unsigned char)
+T(11, uc, unsigned char)
+T(12, uc, unsigned char)
+T(13, uc, unsigned char)
+T(14, uc, unsigned char)
+T(15, uc, unsigned char)
+T(0, us, unsigned short)
+T(1, us, unsigned short)
+T(2, us, unsigned short)
+T(3, us, unsigned short)
+T(4, us, unsigned short)
+T(5, us, unsigned short)
+T(6, us, unsigned short)
+T(7, us, unsigned short)
+T(8, us, unsigned short)
+T(9, us, unsigned short)
+T(10, us, unsigned short)
+T(11, us, unsigned short)
+T(12, us, unsigned short)
+T(13, us, unsigned short)
+T(14, us, unsigned short)
+T(15, us, unsigned short)
+T(0, ui, unsigned int)
+T(1, ui, unsigned int)
+T(2, ui, unsigned int)
+T(3, ui, unsigned int)
+T(4, ui, unsigned int)
+T(5, ui, unsigned int)
+T(6, ui, unsigned int)
+T(7, ui, unsigned int)
+T(8, ui, unsigned int)
+T(9, ui, unsigned int)
+T(10, ui, unsigned int)
+T(11, ui, unsigned int)
+T(12, ui, unsigned int)
+T(13, ui, unsigned int)
+T(14, ui, unsigned int)
+T(15, ui, unsigned int)
+
+#undef T
+}
diff --git a/gcc/testsuite/gcc.dg/compat/struct-return-2_y.c b/gcc/testsuite/gcc.dg/compat/struct-return-2_y.c
new file mode 100644
index 00000000000..50f3cc716ba
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/compat/struct-return-2_y.c
@@ -0,0 +1,142 @@
+#include <stdarg.h>
+
+#ifdef DBG
+#include <stdio.h>
+#define DEBUG_FPUTS(x) fputs (x, stdout)
+#define DEBUG_DOT putc ('.', stdout)
+#define DEBUG_NL putc ('\n', stdout)
+#else
+#define DEBUG_FPUTS(x)
+#define DEBUG_DOT
+#define DEBUG_NL
+#endif
+
+/* Turn off checking for variable arguments with -DSKIPVA. */
+#ifdef SKIPVA
+const int test_va = 0;
+#else
+const int test_va = 1;
+#endif
+
+#define T(N, NAME, TYPE) \
+struct S##NAME##N { TYPE i[N]; }; \
+ \
+extern struct S##NAME##N g1s##NAME##N, g2s##NAME##N; \
+extern struct S##NAME##N g3s##NAME##N, g4s##NAME##N; \
+extern struct S##NAME##N g5s##NAME##N, g6s##NAME##N; \
+extern struct S##NAME##N g7s##NAME##N, g8s##NAME##N; \
+extern struct S##NAME##N g9s##NAME##N, g10s##NAME##N; \
+extern struct S##NAME##N g11s##NAME##N, g12s##NAME##N; \
+extern struct S##NAME##N g13s##NAME##N, g14s##NAME##N; \
+extern struct S##NAME##N g15s##NAME##N, g16s##NAME##N; \
+ \
+extern void check##NAME##N (struct S##NAME##N *p, int i); \
+ \
+void \
+init##NAME##N (struct S##NAME##N *p, int i) \
+{ \
+ int j; \
+ for (j = 0; j < N; j++) \
+ p->i[j] = i + j; \
+} \
+ \
+void \
+checkg##NAME##N (void) \
+{ \
+ check##NAME##N ( &g1s##NAME##N, 1*16); \
+ check##NAME##N ( &g2s##NAME##N, 2*16); \
+ check##NAME##N ( &g3s##NAME##N, 3*16); \
+ check##NAME##N ( &g4s##NAME##N, 4*16); \
+ check##NAME##N ( &g5s##NAME##N, 5*16); \
+ check##NAME##N ( &g6s##NAME##N, 6*16); \
+ check##NAME##N ( &g7s##NAME##N, 7*16); \
+ check##NAME##N ( &g8s##NAME##N, 8*16); \
+ check##NAME##N ( &g9s##NAME##N, 9*16); \
+ check##NAME##N (&g10s##NAME##N, 10*16); \
+ check##NAME##N (&g11s##NAME##N, 11*16); \
+ check##NAME##N (&g12s##NAME##N, 12*16); \
+ check##NAME##N (&g13s##NAME##N, 13*16); \
+ check##NAME##N (&g14s##NAME##N, 14*16); \
+ check##NAME##N (&g15s##NAME##N, 15*16); \
+ check##NAME##N (&g16s##NAME##N, 16*16); \
+} \
+ \
+struct S##NAME##N \
+test0##NAME##N (void) \
+{ \
+ return g1s##NAME##N; \
+} \
+ \
+struct S##NAME##N \
+test1##NAME##N (struct S##NAME##N x01) \
+{ \
+ return x01; \
+} \
+ \
+struct S##NAME##N \
+testva##NAME##N (int n, ...) \
+{ \
+ int i; \
+ struct S##NAME##N rslt; \
+ va_list ap; \
+ if (test_va) \
+ { \
+ va_start (ap, n); \
+ for (i = 0; i < n; i++) \
+ { \
+ rslt = va_arg (ap, struct S##NAME##N); \
+ DEBUG_DOT; \
+ } \
+ va_end (ap); \
+ } \
+ return rslt; \
+}
+
+T(0, uc, unsigned char)
+T(1, uc, unsigned char)
+T(2, uc, unsigned char)
+T(3, uc, unsigned char)
+T(4, uc, unsigned char)
+T(5, uc, unsigned char)
+T(6, uc, unsigned char)
+T(7, uc, unsigned char)
+T(8, uc, unsigned char)
+T(9, uc, unsigned char)
+T(10, uc, unsigned char)
+T(11, uc, unsigned char)
+T(12, uc, unsigned char)
+T(13, uc, unsigned char)
+T(14, uc, unsigned char)
+T(15, uc, unsigned char)
+T(0, us, unsigned short)
+T(1, us, unsigned short)
+T(2, us, unsigned short)
+T(3, us, unsigned short)
+T(4, us, unsigned short)
+T(5, us, unsigned short)
+T(6, us, unsigned short)
+T(7, us, unsigned short)
+T(8, us, unsigned short)
+T(9, us, unsigned short)
+T(10, us, unsigned short)
+T(11, us, unsigned short)
+T(12, us, unsigned short)
+T(13, us, unsigned short)
+T(14, us, unsigned short)
+T(15, us, unsigned short)
+T(0, ui, unsigned int)
+T(1, ui, unsigned int)
+T(2, ui, unsigned int)
+T(3, ui, unsigned int)
+T(4, ui, unsigned int)
+T(5, ui, unsigned int)
+T(6, ui, unsigned int)
+T(7, ui, unsigned int)
+T(8, ui, unsigned int)
+T(9, ui, unsigned int)
+T(10, ui, unsigned int)
+T(11, ui, unsigned int)
+T(12, ui, unsigned int)
+T(13, ui, unsigned int)
+T(14, ui, unsigned int)
+T(15, ui, unsigned int)
diff --git a/gcc/testsuite/gcc.dg/compat/struct-return-3_main.c b/gcc/testsuite/gcc.dg/compat/struct-return-3_main.c
new file mode 100644
index 00000000000..87be8a3db40
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/compat/struct-return-3_main.c
@@ -0,0 +1,13 @@
+/* Test function return values. For this test, all struct members are
+ scalar integral types and the structs are "small": 1, 2, 4, 8, and 12
+ bytes for LP64. */
+
+extern void struct_return_3_x (void);
+extern void exit (int);
+
+int
+main ()
+{
+ struct_return_3_x ();
+ exit (0);
+}
diff --git a/gcc/testsuite/gcc.dg/compat/struct-return-3_x.c b/gcc/testsuite/gcc.dg/compat/struct-return-3_x.c
new file mode 100644
index 00000000000..05d1e5059bd
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/compat/struct-return-3_x.c
@@ -0,0 +1,122 @@
+#ifdef DBG
+#include <stdio.h>
+#define DEBUG_FPUTS(x) fputs (x, stdout)
+#define DEBUG_DOT putc ('.', stdout)
+#define DEBUG_NL putc ('\n', stdout)
+#else
+#define DEBUG_FPUTS(x)
+#define DEBUG_DOT
+#define DEBUG_NL
+#endif
+
+#define T(TYPE) \
+TYPE g01##TYPE, g02##TYPE, g03##TYPE, g04##TYPE; \
+TYPE g05##TYPE, g06##TYPE, g07##TYPE, g08##TYPE; \
+TYPE g09##TYPE, g10##TYPE, g11##TYPE, g12##TYPE; \
+TYPE g13##TYPE, g14##TYPE, g15##TYPE, g16##TYPE; \
+ \
+extern void init##TYPE (TYPE *p, int i); \
+extern void checkg##TYPE (void); \
+extern TYPE test0##TYPE (void); \
+extern TYPE test1##TYPE (TYPE); \
+extern TYPE testva##TYPE (int n, ...); \
+ \
+void \
+testit##TYPE (void) \
+{ \
+ TYPE rslt; \
+ DEBUG_FPUTS (#TYPE); \
+ init##TYPE (&g01##TYPE, 1); \
+ init##TYPE (&g02##TYPE, 2); \
+ init##TYPE (&g03##TYPE, 3); \
+ init##TYPE (&g04##TYPE, 4); \
+ init##TYPE (&g05##TYPE, 5); \
+ init##TYPE (&g06##TYPE, 6); \
+ init##TYPE (&g07##TYPE, 7); \
+ init##TYPE (&g08##TYPE, 8); \
+ init##TYPE (&g09##TYPE, 9); \
+ init##TYPE (&g10##TYPE, 10); \
+ init##TYPE (&g11##TYPE, 11); \
+ init##TYPE (&g12##TYPE, 12); \
+ init##TYPE (&g13##TYPE, 13); \
+ init##TYPE (&g14##TYPE, 14); \
+ init##TYPE (&g15##TYPE, 15); \
+ init##TYPE (&g16##TYPE, 16); \
+ checkg##TYPE (); \
+ DEBUG_FPUTS (" test0"); \
+ rslt = test0##TYPE (); \
+ check##TYPE (rslt, 1); \
+ DEBUG_FPUTS (" test1"); \
+ rslt = test1##TYPE (g01##TYPE); \
+ check##TYPE (rslt, 1); \
+ DEBUG_FPUTS (" testva"); \
+ rslt = testva##TYPE (1, g01##TYPE); \
+ check##TYPE (rslt, 1); \
+ rslt = testva##TYPE (5, g01##TYPE, g02##TYPE, \
+ g03##TYPE, g04##TYPE, \
+ g05##TYPE); \
+ check##TYPE (rslt, 5); \
+ rslt = testva##TYPE (9, g01##TYPE, g02##TYPE, \
+ g03##TYPE, g04##TYPE, \
+ g05##TYPE, g06##TYPE, \
+ g07##TYPE, g08##TYPE, \
+ g09##TYPE); \
+ check##TYPE (rslt, 9); \
+ rslt = testva##TYPE (16, g01##TYPE, g02##TYPE, \
+ g03##TYPE, g04##TYPE, \
+ g05##TYPE, g06##TYPE, \
+ g07##TYPE, g08##TYPE, \
+ g09##TYPE, g10##TYPE, \
+ g11##TYPE, g12##TYPE, \
+ g13##TYPE, g14##TYPE, \
+ g15##TYPE, g16##TYPE); \
+ check##TYPE (rslt, 16); \
+ DEBUG_NL; \
+}
+
+extern void abort (void);
+
+#include "small-struct-defs.h"
+#include "small-struct-check.h"
+
+T(Sc)
+T(Ss)
+T(Si)
+T(Scs)
+T(Ssc)
+T(Sic)
+T(Sci)
+T(Ssi)
+T(Sis)
+T(Scsi)
+T(Scis)
+T(Ssci)
+T(Ssic)
+T(Sisc)
+T(Sics)
+
+#undef T
+
+void
+struct_return_3_x ()
+{
+#define T(TYPE) testit##TYPE ();
+
+T(Sc)
+T(Ss)
+T(Si)
+T(Scs)
+T(Ssc)
+T(Sic)
+T(Sci)
+T(Ssi)
+T(Sis)
+T(Scsi)
+T(Scis)
+T(Ssci)
+T(Ssic)
+T(Sisc)
+T(Sics)
+
+#undef T
+}
diff --git a/gcc/testsuite/gcc.dg/compat/struct-return-3_y.c b/gcc/testsuite/gcc.dg/compat/struct-return-3_y.c
new file mode 100644
index 00000000000..4dc20311ca0
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/compat/struct-return-3_y.c
@@ -0,0 +1,98 @@
+#include <stdarg.h>
+
+#ifdef DBG
+#include <stdio.h>
+#define DEBUG_FPUTS(x) fputs (x, stdout)
+#define DEBUG_DOT putc ('.', stdout)
+#define DEBUG_NL putc ('\n', stdout)
+#else
+#define DEBUG_FPUTS(x)
+#define DEBUG_DOT
+#define DEBUG_NL
+#endif
+
+/* Turn off checking for variable arguments with -DSKIPVA. */
+#ifdef SKIPVA
+const int test_va = 0;
+#else
+const int test_va = 1;
+#endif
+
+#include "small-struct-defs.h"
+#include "small-struct-init.h"
+
+#define T(TYPE) \
+extern TYPE g01##TYPE, g02##TYPE, g03##TYPE, g04##TYPE; \
+extern TYPE g05##TYPE, g06##TYPE, g07##TYPE, g08##TYPE; \
+extern TYPE g09##TYPE, g10##TYPE, g11##TYPE, g12##TYPE; \
+extern TYPE g13##TYPE, g14##TYPE, g15##TYPE, g16##TYPE; \
+ \
+extern void check##TYPE (TYPE x, int i); \
+ \
+void \
+checkg##TYPE (void) \
+{ \
+ check##TYPE (g01##TYPE, 1); \
+ check##TYPE (g02##TYPE, 2); \
+ check##TYPE (g03##TYPE, 3); \
+ check##TYPE (g04##TYPE, 4); \
+ check##TYPE (g05##TYPE, 5); \
+ check##TYPE (g06##TYPE, 6); \
+ check##TYPE (g07##TYPE, 7); \
+ check##TYPE (g08##TYPE, 8); \
+ check##TYPE (g09##TYPE, 9); \
+ check##TYPE (g10##TYPE, 10); \
+ check##TYPE (g11##TYPE, 11); \
+ check##TYPE (g12##TYPE, 12); \
+ check##TYPE (g13##TYPE, 13); \
+ check##TYPE (g14##TYPE, 14); \
+ check##TYPE (g15##TYPE, 15); \
+ check##TYPE (g16##TYPE, 16); \
+} \
+ \
+TYPE \
+test0##TYPE (void) \
+{ \
+ return g01##TYPE; \
+} \
+ \
+TYPE \
+test1##TYPE (TYPE x01) \
+{ \
+ return x01; \
+} \
+ \
+TYPE \
+testva##TYPE (int n, ...) \
+{ \
+ int i; \
+ TYPE rslt; \
+ va_list ap; \
+ if (test_va) \
+ { \
+ va_start (ap, n); \
+ for (i = 0; i < n; i++) \
+ { \
+ rslt = va_arg (ap, TYPE); \
+ DEBUG_DOT; \
+ } \
+ va_end (ap); \
+ } \
+ return rslt; \
+}
+
+T(Sc)
+T(Ss)
+T(Si)
+T(Scs)
+T(Ssc)
+T(Sic)
+T(Sci)
+T(Ssi)
+T(Sis)
+T(Scsi)
+T(Scis)
+T(Ssci)
+T(Ssic)
+T(Sisc)
+T(Sics)
diff --git a/gcc/testsuite/gcc.dg/cpp/cxxcom2.h b/gcc/testsuite/gcc.dg/cpp/cxxcom2.h
new file mode 100644
index 00000000000..546b8fd9217
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/cpp/cxxcom2.h
@@ -0,0 +1,4 @@
+/* A system header may contain C++ comments irrespective of mode. */
+#pragma GCC system_header
+// C++ comment is not in C89 { dg-bogus "style comment" "bad warning" }
+
diff --git a/gcc/testsuite/gcc.dg/cpp/redef3.c b/gcc/testsuite/gcc.dg/cpp/redef3.c
new file mode 100644
index 00000000000..78ee71e6598
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/cpp/redef3.c
@@ -0,0 +1,21 @@
+/* Test for redefining macros with mismatch token count (and the oddity). */
+
+/* { dg-do preprocess } */
+/* { dg-options "-DC -DD=1 -DE" } */
+
+#define A
+#define A 1
+#define B 2 3
+#define B 2
+#define C 1
+#define D 1 2
+#define E
+
+/* { dg-warning "redefined" "redef A" { target *-*-* } 7 }
+ { dg-warning "redefined" "redef B" { target *-*-* } 9 }
+ { dg-warning "redefined" "redef D" { target *-*-* } 11 }
+ { dg-warning "redefined" "redef E" { target *-*-* } 12 }
+ { dg-warning "previous" "prev def A" { target *-*-* } 6 }
+ { dg-warning "previous" "prev def B" { target *-*-* } 8 }
+ { dg-warning "previous" "prev def D/E" { target *-*-* } 0 }
+*/
diff --git a/gcc/testsuite/gcc.dg/dollar.c b/gcc/testsuite/gcc.dg/dollar.c
new file mode 100644
index 00000000000..43407f227ed
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/dollar.c
@@ -0,0 +1,9 @@
+/* Copyright (C) 2003 Free Software Foundation, Inc. */
+
+/* { dg-do compile } */
+/* { dg-options -fno-dollars-in-identifiers } */
+
+/* Test that -fno-dollars-in-identifiers is honoured.
+ Neil Booth, 17 May 2003. */
+
+int foobar$; /* { dg-error "stray '\\$'" } */
diff --git a/gcc/testsuite/gcc.dg/duff-4.c b/gcc/testsuite/gcc.dg/duff-4.c
new file mode 100644
index 00000000000..7032285af5e
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/duff-4.c
@@ -0,0 +1,60 @@
+/* Duff's device is legal C; test to make sure the compiler
+ doesn't complain about it.
+
+ Roger Sayle <roger@eyesopen.com>
+ Derived from duff-2.c. */
+
+/* { dg-do run } */
+/* { dg-options "-O2" } */
+
+extern void abort (void);
+extern void exit (int);
+
+#if __INT_MAX__ >= 2147483647
+/* At least 32-bit integers. */
+typedef int type32;
+#else
+typedef long type32;
+#endif
+
+type32
+cksum (const unsigned char *src, unsigned long size)
+{
+ type32 ck = 0;
+
+ switch (size & 3)
+ {
+ do
+ {
+ case 0:
+ ck ^= (type32)*src++ << 24;
+ --size;
+ case 3:
+ ck ^= (type32)*src++ << 16;
+ --size;
+ case 2:
+ ck ^= (type32)*src++ << 8;
+ --size;
+ case 1:
+ ck ^= (type32)*src++;
+ --size;
+ }
+ while (size > 0);
+ }
+
+ return ck;
+}
+
+const char testpat[] = "The quick brown fox jumped over the lazy dog.";
+
+int
+main()
+{
+ type32 ck;
+
+ ck = cksum ((const unsigned char *) testpat, sizeof (testpat));
+ if (ck != 925902908)
+ abort ();
+
+ exit (0);
+}
diff --git a/gcc/testsuite/gcc.dg/fwrapv-1.c b/gcc/testsuite/gcc.dg/fwrapv-1.c
new file mode 100644
index 00000000000..f7ddda4a3b6
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/fwrapv-1.c
@@ -0,0 +1,28 @@
+/* Copyright (C) 2003 Free Software Foundation.
+
+ Test that the -fwrapv command line option is accepted and disables
+ "unsafe" optimizations that rely on undefined arithmetic overflow.
+
+ Written by Roger Sayle, 24th March 2003. */
+
+/* { dg-do run } */
+/* { dg-options "-O2 -fwrapv" } */
+
+#include <limits.h>
+
+extern void abort ();
+
+int test(int x)
+{
+ return (2*x)/2;
+}
+
+main()
+{
+ int x = INT_MAX;
+
+ if (test(x) == x)
+ abort ();
+ return 0;
+}
+
diff --git a/gcc/testsuite/gcc.dg/fwrapv-2.c b/gcc/testsuite/gcc.dg/fwrapv-2.c
new file mode 100644
index 00000000000..cb4270e0ee2
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/fwrapv-2.c
@@ -0,0 +1,28 @@
+/* Copyright (C) 2003 Free Software Foundation.
+
+ Test that the -fno-wrapv command line option is accepted and enables
+ "unsafe" optimizations that rely on undefined arithmetic overflow.
+
+ Written by Roger Sayle, 31st May 2003. */
+
+/* { dg-do run } */
+/* { dg-options "-O2 -fno-wrapv" } */
+
+#include <limits.h>
+
+extern void abort ();
+
+int test(int x)
+{
+ return (2*x)/2;
+}
+
+main()
+{
+ int x = INT_MAX;
+
+ if (test(x) != x)
+ abort ();
+ return 0;
+}
+
diff --git a/gcc/testsuite/gcc.dg/i386-loop-3.c b/gcc/testsuite/gcc.dg/i386-loop-3.c
new file mode 100644
index 00000000000..c1b4bcea5be
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/i386-loop-3.c
@@ -0,0 +1,76 @@
+/* PR target/11044 */
+/* Originator: Tim McGrath <misty-@charter.net> */
+/* Testcase contributed by Eric Botcazou <ebotcazou@libertysurf.fr> */
+/* { dg-do run { target i?86-*-* } } */
+/* { dg-options "-mtune=k6 -O3 -ffast-math -funroll-loops" } */
+
+typedef struct
+{
+ unsigned char colormod;
+} entity_state_t;
+
+typedef struct
+{
+ int num_entities;
+ entity_state_t *entities;
+} packet_entities_t;
+
+typedef struct
+{
+ double senttime;
+ float ping_time;
+ packet_entities_t entities;
+} client_frame_t;
+
+typedef enum
+{
+ cs_free,
+ cs_server,
+ cs_zombie,
+ cs_connected,
+ cs_spawned
+} sv_client_state_t;
+
+typedef struct client_s
+{
+ sv_client_state_t state;
+ int ping;
+ client_frame_t frames[64];
+} client_t;
+
+int CalcPing (client_t *cl)
+{
+ float ping;
+ int count, i;
+ register client_frame_t *frame;
+
+ if (cl->state == cs_server)
+ return cl->ping;
+ ping = 0;
+ count = 0;
+ for (frame = cl->frames, i = 0; i < 64; i++, frame++) {
+ if (frame->ping_time > 0) {
+ ping += frame->ping_time;
+ count++;
+ }
+ }
+ if (!count)
+ return 9999;
+ ping /= count;
+
+ return ping * 1000;
+}
+
+int main(void)
+{
+ client_t cl;
+
+ memset(&cl, 0, sizeof(cl));
+
+ cl.frames[0].ping_time = 1.0f;
+
+ if (CalcPing(&cl) != 1000)
+ abort();
+
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/string-opt-1.c b/gcc/testsuite/gcc.dg/string-opt-1.c
new file mode 100644
index 00000000000..bc0f30098fa
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/string-opt-1.c
@@ -0,0 +1,11 @@
+/* Ensure mempcpy is not "optimized" into memcpy followed by addition. */
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+void *
+fn (char *x, char *y, int z)
+{
+ return __builtin_mempcpy (x, y, z);
+}
+
+/* { dg-final { scan-assembler-not "memcpy" } } */
diff --git a/gcc/testsuite/gcc.dg/tls/opt-1.c b/gcc/testsuite/gcc.dg/tls/opt-1.c
new file mode 100644
index 00000000000..8523c762a2e
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tls/opt-1.c
@@ -0,0 +1,28 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fPIC" } */
+/* { dg-options "-O2 -fPIC -mtune=i686" { target i?86-*-* } } */
+
+extern __thread int thr;
+
+static int x;
+
+static void
+bar (void)
+{
+ x = 1;
+}
+
+static void
+#ifdef __i386__
+__attribute__ ((regparm (3)))
+#endif
+foo (const char *x, void *y, int *z)
+{
+ bar ();
+}
+
+void
+test (const char *x, void *y)
+{
+ foo (x, y, &thr);
+}
diff --git a/gcc/testsuite/gcc.dg/tls/opt-6.c b/gcc/testsuite/gcc.dg/tls/opt-6.c
new file mode 100644
index 00000000000..de04c1cb3fc
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tls/opt-6.c
@@ -0,0 +1,70 @@
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+extern void abort (void);
+extern void exit (int);
+
+struct A
+{
+ char a;
+ int b;
+ long long c;
+};
+extern __thread struct A a1, a2, a3, a4;
+extern struct A *f1a (void);
+extern struct A *f2a (void);
+extern struct A *f3a (void);
+extern struct A *f4a (void);
+extern struct A *f5a (void);
+extern struct A *f6a (void);
+extern struct A *f7a (void);
+extern struct A *f8a (void);
+extern struct A *f9a (void);
+extern struct A *f10a (void);
+extern int f1b (void);
+extern int f2b (void);
+extern int f3b (void);
+extern int f4b (void);
+extern int f5b (void);
+extern int f6b (void);
+extern int f7b (void);
+extern int f8b (void);
+extern int f9b (void);
+extern int f10b (void);
+extern void check1 (void);
+extern void check2 (void);
+__thread int dummy = 12;
+__thread struct A local = { 1, 2, 3 };
+
+int
+main (void)
+{
+ struct A *p;
+
+ if (local.a != 1 || local.b != 2 || local.c != 3)
+ abort ();
+ if (a1.a != 4 || a1.b != 5 || a1.c != 6)
+ abort ();
+ if (a2.a != 22 || a2.b != 23 || a2.c != 24)
+ abort ();
+ if (a3.a != 10 || a3.b != 11 || a3.c != 12)
+ abort ();
+ if (a4.a != 25 || a4.b != 26 || a4.c != 27)
+ abort ();
+ check1 ();
+ check2 ();
+ if (f1a () != &a1 || f2a () != &a2 || f3a () != &a3 || f4a () != &a4)
+ abort ();
+ p = f5a (); if (p->a != 16 || p->b != 16 + 1 || p->c != 16 + 2)
+ abort ();
+ p = f6a (); if (p->a != 19 || p->b != 19 + 1 || p->c != 19 + 2)
+ abort ();
+ if (f7a () != &a2 || f8a () != &a4)
+ abort ();
+ p = f9a (); if (p->a != 28 || p->b != 28 + 1 || p->c != 28 + 2)
+ abort ();
+ p = f10a (); if (p->a != 31 || p->b != 31 + 1 || p->c != 31 + 2)
+ abort ();
+
+ exit (0);
+}
diff --git a/gcc/testsuite/gcc.dg/torture/builtin-noret-1.c b/gcc/testsuite/gcc.dg/torture/builtin-noret-1.c
new file mode 100644
index 00000000000..2328b87bd03
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/builtin-noret-1.c
@@ -0,0 +1,73 @@
+/* Test for builtin noreturn attributes. */
+/* Origin: Joseph Myers <jsm28@cam.ac.uk> */
+/* { dg-options "-multiply_defined suppress" { target powerpc-*-darwin* } } */
+/* { dg-do link } */
+
+extern void abort (void);
+extern void exit (int);
+extern void _exit (int);
+extern void _Exit (int);
+
+extern void tabort (void);
+extern void texit (void);
+extern void t_exit (void);
+extern void t_Exit (void);
+
+extern void link_failure (void);
+
+int
+main (void)
+{
+ volatile int i = 0;
+ if (i)
+ tabort ();
+ if (i)
+ texit ();
+ if (i)
+ t_exit ();
+ if (i)
+ t_Exit ();
+ exit (0);
+}
+
+void
+tabort (void)
+{
+ abort ();
+ link_failure ();
+}
+
+void
+texit (void)
+{
+ exit (1);
+ link_failure ();
+}
+
+void
+t_exit (void)
+{
+ _exit (1);
+ link_failure ();
+}
+
+/* Some non-Unix libcs might not have _exit. */
+void
+_exit (int i)
+{
+ abort ();
+}
+
+void
+t_Exit (void)
+{
+ _Exit (1);
+ link_failure ();
+}
+
+/* Some libcs might not have _Exit. */
+void
+_Exit (int i)
+{
+ abort ();
+}
diff --git a/gcc/testsuite/gcc.dg/torture/builtin-noret-2.c b/gcc/testsuite/gcc.dg/torture/builtin-noret-2.c
new file mode 100644
index 00000000000..9b94a4c2a8e
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/builtin-noret-2.c
@@ -0,0 +1,73 @@
+/* Test for builtin noreturn attributes when the visible declarations
+ are function-local. Modified from builtin-noret-1.c by Zack Weinberg
+ <zack@codesourcery.com>. */
+/* { dg-options "-multiply_defined suppress" { target powerpc-*-darwin* } } */
+/* { dg-do link } */
+
+extern void tabort (void);
+extern void texit (void);
+extern void t_exit (void);
+extern void t_Exit (void);
+
+extern void link_failure (void);
+
+int
+main (void)
+{
+ volatile int i = 0;
+ if (i)
+ tabort ();
+ if (i)
+ texit ();
+ if (i)
+ t_exit ();
+ if (i)
+ t_Exit ();
+ exit (0);
+}
+
+void
+tabort (void)
+{
+ extern void abort (void);
+ abort ();
+ link_failure ();
+}
+
+void
+texit (void)
+{
+ extern void exit (int);
+ exit (1);
+ link_failure ();
+}
+
+void
+t_exit (void)
+{
+ extern void _exit (int);
+ _exit (1);
+ link_failure ();
+}
+
+/* Some non-Unix libcs might not have _exit. */
+void
+_exit (int i)
+{
+ abort ();
+}
+
+void
+t_Exit (void)
+{
+ extern void _Exit (int);
+ _Exit (1);
+ link_failure ();
+}
+
+/* Some libcs might not have _Exit. */
+void
+_Exit (int i)
+{
+ abort ();
+}
diff --git a/gcc/testsuite/gcc.dg/unroll-1.c b/gcc/testsuite/gcc.dg/unroll-1.c
new file mode 100644
index 00000000000..1e2dd09ebec
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/unroll-1.c
@@ -0,0 +1,26 @@
+/* PR optimization/8599 */
+/* { dg-do run } */
+/* { dg-options "-O2 -funroll-loops" } */
+/* { dg-options "-mtune=k6 -O2 -funroll-loops" { target i?86-*-* } } */
+
+extern void abort (void);
+
+int array[6] = { 1,2,3,4,5,6 };
+
+void foo()
+{
+ int i;
+
+ for (i = 0; i < 5; i++)
+ array[i] = 0;
+}
+
+int main()
+{
+ foo();
+ if (array[0] || array [1] || array[2] || array[3] || array[4])
+ abort ();
+ if (array[5] != 6)
+ abort ();
+ return 0;
+}