8sa1-gcc/gcc/testsuite/gcc.dg/20000724-1.c
Jakub Jelinek 46639003c8 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
2000-08-21 10:30:38 +02:00

64 lines
1.3 KiB
C

/* { 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);
}