diff options
author | Willem <willem@lekkertech.net> | 2014-10-09 22:20:19 -0700 |
---|---|---|
committer | Willem <willem@lekkertech.net> | 2014-10-09 23:25:46 -0700 |
commit | a026ae1b03feae10179816acb3c7d36e83547d4c (patch) | |
tree | 03e7590b98ce3af8d6ca5529efd23f9a4c03a817 /test | |
parent | 10b800db2c0639399ca2bdc041959519c54f89e5 (diff) | |
download | klee-a026ae1b03feae10179816acb3c7d36e83547d4c.tar.gz |
Add (currently failing) test to check for correct long double alignment in varargs on x86_64.
Diffstat (limited to 'test')
-rw-r--r-- | test/Feature/VarArgLongDouble.c | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/test/Feature/VarArgLongDouble.c b/test/Feature/VarArgLongDouble.c new file mode 100644 index 00000000..189d1dcc --- /dev/null +++ b/test/Feature/VarArgLongDouble.c @@ -0,0 +1,43 @@ +// RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t.bc +// RUN: rm -rf %t.klee-out +// RUN: %klee --output-dir=%t.klee-out %t.bc | FileCheck %s +// XFAIL: + +#include <stdarg.h> +#include <assert.h> +#include <stdio.h> + +void ld_after_zero(int first,...) +{ + va_list ap; + long double dub; + + va_start(ap, first); + + while (va_arg(ap, int) != 0) + ; + + dub = va_arg(ap, long double); + + printf("%Lf\n", dub); + +} + +int main() { + long double dub = 1.123456; + int zero = 0; + int one = 1; + + // AMD64-ABI 3.5.7p5: Step 7. Align l->overflow_arg_area upwards to a 16 + // byte boundary if alignment needed by type exceeds 8 byte boundary. + // + // the long double dub requires 16 byte alignment. + // we try passing one,zero and one, one, zero + // at least on those will align dub such that it needs the extra alignment + ld_after_zero(one, zero, dub); + // CHECK: 1.123456 + ld_after_zero(one, one, zero, dub); + // CHECK-NEXT: 1.123456 + + return 0; +} |