From 55419d8730e4b3cedea318c18d5a69ba0219bda0 Mon Sep 17 00:00:00 2001 From: Marius Hillenbrand Date: Tue, 1 Dec 2020 11:05:42 +0100 Subject: [PATCH] gcc/testsuite/s390: Add test cases for float_t Add two test cases that check for acceptable combinations of float_t and FLT_EVAL_METHOD on s390x. Tested against an as-is glibc and one modified so that it derives float_t from FLT_EVAL_METHOD. gcc/testsuite/ChangeLog: 2020-12-01 Marius Hillenbrand * gcc.target/s390/float_t-1.c: New test. * gcc.target/s390/float_t-2.c: New test. --- gcc/testsuite/gcc.target/s390/float_t-1.c | 15 +++++++++++++++ gcc/testsuite/gcc.target/s390/float_t-2.c | 13 +++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 gcc/testsuite/gcc.target/s390/float_t-1.c create mode 100644 gcc/testsuite/gcc.target/s390/float_t-2.c diff --git a/gcc/testsuite/gcc.target/s390/float_t-1.c b/gcc/testsuite/gcc.target/s390/float_t-1.c new file mode 100644 index 00000000000..3455694250f --- /dev/null +++ b/gcc/testsuite/gcc.target/s390/float_t-1.c @@ -0,0 +1,15 @@ +/* { dg-do run } */ +/* { dg-options "-std=c99" } */ +#include +#include + +int main() +{ + /* In standard-compliant mode, the size of float_t and FLT_EVAL_METHOD must + match. */ + if (sizeof(float_t) == sizeof(double) && __FLT_EVAL_METHOD__ != 1) + abort(); + if (sizeof(float_t) == sizeof(float) && __FLT_EVAL_METHOD__ != 0) + abort(); + return 0; +} diff --git a/gcc/testsuite/gcc.target/s390/float_t-2.c b/gcc/testsuite/gcc.target/s390/float_t-2.c new file mode 100644 index 00000000000..ebeda28b6d2 --- /dev/null +++ b/gcc/testsuite/gcc.target/s390/float_t-2.c @@ -0,0 +1,13 @@ +/* { dg-do run } */ +/* { dg-options "-std=gnu99" } */ +#include +#include + +int main() +{ + /* In gnuXY mode, the size of float_t and FLT_EVAL_METHOD must + match, with the historic exception of permitting double and 0. */ + if (sizeof(float_t) == sizeof(float) && __FLT_EVAL_METHOD__ == 1) + abort(); + return 0; +} -- 2.30.2