aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/gcc.target/i386/20000724-1.c
diff options
context:
space:
mode:
authorBen Cheng <bccheng@google.com>2014-03-25 22:37:19 -0700
committerBen Cheng <bccheng@google.com>2014-03-25 22:37:19 -0700
commit1bc5aee63eb72b341f506ad058502cd0361f0d10 (patch)
treec607e8252f3405424ff15bc2d00aa38dadbb2518 /gcc-4.9/gcc/testsuite/gcc.target/i386/20000724-1.c
parent283a0bf58fcf333c58a2a92c3ebbc41fb9eb1fdb (diff)
downloadtoolchain_gcc-1bc5aee63eb72b341f506ad058502cd0361f0d10.tar.gz
toolchain_gcc-1bc5aee63eb72b341f506ad058502cd0361f0d10.tar.bz2
toolchain_gcc-1bc5aee63eb72b341f506ad058502cd0361f0d10.zip
Initial checkin of GCC 4.9.0 from trunk (r208799).
Change-Id: I48a3c08bb98542aa215912a75f03c0890e497dba
Diffstat (limited to 'gcc-4.9/gcc/testsuite/gcc.target/i386/20000724-1.c')
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.target/i386/20000724-1.c72
1 files changed, 72 insertions, 0 deletions
diff --git a/gcc-4.9/gcc/testsuite/gcc.target/i386/20000724-1.c b/gcc-4.9/gcc/testsuite/gcc.target/i386/20000724-1.c
new file mode 100644
index 000000000..e4acdd7e4
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.target/i386/20000724-1.c
@@ -0,0 +1,72 @@
+/* { dg-do run { target *-*-linux* *-*-gnu* } } */
+/* { dg-require-effective-target ia32 } */
+/* { 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 __attribute__((regparm(1))) 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();
+}
+
+#define NT "\n\t"
+
+asm ("\n"
+"___checkme:"
+NT "pushl %eax; pushl %ebx; pushl %ecx; pushl %edx; pushl %esi; pushl %edi"
+
+NT "pushl $0; pushl $0; pushl $0; pushl $0; pushl $0"
+NT "pushl $0; pushl $0; pushl $0; pushl $0; pushl $0"
+
+NT "movl %ecx, %eax"
+NT "call do_check"
+
+NT "popl %eax; popl %eax; popl %eax; popl %eax; popl %eax"
+NT "popl %eax; popl %eax; popl %eax; popl %eax; popl %eax"
+
+NT "popl %edi; popl %esi; popl %edx; popl %ecx; popl %ebx; popl %eax"
+NT "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);
+}