summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.target/i386/pr97032.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gcc.target/i386/pr97032.c')
-rw-r--r--gcc/testsuite/gcc.target/i386/pr97032.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.target/i386/pr97032.c b/gcc/testsuite/gcc.target/i386/pr97032.c
new file mode 100644
index 00000000000..7cbbe9bc22a
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr97032.c
@@ -0,0 +1,23 @@
+/* { dg-do compile { target { ia32 && fstack_protector } } } */
+/* { dg-options "-O2 -mincoming-stack-boundary=2 -fstack-protector-all" } */
+
+#include <stdarg.h>
+
+extern int *__errno_location (void);
+
+long
+sys_socketcall (int op, ...)
+{
+ long int res;
+ va_list ap;
+ va_start (ap, op);
+ asm volatile ("push %%ebx; movl %2, %%ebx; int $0x80; pop %%ebx"
+ /* { dg-warning "listing the stack pointer register" "" { target *-*-* } .-1 } */
+ : "=a" (res) : "0" (102), "ri" (16), "c" (ap) : "memory", "esp");
+ if (__builtin_expect (res > 4294963200UL, 0))
+ *__errno_location () = -res;
+ va_end (ap);
+ return res;
+}
+
+/* { dg-final { scan-assembler "call\[ \t\]*_?__errno_location" } } */