From 554fd8c5195424bdbcabf5de30fdc183aba391bd Mon Sep 17 00:00:00 2001 From: upstream source tree Date: Sun, 15 Mar 2015 20:14:05 -0400 Subject: obtained gcc-4.6.4.tar.bz2 from upstream website; verified gcc-4.6.4.tar.bz2.sig; imported gcc-4.6.4 source tree from verified upstream tarball. downloading a git-generated archive based on the 'upstream' tag should provide you with a source tree that is binary identical to the one extracted from the above tarball. if you have obtained the source via the command 'git clone', however, do note that line-endings of files in your working directory might differ from line-endings of the respective files in the upstream repository. --- .../c-c++-common/dfp/func-vararg-mixed-2.c | 105 +++++++++++++++++++++ 1 file changed, 105 insertions(+) create mode 100644 gcc/testsuite/c-c++-common/dfp/func-vararg-mixed-2.c (limited to 'gcc/testsuite/c-c++-common/dfp/func-vararg-mixed-2.c') diff --git a/gcc/testsuite/c-c++-common/dfp/func-vararg-mixed-2.c b/gcc/testsuite/c-c++-common/dfp/func-vararg-mixed-2.c new file mode 100644 index 000000000..893cdae27 --- /dev/null +++ b/gcc/testsuite/c-c++-common/dfp/func-vararg-mixed-2.c @@ -0,0 +1,105 @@ +/* { dg-do run { target { { i?86-*-* x86_64-*-* } && ilp32 } } } */ +/* { dg-options "-mpreferred-stack-boundary=2" } */ + +/* C99 6.5.2.2 Function calls. + Test passing varargs of the combination of decimal float types and + other types. */ + +#include +#include "dfp-dbg.h" + +/* Supposing the list of varying number of arguments is: + unsigned int, _Decimal128, double, _Decimal32, _Decimal64. */ + +static _Decimal32 +vararg_d32 (unsigned arg, ...) +{ + va_list ap; + _Decimal32 result; + + va_start (ap, arg); + + va_arg (ap, unsigned int); + va_arg (ap, _Decimal128); + va_arg (ap, double); + result = va_arg (ap, _Decimal32); + + va_end (ap); + return result; +} + +static _Decimal32 +vararg_d64 (unsigned arg, ...) +{ + va_list ap; + _Decimal64 result; + + va_start (ap, arg); + + va_arg (ap, unsigned int); + va_arg (ap, _Decimal128); + va_arg (ap, double); + va_arg (ap, _Decimal32); + result = va_arg (ap, _Decimal64); + + va_end (ap); + return result; +} + +static _Decimal128 +vararg_d128 (unsigned arg, ...) +{ + va_list ap; + _Decimal128 result; + + va_start (ap, arg); + + va_arg (ap, unsigned int); + result = va_arg (ap, _Decimal128); + + va_end (ap); + return result; +} + +static unsigned int +vararg_int (unsigned arg, ...) +{ + va_list ap; + unsigned int result; + + va_start (ap, arg); + + result = va_arg (ap, unsigned int); + + va_end (ap); + return result; +} + +static double +vararg_double (unsigned arg, ...) +{ + va_list ap; + float result; + + va_start (ap, arg); + + va_arg (ap, unsigned int); + va_arg (ap, _Decimal128); + result = va_arg (ap, double); + + va_end (ap); + return result; +} + + +int +main () +{ + if (vararg_d32 (3, 0, 1.0dl, 2.0, 3.0df, 4.0dd) != 3.0df) FAILURE + if (vararg_d64 (4, 0, 1.0dl, 2.0, 3.0df, 4.0dd) != 4.0dd) FAILURE + if (vararg_d128 (1, 0, 1.0dl, 2.0, 3.0df, 4.0dd) != 1.0dl) FAILURE + if (vararg_int (0, 0, 1.0dl, 2.0, 3.0df, 4.0dd) != 0) FAILURE + if (vararg_double (2, 0, 1.0dl, 2.0, 3.0df, 4.0dd) != 2.0) FAILURE + + FINISH +} -- cgit v1.2.3