OSDN Git Service

* gcc.c-torture/compile/20000606-1.c: New test.
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 21 Aug 2000 08:30:38 +0000 (08:30 +0000)
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 21 Aug 2000 08:30:38 +0000 (08:30 +0000)
* gcc.c-torture/compile/20000728-1.c: New test.
* gcc.c-torture/execute/20000801-1.c: New test.
* gcc.c-torture/execute/20000801-2.c: New test.
* gcc.c-torture/execute/20000819-1.c: New test.
* gcc.c-torture/execute/20000819-1.x: XFAIL.
* gcc.dg/20000629-1.c: New test.
* gcc.dg/20000724-1.c: New test.
* gcc.dg/20000807-1.c: New test.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@35834 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/testsuite/ChangeLog
gcc/testsuite/gcc.c-torture/compile/20000606-1.c [new file with mode: 0644]
gcc/testsuite/gcc.c-torture/compile/20000728-1.c [new file with mode: 0644]
gcc/testsuite/gcc.c-torture/execute/20000801-1.c [new file with mode: 0644]
gcc/testsuite/gcc.c-torture/execute/20000801-2.c [new file with mode: 0644]
gcc/testsuite/gcc.c-torture/execute/20000819-1.c [new file with mode: 0644]
gcc/testsuite/gcc.c-torture/execute/20000819-1.x [new file with mode: 0644]
gcc/testsuite/gcc.dg/20000629-1.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/20000724-1.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/20000807-1.c [new file with mode: 0644]

index 5382c0a..d0c10da 100644 (file)
@@ -1,3 +1,15 @@
+2000-08-21  Jakub Jelinek  <jakub@redhat.com>
+
+       * gcc.c-torture/compile/20000606-1.c: New test.
+       * gcc.c-torture/compile/20000728-1.c: New test.
+       * gcc.c-torture/execute/20000801-1.c: New test.
+       * gcc.c-torture/execute/20000801-2.c: New test.
+       * gcc.c-torture/execute/20000819-1.c: New test.
+       * gcc.c-torture/execute/20000819-1.x: XFAIL.
+       * gcc.dg/20000629-1.c: New test.
+       * gcc.dg/20000724-1.c: New test.
+       * gcc.dg/20000807-1.c: New test.
+
 Sun Aug 20 01:41:35 MSD 2000 Dennis Chernoivanov <cdi@sparc.spb.su>
 
        * gcc.dg/cpp/pragma-1.c: New test.
