summaryrefslogtreecommitdiff
path: root/gcc_arm/testsuite/gcc.dg
diff options
context:
space:
mode:
Diffstat (limited to 'gcc_arm/testsuite/gcc.dg')
-rwxr-xr-xgcc_arm/testsuite/gcc.dg/980211-1.c27
-rwxr-xr-xgcc_arm/testsuite/gcc.dg/980217-1.c36
-rwxr-xr-xgcc_arm/testsuite/gcc.dg/980226-1.c12
-rwxr-xr-xgcc_arm/testsuite/gcc.dg/980312-1.c24
-rwxr-xr-xgcc_arm/testsuite/gcc.dg/980313-1.c25
-rwxr-xr-xgcc_arm/testsuite/gcc.dg/980414-1.c76
-rwxr-xr-xgcc_arm/testsuite/gcc.dg/980502-1.c9
-rwxr-xr-xgcc_arm/testsuite/gcc.dg/980520-1.c17
-rwxr-xr-xgcc_arm/testsuite/gcc.dg/980523-1.c51
-rwxr-xr-xgcc_arm/testsuite/gcc.dg/980526-1.c17
-rwxr-xr-xgcc_arm/testsuite/gcc.dg/980626-1.c16
-rwxr-xr-xgcc_arm/testsuite/gcc.dg/980709-1.c20
-rwxr-xr-xgcc_arm/testsuite/gcc.dg/980816-1.c20
-rwxr-xr-xgcc_arm/testsuite/gcc.dg/980827-1.c26
-rwxr-xr-xgcc_arm/testsuite/gcc.dg/README16
-rwxr-xr-xgcc_arm/testsuite/gcc.dg/bf-spl1.c58
-rwxr-xr-xgcc_arm/testsuite/gcc.dg/clobbers.c27
-rwxr-xr-xgcc_arm/testsuite/gcc.dg/cpp-mi.c34
-rwxr-xr-xgcc_arm/testsuite/gcc.dg/cpp-mic.h10
-rwxr-xr-xgcc_arm/testsuite/gcc.dg/cpp-micc.h10
-rwxr-xr-xgcc_arm/testsuite/gcc.dg/dg.exp69
-rwxr-xr-xgcc_arm/testsuite/gcc.dg/dll-1.c10
-rwxr-xr-xgcc_arm/testsuite/gcc.dg/dll-2.c24
-rwxr-xr-xgcc_arm/testsuite/gcc.dg/dll-3.c16
-rwxr-xr-xgcc_arm/testsuite/gcc.dg/dll-4.c14
-rwxr-xr-xgcc_arm/testsuite/gcc.dg/ifelse-1.c21
-rwxr-xr-xgcc_arm/testsuite/gcc.dg/special/alias-1.c15
-rwxr-xr-xgcc_arm/testsuite/gcc.dg/special/ecos.exp214
-rwxr-xr-xgcc_arm/testsuite/gcc.dg/special/gcsec-1.c21
-rwxr-xr-xgcc_arm/testsuite/gcc.dg/special/weak-1.c15
-rwxr-xr-xgcc_arm/testsuite/gcc.dg/special/weak-1a.c3
-rwxr-xr-xgcc_arm/testsuite/gcc.dg/special/weak-2.c11
-rwxr-xr-xgcc_arm/testsuite/gcc.dg/special/weak-2a.c5
-rwxr-xr-xgcc_arm/testsuite/gcc.dg/special/weak-2b.c3
-rwxr-xr-xgcc_arm/testsuite/gcc.dg/special/wkali-1.c15
-rwxr-xr-xgcc_arm/testsuite/gcc.dg/special/wkali-2.c11
-rwxr-xr-xgcc_arm/testsuite/gcc.dg/special/wkali-2a.c7
-rwxr-xr-xgcc_arm/testsuite/gcc.dg/special/wkali-2b.c7
-rwxr-xr-xgcc_arm/testsuite/gcc.dg/splet-1.c21
-rwxr-xr-xgcc_arm/testsuite/gcc.dg/struct-ret-1.c45
-rwxr-xr-xgcc_arm/testsuite/gcc.dg/switch-1.c17
-rwxr-xr-xgcc_arm/testsuite/gcc.dg/ultrasp1.c9
42 files changed, 1104 insertions, 0 deletions
diff --git a/gcc_arm/testsuite/gcc.dg/980211-1.c b/gcc_arm/testsuite/gcc.dg/980211-1.c
new file mode 100755
index 0000000..6332b7e
--- /dev/null
+++ b/gcc_arm/testsuite/gcc.dg/980211-1.c
@@ -0,0 +1,27 @@
+/* Test long double on x86. */
+
+/* { dg-do run { target i?86-*-* } } */
+/* { dg-options -O2 } */
+
+__inline int
+__signbitl (long double __x)
+{
+ union { long double __l; int __i[3]; } __u = { __l: __x };
+
+ return (__u.__i[2] & 0x8000) != 0;
+}
+
+void
+foo (long double x, long double y)
+{
+ long double z = x / y;
+ if (__signbitl (x) && __signbitl (z))
+ abort ();
+}
+
+int main()
+{
+ if (sizeof (long double) > sizeof (double))
+ foo (-0.0, -1.0);
+ return 0;
+}
diff --git a/gcc_arm/testsuite/gcc.dg/980217-1.c b/gcc_arm/testsuite/gcc.dg/980217-1.c
new file mode 100755
index 0000000..2236e84
--- /dev/null
+++ b/gcc_arm/testsuite/gcc.dg/980217-1.c
@@ -0,0 +1,36 @@
+/* Test float on alpha. */
+
+/* { dg-do run { target alpha*-*-* } } */
+/* { dg-options "-mieee -O2" } */
+
+typedef int int32_t __attribute__ ((__mode__ ( __SI__ ))) ;
+typedef union
+{
+ float value;
+ int32_t word;
+} ieee_float_shape_type;
+
+int isinff(float x)
+{
+ int32_t ix,t;
+ ieee_float_shape_type gf_u;
+ gf_u.value = x;
+ ix = gf_u.word;
+ printf ("%x\n", ix);
+ t = ix & 0x7fffffff;
+ t ^= 0x7f800000;
+ t |= -t;
+ return ~(t >> 31) & (1 - ((ix & 0x80000000) >> 30));
+}
+
+main ()
+{
+ float x = 1.0 / 0.0;
+ int i = isinff (x);
+
+ if (i == 0)
+ abort ();
+
+ printf ("%d\n", i);
+ return 0;
+}
diff --git a/gcc_arm/testsuite/gcc.dg/980226-1.c b/gcc_arm/testsuite/gcc.dg/980226-1.c
new file mode 100755
index 0000000..f66e9e2
--- /dev/null
+++ b/gcc_arm/testsuite/gcc.dg/980226-1.c
@@ -0,0 +1,12 @@
+/* { dg-do compile { target i?86-*-* } } */
+/* { dg-options -O2 } */
+
+extern double bar (double);
+
+int
+baz (double d)
+{
+ double e = bar (d);
+ asm volatile ("" : : : "st");
+ return printf ("%lg\n", e);
+}
diff --git a/gcc_arm/testsuite/gcc.dg/980312-1.c b/gcc_arm/testsuite/gcc.dg/980312-1.c
new file mode 100755
index 0000000..8f72c31
--- /dev/null
+++ b/gcc_arm/testsuite/gcc.dg/980312-1.c
@@ -0,0 +1,24 @@
+/* { dg-do link { target i?86-*-* } } */
+/* { dg-options "-O2 -march=pentiumpro" } */
+
+extern __inline double
+__expm1 (double __x)
+{
+ double __temp;
+ __temp = 1.0;
+ return __temp;
+}
+extern __inline double
+__sgn1 (double __x)
+{
+ return __x >= 0.0 ? 1.0 : -1.0;
+}
+double
+tanh (double __x)
+{
+ return __expm1 (__x) * __sgn1 (-__x);
+}
+main ()
+{
+ return tanh (3.45) != 0;
+}
diff --git a/gcc_arm/testsuite/gcc.dg/980313-1.c b/gcc_arm/testsuite/gcc.dg/980313-1.c
new file mode 100755
index 0000000..1036339
--- /dev/null
+++ b/gcc_arm/testsuite/gcc.dg/980313-1.c
@@ -0,0 +1,25 @@
+/* { dg-do link { target i?86-*-* } } */
+/* { dg-options "-O2 -march=pentiumpro" } */
+
+extern __inline double
+__expm1 (double __x)
+{
+ double __temp;
+ __temp -= 1.0;
+ return __temp;
+}
+extern __inline double
+__sgn1 (double __x)
+{
+ return __x >= 0.0 ? 1.0 : -1.0;
+}
+double
+tanh (double __x)
+{
+ register double __exm1 = __expm1 (__x);
+ return __exm1 / (__exm1 + 2.0) * __sgn1 (-__x);
+}
+main ()
+{
+ return tanh (3.45) != 0;
+}
diff --git a/gcc_arm/testsuite/gcc.dg/980414-1.c b/gcc_arm/testsuite/gcc.dg/980414-1.c
new file mode 100755
index 0000000..8fd0e12
--- /dev/null
+++ b/gcc_arm/testsuite/gcc.dg/980414-1.c
@@ -0,0 +1,76 @@
+/* Test double on x86. */
+
+/* { dg-do run { target i?86-*-* } } */
+/* { dg-options -O2 } */
+
+static __inline double
+mypow (double __x, double __y)
+{
+ register double __value, __exponent;
+ long __p = (long) __y;
+ if (__y == (double) __p)
+ {
+ double __r = 1.0;
+ if (__p == 0)
+ return 1.0;
+ if (__p < 0)
+ {
+ __p = -__p;
+ __x = 1.0 / __x;
+ }
+ while (1)
+ {
+ if (__p & 1)
+ __r *= __x;
+ __p >>= 1;
+ if (__p == 0)
+ return __r;
+ __x *= __x;
+ }
+ }
+ __asm __volatile__
+ ("fmul %%st(1),%%st\n\t" /* y * log2(x) */
+ "fst %%st(1)\n\t"
+ "frndint\n\t" /* int(y * log2(x)) */
+ "fxch\n\t"
+ "fsub %%st(1),%%st\n\t" /* fract(y * log2(x)) */
+ "f2xm1\n\t" /* 2^(fract(y * log2(x))) - 1 */
+ : "=t" (__value), "=u" (__exponent) : "0" (__x), "1" (__y));
+ __value += 1.0;
+ __asm __volatile__
+ ("fscale"
+ : "=t" (__value) : "0" (__value), "u" (__exponent));
+ return __value;
+}
+
+const double E1 = 2.71828182845904523536028747135;
+
+double fact (double x)
+{
+ double corr;
+ corr = 1.0;
+ return corr * mypow(x/E1, x);
+}
+
+int main ()
+{
+ double y, z;
+
+ y = fact (46.2);
+ z = mypow (46.2/E1, 46.2);
+
+#if 0
+ printf ("%26.19e, %26.19e\n", y, z);
+#endif
+
+ if (y > z)
+ y -= z;
+ else
+ y = z - y;
+
+ y /= z;
+ if (y > 0.1)
+ abort ();
+
+ return 0;
+}
diff --git a/gcc_arm/testsuite/gcc.dg/980502-1.c b/gcc_arm/testsuite/gcc.dg/980502-1.c
new file mode 100755
index 0000000..f06491c
--- /dev/null
+++ b/gcc_arm/testsuite/gcc.dg/980502-1.c
@@ -0,0 +1,9 @@
+/* { dg-do compile }*/
+/* { dg-options "-O2" } */
+
+char *const f(void)
+{
+ char *const line = "/dev/ptyXX";
+ line[8] = 1;
+ return line;
+}
diff --git a/gcc_arm/testsuite/gcc.dg/980520-1.c b/gcc_arm/testsuite/gcc.dg/980520-1.c
new file mode 100755
index 0000000..e140182
--- /dev/null
+++ b/gcc_arm/testsuite/gcc.dg/980520-1.c
@@ -0,0 +1,17 @@
+/* { dg-do compile { target i?86-*-* } } */
+/* { dg-options -O2 } */
+
+int bug(void)
+{
+ unsigned long a, b;
+
+ __asm__(""
+ : "=d" (a)
+ :
+ : "memory");
+ __asm__ __volatile__(""
+ :
+ : "g" (b)
+ : "memory");
+ return a;
+}
diff --git a/gcc_arm/testsuite/gcc.dg/980523-1.c b/gcc_arm/testsuite/gcc.dg/980523-1.c
new file mode 100755
index 0000000..6265a73
--- /dev/null
+++ b/gcc_arm/testsuite/gcc.dg/980523-1.c
@@ -0,0 +1,51 @@
+/* { dg-do run { target rs6000-*-linux* powerpc-*-linux*} } */
+/* { dg-options "-O2 -fpic" } */
+
+void foo1(int a, char *b, int c)
+{
+ c =a+c+234;
+}
+
+int foo2(int d)
+{
+ return d*d;
+}
+
+int bar1, bar2, bar3;
+char * bar4;
+
+int main(void) {
+ int h;
+ bar1 = foo2(1);
+ bar2 = foo2(1);
+
+ h = foo2(1);
+ foo1(1, "a", foo2(1));
+ foo1(bar1, "a", foo2(1));
+ foo2(1);
+
+ h = foo2(1);
+ bar3 = 1;
+ bar4 = "a";
+ foo1(1, "n", foo2(1));
+ foo1(1, "o", foo2(1));
+ foo1(1, "p", foo2(1));
+ foo1(bar1, "a", foo2(1));
+
+ bar3 = h;
+ bar4 = "b"; foo1(bar1, "b", foo2(1));
+ foo1(1, "q", foo2(1));
+ bar4 = "c"; foo1(1, "c", foo2(1));
+ bar4 = "d"; foo1(1, "d", foo2(1));
+ bar4 = "e"; foo1(1, "e", foo2(1));
+ bar4 = "f"; foo1(1, "f", foo2(1));
+ bar4 = "g"; foo1(1, "g", foo2(1));
+ bar4 = "h"; foo1(1, "h", foo2(1));
+ bar4 = "i"; foo1(1, "i", foo2(1));
+ bar4 = "j"; foo1(1, "j", foo2(1));
+ bar4 = "k"; foo1(1, "k", foo2(1));
+ bar4 = "l"; foo1(1, "l", foo2(1));
+ bar4 = "m";
+ foo1(bar2, "m", foo2(1));
+ exit(0);
+}
diff --git a/gcc_arm/testsuite/gcc.dg/980526-1.c b/gcc_arm/testsuite/gcc.dg/980526-1.c
new file mode 100755
index 0000000..08ef6e2
--- /dev/null
+++ b/gcc_arm/testsuite/gcc.dg/980526-1.c
@@ -0,0 +1,17 @@
+/* { dg-do compile { target rs6000-*-linux* powerpc-*-linux* } } */
+/* { dg-options "-O2 -fpic" } */
+
+int
+test(void)
+{
+ double value, maxValue = - (__extension__ ((union { unsigned __l __attribute__((__mode__(__DI__))); double __d; }) { __l: 0x7ff0000000000000ULL }).__d) ;
+ int idx, maxIdx = 1;
+
+ for (idx = 1; idx < 22; idx++) {
+ if (value > maxValue) {
+ maxValue = value;
+ maxIdx = idx;
+ }
+ }
+ return 0 ;
+}
diff --git a/gcc_arm/testsuite/gcc.dg/980626-1.c b/gcc_arm/testsuite/gcc.dg/980626-1.c
new file mode 100755
index 0000000..7d8ae83
--- /dev/null
+++ b/gcc_arm/testsuite/gcc.dg/980626-1.c
@@ -0,0 +1,16 @@
+/* { dg-do compile } */
+/* { dg-options -Wimplicit-int } */
+/* { dg-excess-errors "c-decl.c:grokdeclarator does not handle mode attributes" { xfail *-*-* } } */
+
+int main()
+{
+ typedef SFtype __attribute__ ((mode (SF)));
+ typedef DFtype __attribute__ ((mode (DF)));
+ typedef HItype __attribute__ ((mode (HI)));
+ typedef SItype __attribute__ ((mode (SI)));
+ typedef DItype __attribute__ ((mode (DI)));
+ typedef UHItype __attribute__ ((mode (HI)));
+ typedef USItype __attribute__ ((mode (SI)));
+ typedef UDItype __attribute__ ((mode (DI)));
+ return 0;
+}
diff --git a/gcc_arm/testsuite/gcc.dg/980709-1.c b/gcc_arm/testsuite/gcc.dg/980709-1.c
new file mode 100755
index 0000000..a435930
--- /dev/null
+++ b/gcc_arm/testsuite/gcc.dg/980709-1.c
@@ -0,0 +1,20 @@
+/* { dg-do compile { target i?86-*-* } } */
+/* { dg-options -O2 } */
+
+extern __inline__ int test_and_set_bit(int nr, volatile void * addr)
+{
+ int oldbit;
+ __asm__ __volatile__( ""
+ "btsl %2,%1\n\tsbbl %0,%0"
+ :"=r" (oldbit),"=m" (addr)
+ :"ir" (nr));
+ return oldbit;
+}
+struct buffer_head {
+ unsigned long b_state;
+};
+extern void lock_buffer(struct buffer_head * bh)
+{
+ while (test_and_set_bit(2 , &bh->b_state))
+ __wait_on_buffer(bh);
+}
diff --git a/gcc_arm/testsuite/gcc.dg/980816-1.c b/gcc_arm/testsuite/gcc.dg/980816-1.c
new file mode 100755
index 0000000..2a96ef4
--- /dev/null
+++ b/gcc_arm/testsuite/gcc.dg/980816-1.c
@@ -0,0 +1,20 @@
+/* { dg-do compile } */
+/* { dg-options -fno-force-mem } */
+
+int
+div_and_round_double (lden_orig, hden_orig)
+ int lden_orig, hden_orig;
+{
+ int quo[4];
+ register int i;
+ unsigned int work;
+ register unsigned int carry = 0;
+ int lden = lden_orig;
+ int hden = hden_orig;
+ neg_double (&lden, &hden);
+ for (i = 4 - 1; i >= 0; i--)
+ {
+ quo[i] = work / (unsigned int ) lden;
+ carry = work % (unsigned int ) lden;
+ }
+}
diff --git a/gcc_arm/testsuite/gcc.dg/980827-1.c b/gcc_arm/testsuite/gcc.dg/980827-1.c
new file mode 100755
index 0000000..a841739
--- /dev/null
+++ b/gcc_arm/testsuite/gcc.dg/980827-1.c
@@ -0,0 +1,26 @@
+/* { dg-do run { target powerpc*-*-* } } */
+/* { dg-options -O2 } */
+
+double dval = 0;
+
+void splat (double d);
+
+int main(void)
+{
+ splat(0);
+ if (dval == 0)
+ abort();
+ exit (0);
+}
+
+void splat (double d)
+{
+ union {
+ double f;
+ unsigned int l[2];
+ } u;
+
+ u.f = d + d;
+ u.l[1] |= 1;
+ asm volatile ("stfd %0,dval@sdarel(13)" : : "f" (u.f));
+}
diff --git a/gcc_arm/testsuite/gcc.dg/README b/gcc_arm/testsuite/gcc.dg/README
new file mode 100755
index 0000000..6f14899
--- /dev/null
+++ b/gcc_arm/testsuite/gcc.dg/README
@@ -0,0 +1,16 @@
+Notes for testsuite/gcc.dg.
+
+1) There should be only one driver, dg.exp.
+
+2) Try to organize the tests by topic using file name prefixes.
+
+ Eg: All bitfield tests are named "bf-*.c".
+
+ This lets the person running the tests choose particular sets of tests to
+ run easily (using wildcards).
+
+ Eg: make check RUNTESTFLAGS='dg.exp=bf-*.c'
+
+3) Remember DOS file name restrictions (8.3). Sigh.
+
+4) Send bugs, comments, etc. to dje@cygnus.com. \ No newline at end of file
diff --git a/gcc_arm/testsuite/gcc.dg/bf-spl1.c b/gcc_arm/testsuite/gcc.dg/bf-spl1.c
new file mode 100755
index 0000000..df3f481
--- /dev/null
+++ b/gcc_arm/testsuite/gcc.dg/bf-spl1.c
@@ -0,0 +1,58 @@
+/* { dg-do run { target m68k-*-* sparc-*-* } } */
+/* { dg-options { -m68000 -O2 } { target m68k-*-* } } */
+/* { dg-options { -O2 } { target sparc-*-* } } */
+
+typedef SFtype __attribute__ ((mode (SF)));
+typedef DFtype __attribute__ ((mode (DF)));
+
+typedef int HItype __attribute__ ((mode (HI)));
+typedef int SItype __attribute__ ((mode (SI)));
+typedef int DItype __attribute__ ((mode (DI)));
+
+typedef unsigned int UHItype __attribute__ ((mode (HI)));
+typedef unsigned int USItype __attribute__ ((mode (SI)));
+typedef unsigned int UDItype __attribute__ ((mode (DI)));
+
+typedef UDItype fractype;
+typedef USItype halffractype;
+typedef DFtype FLO_type;
+typedef DItype intfrac;
+
+
+typedef union
+{
+ long long foo;
+ FLO_type value;
+ struct
+ {
+ fractype fraction:52 __attribute__ ((packed));
+ unsigned int exp:11 __attribute__ ((packed));
+ unsigned int sign:1 __attribute__ ((packed));
+ }
+ bits;
+} FLO_union_type;
+
+void foo (long long a);
+long long x;
+
+void
+pack_d ()
+{
+ FLO_union_type dst = { 0x0123456789abcdefLL };
+
+ x = dst.bits.fraction;
+}
+
+main ()
+{
+ pack_d ();
+ foo (x);
+ return 0;
+}
+
+void
+foo (long long a)
+{
+ if (a != 0x0123456789abcLL)
+ abort ();
+}
diff --git a/gcc_arm/testsuite/gcc.dg/clobbers.c b/gcc_arm/testsuite/gcc.dg/clobbers.c
new file mode 100755
index 0000000..0eddc14
--- /dev/null
+++ b/gcc_arm/testsuite/gcc.dg/clobbers.c
@@ -0,0 +1,27 @@
+/* Test asm clobbers on x86. */
+
+/* { dg-do run { target i?86-*-* } } */
+
+int main ()
+{
+ int i;
+ __asm__ ("movl $1,%0\n\txorl %%eax,%%eax" : "=r" (i) : : "eax");
+ if (i != 1)
+ abort ();
+ __asm__ ("movl $1,%0\n\txorl %%ebx,%%ebx" : "=r" (i) : : "ebx");
+ if (i != 1)
+ abort ();
+ __asm__ ("movl $1,%0\n\txorl %%ecx,%%ecx" : "=r" (i) : : "ecx");
+ if (i != 1)
+ abort ();
+ __asm__ ("movl $1,%0\n\txorl %%edx,%%edx" : "=r" (i) : : "edx");
+ if (i != 1)
+ abort ();
+ __asm__ ("movl $1,%0\n\txorl %%esi,%%esi" : "=r" (i) : : "esi");
+ if (i != 1)
+ abort ();
+ __asm__ ("movl $1,%0\n\txorl %%edi,%%edi" : "=r" (i) : : "edi");
+ if (i != 1)
+ abort ();
+ return 0;
+}
diff --git a/gcc_arm/testsuite/gcc.dg/cpp-mi.c b/gcc_arm/testsuite/gcc.dg/cpp-mi.c
new file mode 100755
index 0000000..f667d0c
--- /dev/null
+++ b/gcc_arm/testsuite/gcc.dg/cpp-mi.c
@@ -0,0 +1,34 @@
+/* Test "ignore redundant include" facility.
+ This doesn't test for the case where the file is opened, and then ignored
+ (the file shouldn't have even been opened). That would require tracing
+ system calls. It could be done on some systems however. */
+
+/* We have to test two cases: C comments at the top and C++ comments
+ at the top. */
+
+/*
+{ dg-do preprocess }
+{ dg-options "-Wp,-lang-c-c++-comments" }
+*/
+
+#include "cpp-mic.h"
+#include "cpp-mic.h"
+
+#include "cpp-micc.h"
+#include "cpp-micc.h"
+
+main ()
+{
+}
+
+/*
+ { dg-final { if ![file exists cpp-mi.i] { return } } }
+
+ { dg-final { set tmp [grep cpp-mi.i cpp-micc? line] } }
+ { dg-final { # send_user "$tmp\n" } }
+ { dg-final { if [regexp "^{\[0-9\]+ cpp-mic} {\[0-9\]+ cpp-micc}$" $tmp] \{ } }
+ { dg-final { pass "cpp-mi.c: redundant include check" } }
+ { dg-final { \} else \{ } }
+ { dg-final { fail "cpp-mi.c: redundant include check" } }
+ { dg-final { \} } }
+*/
diff --git a/gcc_arm/testsuite/gcc.dg/cpp-mic.h b/gcc_arm/testsuite/gcc.dg/cpp-mic.h
new file mode 100755
index 0000000..bae9d8b
--- /dev/null
+++ b/gcc_arm/testsuite/gcc.dg/cpp-mic.h
@@ -0,0 +1,10 @@
+/* Redundant header include test with C comments at top. */
+
+#ifndef CPP_MIC_H
+#define CPP_MIC_H
+
+int a;
+
+#endif
+
+/* And at the end too! */
diff --git a/gcc_arm/testsuite/gcc.dg/cpp-micc.h b/gcc_arm/testsuite/gcc.dg/cpp-micc.h
new file mode 100755
index 0000000..52c9dcc
--- /dev/null
+++ b/gcc_arm/testsuite/gcc.dg/cpp-micc.h
@@ -0,0 +1,10 @@
+// Redundant header include test with C comments at top.
+
+#ifndef CPP_MICC_H
+#define CPP_MICC_H
+
+int a;
+
+#endif
+
+// And at the end too!
diff --git a/gcc_arm/testsuite/gcc.dg/dg.exp b/gcc_arm/testsuite/gcc.dg/dg.exp
new file mode 100755
index 0000000..6edb5dc
--- /dev/null
+++ b/gcc_arm/testsuite/gcc.dg/dg.exp
@@ -0,0 +1,69 @@
+# Copyright (C) 1997 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+# Please email any bugs, comments, and/or additions to this file to:
+# bug-gcc@prep.ai.mit.edu
+
+# GCC testsuite that uses the `dg.exp' driver.
+
+# Load support procs.
+load_lib gcc-dg.exp
+
+# Utility for scanning compiler result, invoked via dg-final.
+# Call pass if pattern is present, otherwise fail.
+proc scan-assembler { testcase pattern } {
+ global subdir
+
+ set fd [open [file rootname $testcase].s r]
+ set text [read $fd]
+ close $fd
+
+ if [regexp -- $pattern $text] {
+ pass "$subdir/$testcase scan-assembler"
+ } else {
+ fail "$subdir/$testcase scan-assembler"
+ }
+}
+
+# Call pass if pattern is not present, otherwise fail.
+proc scan-assembler-not { testcase pattern } {
+ global subdir
+
+ set fd [open [file rootname $testcase].s r]
+ set text [read $fd]
+ close $fd
+
+ if ![regexp -- $pattern $text] {
+ pass "$subdir/$testcase scan-assembler-not"
+ } else {
+ fail "$subdir/$testcase scan-assembler-not"
+ }
+}
+
+# If a testcase doesn't have special options, use these.
+global DEFAULT_CFLAGS
+if ![info exists DEFAULT_CFLAGS] then {
+ set DEFAULT_CFLAGS " -ansi -pedantic-errors"
+}
+
+# Initialize `dg'.
+dg-init
+
+# Main loop.
+dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.c]] "" $DEFAULT_CFLAGS
+
+# All done.
+dg-finish
diff --git a/gcc_arm/testsuite/gcc.dg/dll-1.c b/gcc_arm/testsuite/gcc.dg/dll-1.c
new file mode 100755
index 0000000..eb3b9b8
--- /dev/null
+++ b/gcc_arm/testsuite/gcc.dg/dll-1.c
@@ -0,0 +1,10 @@
+/* { dg-do compile { target arm*-*-pe* } } */
+/* { dg-do compile { target thumb*-*-pe* } } */
+/* { dg-options -mno-nop-fun-dllimport } */
+
+__declspec (dllimport) void imp ();
+
+__declspec (dllexport) void exp () { imp (); }
+
+/* { dg-final { scan-assembler dll-1.c "\.section\[ \t\]*.drectve\n\[^\n\]*-export:exp.*__imp_imp" } } */
+/* { dg-final { scan-assembler-not dll-1.c "__imp_exp" } } */
diff --git a/gcc_arm/testsuite/gcc.dg/dll-2.c b/gcc_arm/testsuite/gcc.dg/dll-2.c
new file mode 100755
index 0000000..c55e920
--- /dev/null
+++ b/gcc_arm/testsuite/gcc.dg/dll-2.c
@@ -0,0 +1,24 @@
+/* These dllimport and dllexport appearing for a symbol.
+ The desired behaviour is that if both dllimport
+ and dllexport appear (in either order) the result is dllexport.
+
+ Microsoft's MSVC 2.0 allows dllimport followed by dllexport for variables,
+ but does not allow dllexport followed by dllimport.
+
+ In C, it's ok to redeclare a variable so this works for variables
+ and functions. In C++, it only works for functions. */
+
+/* { dg-do compile { target arm*-*-pe* } } */
+/* { dg-do compile { target thumb*-*-pe* } } */
+
+__declspec (dllimport) int foo1 ();
+__declspec (dllexport) int foo1 ();
+
+__declspec (dllexport) int foo2 ();
+__declspec (dllimport) int foo2 ();
+
+__declspec (dllimport) int bar1;
+__declspec (dllexport) int bar1;
+
+__declspec (dllexport) int bar2;
+__declspec (dllimport) int bar2;
diff --git a/gcc_arm/testsuite/gcc.dg/dll-3.c b/gcc_arm/testsuite/gcc.dg/dll-3.c
new file mode 100755
index 0000000..0f7818f
--- /dev/null
+++ b/gcc_arm/testsuite/gcc.dg/dll-3.c
@@ -0,0 +1,16 @@
+/* Ensure dllexport overrides dllimport. */
+
+/* { dg-do compile { target arm*-*-pe* } } */
+/* { dg-do compile { target thumb*-*-pe* } } */
+
+__declspec (dllimport) int foo1 ();
+__declspec (dllexport) int foo1 ();
+
+__declspec (dllexport) int foo2 ();
+__declspec (dllimport) int foo2 ();
+
+__declspec (dllexport) int foo1 () { return foo2 (); }
+__declspec (dllexport) int foo2 () { return foo1 (); }
+
+/* { dg-final { scan-assembler dll-3.c "\.section\[ \t\]*\.drectve\n\[^\n\]*-export:foo1.*\.section\[ \t\]*\.drectve\n\[^\n\]*-export:foo2" } } */
+/* { dg-final { scan-assembler-not dll-3.c "(__imp_foo1|__imp_foo2)" } } */
diff --git a/gcc_arm/testsuite/gcc.dg/dll-4.c b/gcc_arm/testsuite/gcc.dg/dll-4.c
new file mode 100755
index 0000000..b708790
--- /dev/null
+++ b/gcc_arm/testsuite/gcc.dg/dll-4.c
@@ -0,0 +1,14 @@
+/* { dg-do compile { target arm*-*-pe* } } */
+/* { dg-do compile { target thumb*-*-pe* } } */
+
+__declspec (dllimport) int foo1;
+int foo1;
+
+__declspec (dllimport) int foo2;
+int foo2 = 5;
+
+int f () { return foo1 + foo2; }
+
+/* FIXME: We should scan the output of nm for this case. */
+/* { dg-final { scan-assembler dll-4.c "(foo2:.*\.comm\[ \t_\]*foo1)" } } */
+/* { dg-final { scan-assembler-not dll-4.c "__imp_" } } */
diff --git a/gcc_arm/testsuite/gcc.dg/ifelse-1.c b/gcc_arm/testsuite/gcc.dg/ifelse-1.c
new file mode 100755
index 0000000..2dd2208
--- /dev/null
+++ b/gcc_arm/testsuite/gcc.dg/ifelse-1.c
@@ -0,0 +1,21 @@
+/*
+{ dg-do compile }
+{ dg-options "-W -Wall" }
+*/
+
+
+extern int bar ();
+extern int com ();
+extern int baz ();
+void
+foo (a,b)
+ int a, b;
+{
+ if (a)
+ if (b)
+ bar ();
+ else
+ com (); /* { dg-bogus ".*warning.*" "bogus warning" } */
+ else
+ baz ();
+}
diff --git a/gcc_arm/testsuite/gcc.dg/special/alias-1.c b/gcc_arm/testsuite/gcc.dg/special/alias-1.c
new file mode 100755
index 0000000..347e174
--- /dev/null
+++ b/gcc_arm/testsuite/gcc.dg/special/alias-1.c
@@ -0,0 +1,15 @@
+/* { dg-do link } */
+
+extern int foo(void) __attribute__((alias("bar")));
+
+int bar(void) {
+ return 1;
+}
+
+int main(void) {
+
+ if (foo())
+ exit(0);
+ else
+ abort();
+}
diff --git a/gcc_arm/testsuite/gcc.dg/special/ecos.exp b/gcc_arm/testsuite/gcc.dg/special/ecos.exp
new file mode 100755
index 0000000..dc54df6
--- /dev/null
+++ b/gcc_arm/testsuite/gcc.dg/special/ecos.exp
@@ -0,0 +1,214 @@
+# Copyright (C) 1999 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+# Please email any bugs, comments, and/or additions to this file to:
+# jlarmour@cygnus.co.uk
+
+# This file was written by Jonathan Larmour (jlarmour@cygnus.co.uk).
+
+# GCC testsuite that uses the `dg.exp' driver.
+
+# Load support procs.
+load_lib gcc-dg.exp
+
+###################################
+# proc gcc_target_object_format { }
+###################################
+
+proc gcc_target_object_format { } {
+ global gcc_target_object_format_saved
+
+ if [info exists gcc_target_object_format_saved] {
+ verbose "gcc_target_object_format returning saved $gcc_target_object_format_saved" 2
+ return $gcc_target_object_format_saved
+ } else {
+
+ set objdump_name [find_binutils_prog objdump]
+ set open_file [open objfmtst.c w]
+ puts $open_file "void foo(void) { }"
+ close $open_file
+
+ gcc_target_compile objfmtst.c objfmtst.o object ""
+
+ set output [exec $objdump_name --file-headers objfmtst.o ]
+
+ file delete objfmtst.o
+
+ if ![ regexp "file format (.*)arch" $output dummy objformat ] {
+ verbose "Could not parse objdump output" 2
+ set gcc_target_object_format_saved unknown
+ } else {
+ switch -regexp $objformat {
+ elf {
+ verbose "gcc_target_object_format returning elf" 2
+ set gcc_target_object_format_saved elf
+ }
+ ecoff {
+ verbose "gcc_target_object_format returning ecoff" 2
+ set gcc_target_object_format_saved ecoff
+ }
+ coff {
+ verbose "gcc_target_object_format returning coff" 2
+ set gcc_target_object_format_saved coff
+ }
+ a\.out {
+ verbose "gcc_target_object_format returning a.out" 2
+ set gcc_target_object_format_saved a.out
+ }
+ default {
+ verbose "gcc_target_object_format returning unknown" 2
+ set gcc_target_object_format_saved unknown
+ }
+ }
+ }
+ return $gcc_target_object_format_saved
+ }
+}
+
+###############################
+# proc check_weak_available { }
+###############################
+
+# weak symbols are only supported in some configs/object formats
+# this proc returns 1 if they're support, 0 if they're not, or -1 if unsure
+
+proc check_weak_available { } {
+ global target_cpu
+
+ # All mips targets should support it
+
+ if { [ string first "mips" $target_cpu ] >= 0 } {
+ return 1
+ }
+
+ # ELF and ECOFF support it. a.out does with gas/gld but may also with
+ # other linkers, so we should try it
+
+ set objformat [gcc_target_object_format]
+
+ switch $objformat {
+ elf { return 1 }
+ ecoff { return 1 }
+ a.out { return 1 }
+ unknown { return -1 }
+ default { return 0 }
+ }
+}
+
+##########
+# weak-1.c
+##########
+
+if { [ check_weak_available ] == 1 } {
+ dg-init
+
+ set lines [gcc_target_compile "$srcdir/$subdir/weak-1a.c" "weak-1a.o" object ""]
+ if ![string match "" $lines] then {
+ fail "weak-1a.o"
+ } else {
+ dg-runtest "$srcdir/$subdir/weak-1.c" "weak-1a.o" ""
+ file delete weak-1a.o
+ }
+ dg-finish
+} elseif { [ check_weak_available ] == 0 } {
+ unsupported "weak-1.c"
+} else {
+ unresolved "weak-1.c"
+}
+
+##########
+# weak-2.c
+##########
+
+if { [ check_weak_available ] == 1 } {
+ dg-init
+
+ set lines [gcc_target_compile "$srcdir/$subdir/weak-2a.c" "weak-2a.o" object ""]
+ if ![string match "" $lines] then {
+ fail "weak-2a.o"
+ } else {
+ set lines [gcc_target_compile "$srcdir/$subdir/weak-2b.c" "weak-2b.o" object ""]
+ if ![string match "" $lines] then {
+ fail "weak-2b.o"
+ } else {
+ dg-runtest "$srcdir/$subdir/weak-2.c" "weak-2a.o weak-2b.o" ""
+ file delete weak-2a.o weak-2b.o
+ }
+ }
+ dg-finish
+} elseif { [ check_weak_available ] == 0 } {
+ unsupported "weak-2.c"
+} else {
+ unresolved "weak-2.c"
+}
+
+###########
+# alias-1.c
+###########
+
+dg-init
+dg-runtest "$srcdir/$subdir/alias-1.c" "" ""
+dg-finish
+
+###########
+# wkali-1.c
+###########
+
+dg-init
+dg-runtest "$srcdir/$subdir/wkali-1.c" "" ""
+dg-finish
+
+###########
+# wkali-2.c
+###########
+
+if { [ check_weak_available ] == 1 } {
+ dg-init
+ set lines [gcc_target_compile "$srcdir/$subdir/wkali-2a.c" "wkali-2a.o" object ""]
+ if ![string match "" $lines] then {
+ fail "wkali-2a.o"
+ } else {
+ set lines [gcc_target_compile "$srcdir/$subdir/wkali-2b.c" "wkali-2b.o" object ""]
+ if ![string match "" $lines] then {
+ fail "wkali-2b.o"
+ } else {
+ dg-runtest "$srcdir/$subdir/wkali-2.c" "wkali-2a.o wkali-2b.o" ""
+ file delete wkali-2a.o wkali-2b.o
+ }
+ }
+ dg-finish
+} elseif { [ check_weak_available ] == 0 } {
+ unsupported "wkali-2.c"
+} else {
+ unresolved "wkali-2.c"
+}
+
+###########
+# gcsec-1.c
+###########
+
+set ld_output [ exec [ find_ld ] --help ]
+
+if { [ string first "--gc-sections" $ld_output ] >= 0 } {
+
+ dg-init
+ dg-runtest "$srcdir/$subdir/gcsec-1.c" "-ffunction-sections -fdata-sections -Wl,--gc-sections" ""
+ dg-finish
+} else {
+ unsupported "gcsec-1.c"
+}
+
+### EOF ecos.exp
diff --git a/gcc_arm/testsuite/gcc.dg/special/gcsec-1.c b/gcc_arm/testsuite/gcc.dg/special/gcsec-1.c
new file mode 100755
index 0000000..fa3f884
--- /dev/null
+++ b/gcc_arm/testsuite/gcc.dg/special/gcsec-1.c
@@ -0,0 +1,21 @@
+/* { dg-do run } */
+
+static int unusedint=5;
+
+static int usedint=1;
+
+int unused(void) {
+ return 1;
+}
+
+int foo(void) {
+ return usedint;
+}
+
+int main(void) {
+
+ if (foo())
+ exit(0);
+ else
+ abort();
+}
diff --git a/gcc_arm/testsuite/gcc.dg/special/weak-1.c b/gcc_arm/testsuite/gcc.dg/special/weak-1.c
new file mode 100755
index 0000000..ccf2b08
--- /dev/null
+++ b/gcc_arm/testsuite/gcc.dg/special/weak-1.c
@@ -0,0 +1,15 @@
+/* { dg-do run } */
+
+int foo(void) __attribute__((weak));
+
+int foo(void) {
+ return 0;
+}
+
+int main(void) {
+
+ if (foo())
+ exit(0);
+ else
+ abort();
+}
diff --git a/gcc_arm/testsuite/gcc.dg/special/weak-1a.c b/gcc_arm/testsuite/gcc.dg/special/weak-1a.c
new file mode 100755
index 0000000..2a7dbba
--- /dev/null
+++ b/gcc_arm/testsuite/gcc.dg/special/weak-1a.c
@@ -0,0 +1,3 @@
+int foo(void) {
+ return 1;
+}
diff --git a/gcc_arm/testsuite/gcc.dg/special/weak-2.c b/gcc_arm/testsuite/gcc.dg/special/weak-2.c
new file mode 100755
index 0000000..74259cf
--- /dev/null
+++ b/gcc_arm/testsuite/gcc.dg/special/weak-2.c
@@ -0,0 +1,11 @@
+/* { dg-do run } */
+
+extern int foo(void);
+
+int main(void) {
+
+ if (foo())
+ exit(0);
+ else
+ abort();
+}
diff --git a/gcc_arm/testsuite/gcc.dg/special/weak-2a.c b/gcc_arm/testsuite/gcc.dg/special/weak-2a.c
new file mode 100755
index 0000000..52d3e08
--- /dev/null
+++ b/gcc_arm/testsuite/gcc.dg/special/weak-2a.c
@@ -0,0 +1,5 @@
+int foo(void) __attribute__((weak));
+
+int foo(void) {
+ return 0;
+}
diff --git a/gcc_arm/testsuite/gcc.dg/special/weak-2b.c b/gcc_arm/testsuite/gcc.dg/special/weak-2b.c
new file mode 100755
index 0000000..2a7dbba
--- /dev/null
+++ b/gcc_arm/testsuite/gcc.dg/special/weak-2b.c
@@ -0,0 +1,3 @@
+int foo(void) {
+ return 1;
+}
diff --git a/gcc_arm/testsuite/gcc.dg/special/wkali-1.c b/gcc_arm/testsuite/gcc.dg/special/wkali-1.c
new file mode 100755
index 0000000..d33c8d1
--- /dev/null
+++ b/gcc_arm/testsuite/gcc.dg/special/wkali-1.c
@@ -0,0 +1,15 @@
+/* { dg-do link } */
+
+extern int foo(void) __attribute__((weak, alias("bar")));
+
+int bar(void) {
+ return 1;
+}
+
+int main(void) {
+
+ if (foo())
+ exit(0);
+ else
+ abort();
+}
diff --git a/gcc_arm/testsuite/gcc.dg/special/wkali-2.c b/gcc_arm/testsuite/gcc.dg/special/wkali-2.c
new file mode 100755
index 0000000..74259cf
--- /dev/null
+++ b/gcc_arm/testsuite/gcc.dg/special/wkali-2.c
@@ -0,0 +1,11 @@
+/* { dg-do run } */
+
+extern int foo(void);
+
+int main(void) {
+
+ if (foo())
+ exit(0);
+ else
+ abort();
+}
diff --git a/gcc_arm/testsuite/gcc.dg/special/wkali-2a.c b/gcc_arm/testsuite/gcc.dg/special/wkali-2a.c
new file mode 100755
index 0000000..79dde14
--- /dev/null
+++ b/gcc_arm/testsuite/gcc.dg/special/wkali-2a.c
@@ -0,0 +1,7 @@
+/* { dg-do run } */
+
+extern int foo(void) __attribute__((weak, alias("bar_a")));
+
+int bar_a(void) {
+ return 0;
+}
diff --git a/gcc_arm/testsuite/gcc.dg/special/wkali-2b.c b/gcc_arm/testsuite/gcc.dg/special/wkali-2b.c
new file mode 100755
index 0000000..84f389e
--- /dev/null
+++ b/gcc_arm/testsuite/gcc.dg/special/wkali-2b.c
@@ -0,0 +1,7 @@
+/* { dg-do run } */
+
+extern int foo(void) __attribute__((alias("bar_b")));
+
+int bar_b(void) {
+ return 1;
+}
diff --git a/gcc_arm/testsuite/gcc.dg/splet-1.c b/gcc_arm/testsuite/gcc.dg/splet-1.c
new file mode 100755
index 0000000..03dbb2e
--- /dev/null
+++ b/gcc_arm/testsuite/gcc.dg/splet-1.c
@@ -0,0 +1,21 @@
+/* Test inl-sparc.h. */
+
+/* { dg-do run { target sparclet-*-* } } */
+/* { dg-options -mcpu=sparclet } */
+
+#include <inl-sparc.h>
+
+main ()
+{
+ int a,b;
+
+ a = scan (1, 2);
+ if (a != 3)
+ abort ();
+
+ b = shuffle (4, 5);
+ if (b != 6)
+ abort ();
+
+ exit (0);
+}
diff --git a/gcc_arm/testsuite/gcc.dg/struct-ret-1.c b/gcc_arm/testsuite/gcc.dg/struct-ret-1.c
new file mode 100755
index 0000000..f581aad
--- /dev/null
+++ b/gcc_arm/testsuite/gcc.dg/struct-ret-1.c
@@ -0,0 +1,45 @@
+/* { dg-do run { target hppa*-*-* } } */
+/* { dg-options { -O2 } { target hppa*-*-* } } */
+typedef struct {
+ int x;
+ int y;
+} point_t;
+
+int main(int argc, char *argv[]);
+int printPoints(point_t a, point_t b);
+point_t toPoint(int x1, int y1);
+
+int
+main(int argc, char *argv[])
+{
+
+ if (printPoints(toPoint(0, 0), toPoint(1000, 1000)) != 1)
+ abort();
+ else
+ exit();
+
+ return 0;
+}
+
+int
+printPoints(point_t a, point_t b)
+{
+ if (a.x != 0
+ || a.y != 0
+ || b.x != 1000
+ || b.y != 1000)
+ return 0;
+ else
+ return 1;
+}
+
+point_t
+toPoint(int x1, int y1)
+{
+ point_t p;
+
+ p.x = x1;
+ p.y = y1;
+
+ return p;
+}
diff --git a/gcc_arm/testsuite/gcc.dg/switch-1.c b/gcc_arm/testsuite/gcc.dg/switch-1.c
new file mode 100755
index 0000000..457c520
--- /dev/null
+++ b/gcc_arm/testsuite/gcc.dg/switch-1.c
@@ -0,0 +1,17 @@
+/* { dg-do compile { target rs6000-*-linux* powerpc-*-linux*} } */
+/* { dg-options "-fpic -O2" } */
+
+void f (char *s)
+{
+ for (;;)
+ {
+ int t = 6;
+ switch (t)
+ {
+ case 2:
+ *s = '2';
+ case 6: case 4: case 3: case 1:
+ break;
+ }
+ }
+}
diff --git a/gcc_arm/testsuite/gcc.dg/ultrasp1.c b/gcc_arm/testsuite/gcc.dg/ultrasp1.c
new file mode 100755
index 0000000..853c72d
--- /dev/null
+++ b/gcc_arm/testsuite/gcc.dg/ultrasp1.c
@@ -0,0 +1,9 @@
+/* Simplified from testcase by David Staepelaere <staapa@ultimatech.com> */
+
+/* { dg-do compile { xfail sparc-*-* } } */
+/* { dg-options "" } */
+/* { dg-options -mcpu=ultrasparc { target sparc-*-*-* } } */
+
+int foo(long long y) {
+ return -1 * y;
+}