diff options
author | Ben Cheng <bccheng@google.com> | 2014-03-25 22:37:19 -0700 |
---|---|---|
committer | Ben Cheng <bccheng@google.com> | 2014-03-25 22:37:19 -0700 |
commit | 1bc5aee63eb72b341f506ad058502cd0361f0d10 (patch) | |
tree | c607e8252f3405424ff15bc2d00aa38dadbb2518 /gcc-4.9/gcc/testsuite/gcc.target/i386/pr59644.c | |
parent | 283a0bf58fcf333c58a2a92c3ebbc41fb9eb1fdb (diff) | |
download | toolchain_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/pr59644.c')
-rw-r--r-- | gcc-4.9/gcc/testsuite/gcc.target/i386/pr59644.c | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/gcc-4.9/gcc/testsuite/gcc.target/i386/pr59644.c b/gcc-4.9/gcc/testsuite/gcc.target/i386/pr59644.c new file mode 100644 index 000000000..96006b3e3 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.target/i386/pr59644.c @@ -0,0 +1,42 @@ +/* PR target/59644 */ +/* { dg-do run { target lp64 } } */ +/* { dg-options "-O2 -ffreestanding -mno-sse -mpreferred-stack-boundary=3 -maccumulate-outgoing-args -mno-red-zone" } */ + +/* This test uses __builtin_trap () instead of e.g. abort, + because due to -mpreferred-stack-boundary=3 it should not call + any library function from within main (). */ + +#include <stdarg.h> + +__attribute__((noinline, noclone)) +int +bar (int x, int y, int z, int w, const char *fmt, va_list ap) +{ + if (x != 1 || y != 2 || z != 3 || w != 4) + __builtin_trap (); + if (fmt[0] != 'f' || fmt[1] != 'o' || fmt[2] != 'o' || fmt[3]) + __builtin_trap (); + if (va_arg (ap, int) != 5 || va_arg (ap, int) != 6 + || va_arg (ap, long long) != 7LL) + __builtin_trap (); + return 9; +} + +__attribute__((noinline, noclone, optimize ("Os"))) +int +foo (const char *fmt, ...) +{ + va_list ap; + va_start (ap, fmt); + int r = bar (1, 2, 3, 4, fmt, ap); + va_end (ap); + return r; +} + +int +main () +{ + if (foo ("foo", 5, 6, 7LL) != 9) + __builtin_trap (); + return 0; +} |