diff --git a/gcc/testsuite/gcc.c-torture/compile/20000606-1.c b/gcc/testsuite/gcc.c-torture/compile/20000606-1.c
new file mode 100644 (file)
index 0000000..93977c0
--- /dev/null
@@ -0,0 +1,10 @@
+typedef struct _foo foo;
+extern foo bar;
+struct _foo {
+  int a;
+};
+
+void baz(void)
+{
+  bar.a = 0;
+}
diff --git a/gcc/testsuite/gcc.c-torture/compile/20000728-1.c b/gcc/testsuite/gcc.c-torture/compile/20000728-1.c
new file mode 100644 (file)
index 0000000..f56d940
--- /dev/null
@@ -0,0 +1,16 @@
+struct clock {
+  long sec; long usec;
+};
+        
+int foo(void)
+{
+  struct clock clock_old = {0, 0};
+
+  for (;;) {
+    long foo;
+
+    if (foo == clock_old.sec && 0 == clock_old.usec);
+  }
+  return 0;
+}
+                                        
diff --git a/gcc/testsuite/gcc.c-torture/execute/20000801-1.c b/gcc/testsuite/gcc.c-torture/execute/20000801-1.c
new file mode 100644 (file)
index 0000000..1bc386e
--- /dev/null
@@ -0,0 +1,39 @@
+extern void abort(void);
+extern void exit(int);
+
+void
+foo (char *bp, unsigned n)
+{
+  register char c;
+  register char *ep = bp + n;
+  register char *sp;
+
+  while (bp < ep)
+    {
+      sp = bp + 3;
+      c = *sp;
+      *sp = *bp;
+      *bp++ = c;
+      sp = bp + 1;
+      c = *sp;
+      *sp = *bp;
+      *bp++ = c;
+      bp += 2;
+    }
+}
+
+int main(void)
+{
+  int one = 1;
+
+  if (sizeof(int) != 4 * sizeof(char))
+    exit(0);
+
+  foo((char *)&one, sizeof(one));
+  foo((char *)&one, sizeof(one));
+
+  if (one != 1)
+    abort();
+
+  exit(0);
+}
diff --git a/gcc/testsuite/gcc.c-torture/execute/20000801-2.c b/gcc/testsuite/gcc.c-torture/execute/20000801-2.c
new file mode 100644 (file)
index 0000000..5bb17b5
--- /dev/null
@@ -0,0 +1,40 @@
+extern void abort(void);
+extern void exit(int);
+int bar(void);
+int baz(void);
+
+struct foo {
+  struct foo *next;
+};
+
+struct foo *test(struct foo *node)
+{
+  while (node) {
+    if (bar() && !baz())
+      break;
+    node = node->next;
+  }
+  return node;
+}
+
+int bar (void)
+{
+  return 0;
+}
+
+int baz (void)
+{
+  return 0;
+}
+
+int main(void)
+{
+  struct foo a, b, *c;
+
+  a.next = &b;
+  b.next = (struct foo *)0;
+  c = test(&a);
+  if (c)
+    abort();
+  exit (0);
+}
diff --git a/gcc/testsuite/gcc.c-torture/execute/20000819-1.c b/gcc/testsuite/gcc.c-torture/execute/20000819-1.c
new file mode 100644 (file)
index 0000000..e1c2769
--- /dev/null
@@ -0,0 +1,17 @@
+int a[2] = { 2, 0 };
+
+void foo(int *sp, int cnt)
+{
+  int *p, *top;
+
+  top = sp; sp -= cnt;
+
+  for(p = sp; p <= top; p++)
+    if (*p < 2) exit(0);
+}
+
+int main()
+{
+  foo(a + 1, 1);
+  abort();
+}
diff --git a/gcc/testsuite/gcc.c-torture/execute/20000819-1.x b/gcc/testsuite/gcc.c-torture/execute/20000819-1.x
new file mode 100644 (file)
index 0000000..2f397b9
--- /dev/null
@@ -0,0 +1,2 @@
+set torture_execute_xfail "*-*-*"
+return 0
diff --git a/gcc/testsuite/gcc.dg/20000629-1.c b/gcc/testsuite/gcc.dg/20000629-1.c
new file mode 100644 (file)
index 0000000..b8c7f28
--- /dev/null
@@ -0,0 +1,13 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -g" } */
+
+void foo(register char *p)
+{
+  char c, *q, *sp;
+  while (1) {
+    *p++=0;
+    sp=p+1;
+    c=*sp;
+    *p++=0;
+  }
+}
diff --git a/gcc/testsuite/gcc.dg/20000724-1.c b/gcc/testsuite/gcc.dg/20000724-1.c
new file mode 100644 (file)
index 0000000..17d2e7e
--- /dev/null
@@ -0,0 +1,63 @@
+/* { dg-do run { target i?86-*-linux* } } */
+/* { dg-options "-O2 -fomit-frame-pointer" } */
+
+extern void abort (void);
+extern void exit (int);
+
+struct s {
+  struct { int a; } a;
+  int b;
+  struct { struct { int a; } a; struct t { struct t *a, *b; } b; } c;
+};
+
+int bar(int (*fn)(void *), void *arg, unsigned long flags)
+{
+  return 0;
+}
+
+int baz(void *x)
+{
+  return 0;
+}
+
+void do_check (struct s *) asm ("do_check") __attribute__((regparm(1)));
+
+void do_check(struct s *x)
+{
+  if (x->a.a || x->b || x->c.a.a)
+    abort();
+  if (x->c.b.a != &x->c.b || x->c.b.b != &x->c.b)
+    abort();
+}
+
+asm ("
+___checkme:
+  pushl %eax; pushl %ebx; pushl %ecx; pushl %edx; pushl %esi; pushl %edi; pushl $0; pushl $0
+  pushl $0; pushl $0; pushl $0; pushl $0; pushl $0; pushl $0; pushl $0; pushl $0
+  movl %ecx, %eax
+  call do_check
+  popl %eax; popl %eax; popl %eax; popl %eax; popl %eax; popl %eax; popl %eax; popl %eax
+  popl %eax; popl %eax; popl %edi; popl %esi; popl %edx; popl %ecx; popl %ebx; popl %eax
+  ret
+");
+
+extern inline void do_asm(struct s * x)
+{
+  asm volatile("call ___checkme" : : "c" (x) : "memory");
+}
+
+int foo(void)
+{
+  struct s x = { { 0 }, 0, { { 0 }, { &x.c.b, &x.c.b } } };
+  bar(baz, &x, 1);
+  do_asm(&x);
+  bar(baz, &x, 1);
+  do_asm(&x);
+  return 0;
+}
+
+int main()
+{
+  foo();
+  exit(0);
+}
diff --git a/gcc/testsuite/gcc.dg/20000807-1.c b/gcc/testsuite/gcc.dg/20000807-1.c
new file mode 100644 (file)
index 0000000..f654764
--- /dev/null
@@ -0,0 +1,37 @@
+/* { dg-do compile { target i?86-*-* } } */
+/* { dg-options "-Os -fpic" } */
+
+#include <string.h>
+
+typedef struct
+{
+  char *a;
+  char *b;
+} *foo;
+
+void
+bar (foo x)
+{
+  char *c = x->b;
+  char *d = (void *)0;
+  unsigned int e = 0, f = 0, g;
+  while (*c != ':')
+    if (*c == '%')
+      {
+        ++c;
+        switch (*c++)
+          {
+          case 'N':
+            g = strlen (x->a);
+            if (e + g >= f) {
+               char *h = d;
+               f += 256 + g;
+               d = (char *) __builtin_alloca (f);
+               memcpy (d, h, e);
+           };
+            memcpy (&d[e], x->a, g);
+            e += g;
+            break;
+         }
+      }
+}