20000606-1.c: New test.

* 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.

From-SVN: r35834
This commit is contained in:
Jakub Jelinek 2000-08-21 10:30:38 +02:00 committed by Jakub Jelinek
parent 461f200c26
commit 46639003c8
10 changed files with 249 additions and 0 deletions

View 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.

View File

@ -0,0 +1,10 @@
typedef struct _foo foo;
extern foo bar;
struct _foo {
int a;
};
void baz(void)
{
bar.a = 0;
}

View File

@ -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;
}

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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();
}

View File

@ -0,0 +1,2 @@
set torture_execute_xfail "*-*-*"
return 0

View File

@ -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;
}
}

View File

@ -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);
}

View File

@ -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;
}
}
}