Merge from gcc-3_2-rhl8-branch:
2003-04-23 Jakub Jelinek <jakub@redhat.com>
* gcc.dg/tls/opt-6.c: New test.
2003-04-05 Jakub Jelinek <jakub@redhat.com>
* gcc.dg/
20030405-1.c: New test.
2003-03-09 Jakub Jelinek <jakub@redhat.com>
* gcc.dg/
20030309-1.c: New test.
2003-03-07 Eric Botcazou <ebotcazou@libertysurf.fr>
* gcc.c-torture/execute/
20030307-1.c: New test.
2003-02-20 Randolph Chung <tausq@debian.org>
* gcc.c-torture/compile/
20030220-1.c: New test.
2003-02-18 Jakub Jelinek <jakub@redhat.com>
* gcc.dg/
20030217-1.c: New test.
2003-01-29 Jakub Jelinek <jakub@redhat.com>
* gcc.c-torture/compile/
20020129-1.c: New test.
2002-12-21 Eric Botcazou <ebotcazou@libertysurf.fr>
* gcc.dg/unroll-1.c: New test.
2002-11-16 Jan Hubicka <jh@suse.cz>
* gcc.c-torture/execute/
20020920-1.c: New test.
2002-10-08 Jakub Jelinek <jakub@redhat.com>
PR target/7434
* gcc.c-torture/compile/
20021008-1.c: New test.
2002-08-10 Gwenole Beauchesne <gbeauchesne@mandrakesoft.com>
PR target/7559
* testsuite/gcc.c-torture/execute/
20020810-1.c: New test.
2002-08-07 Jakub Jelinek <jakub@redhat.com>
* gcc.c-torture/compile/
20020807-1.c: New test.
2002-07-30 Jakub Jelinek <jakub@redhat.com>
* gcc.dg/tls/opt-1.c: New test.
2002-07-29 Jakub Jelinek <jakub@redhat.com>
* gcc.dg/
20020729-1.c: New test.
2002-07-20 Jakub Jelinek <jakub@redhat.com>
* g++.dg/opt/life1.C: New test.
2002-05-20 Jakub Jelinek <jakub@redhat.com>
* gcc.dg/
20020525-1.c: New test.
2002-05-24 Jakub Jelinek <jakub@redhat.com>
PR c++/6794
* g++.dg/ext/pretty1.C: New test.
* g++.dg/ext/pretty2.C: New test.
From-SVN: r66877
+2003-05-16 Jakub Jelinek <jakub@redhat.com>
+
+ Merge from gcc-3_2-rhl8-branch:
+ 2003-04-23 Jakub Jelinek <jakub@redhat.com>
+
+ * gcc.dg/tls/opt-6.c: New test.
+
+ 2003-04-05 Jakub Jelinek <jakub@redhat.com>
+
+ * gcc.dg/20030405-1.c: New test.
+
+ 2003-03-09 Jakub Jelinek <jakub@redhat.com>
+
+ * gcc.dg/20030309-1.c: New test.
+
+ 2003-03-07 Eric Botcazou <ebotcazou@libertysurf.fr>
+
+ * gcc.c-torture/execute/20030307-1.c: New test.
+
+ 2003-02-20 Randolph Chung <tausq@debian.org>
+
+ * gcc.c-torture/compile/20030220-1.c: New test.
+
+ 2003-02-18 Jakub Jelinek <jakub@redhat.com>
+
+ * gcc.dg/20030217-1.c: New test.
+
+ 2003-01-29 Jakub Jelinek <jakub@redhat.com>
+
+ * gcc.c-torture/compile/20020129-1.c: New test.
+
+ 2002-12-21 Eric Botcazou <ebotcazou@libertysurf.fr>
+
+ * gcc.dg/unroll-1.c: New test.
+
+ 2002-11-16 Jan Hubicka <jh@suse.cz>
+
+ * gcc.c-torture/execute/20020920-1.c: New test.
+
+ 2002-10-08 Jakub Jelinek <jakub@redhat.com>
+
+ PR target/7434
+ * gcc.c-torture/compile/20021008-1.c: New test.
+
+ 2002-08-10 Gwenole Beauchesne <gbeauchesne@mandrakesoft.com>
+
+ PR target/7559
+ * testsuite/gcc.c-torture/execute/20020810-1.c: New test.
+
+ 2002-08-07 Jakub Jelinek <jakub@redhat.com>
+
+ * gcc.c-torture/compile/20020807-1.c: New test.
+
+ 2002-07-30 Jakub Jelinek <jakub@redhat.com>
+
+ * gcc.dg/tls/opt-1.c: New test.
+
+ 2002-07-29 Jakub Jelinek <jakub@redhat.com>
+
+ * gcc.dg/20020729-1.c: New test.
+
+ 2002-07-20 Jakub Jelinek <jakub@redhat.com>
+
+ * g++.dg/opt/life1.C: New test.
+
+ 2002-05-20 Jakub Jelinek <jakub@redhat.com>
+
+ * gcc.dg/20020525-1.c: New test.
+
+ 2002-05-24 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/6794
+ * g++.dg/ext/pretty1.C: New test.
+ * g++.dg/ext/pretty2.C: New test.
+
2003-05-15 Mark Mitchell <mark@codesourcery.com>
PR c++/8385
--- /dev/null
+// 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\*" } }
--- /dev/null
+// 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 ();
+}
--- /dev/null
+// 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" } }
--- /dev/null
+/* 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);
+}
--- /dev/null
+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 ();
+}
--- /dev/null
+/* 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;
+}
--- /dev/null
+/* 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);
+}
--- /dev/null
+/* 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;
+}
--- /dev/null
+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);
+}
--- /dev/null
+/* 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;
+}
--- /dev/null
+/* 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);
+}
--- /dev/null
+/* { 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;
+}
--- /dev/null
+/* 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);
+}
--- /dev/null
+/* { 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;
+}
--- /dev/null
+/* { 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;
+ }
+}
--- /dev/null
+/* { 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);
+}
--- /dev/null
+/* { 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);
+}
--- /dev/null
+/* 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;
+}