From 104cbaf5306c735ccc9f193f2b6a4e93df8a3165 Mon Sep 17 00:00:00 2001 From: "H.J. Lu" Date: Fri, 16 Oct 2015 20:03:17 +0000 Subject: [PATCH] Fix def_test_returning_type in iamcu/test_basic_returning.c Use union to check float return bits to avoid converting from integer to float when comparing float return value. * gcc.target/i386/iamcu/test_basic_returning.c (def_test_returning_type): Use union to check float return bits. From-SVN: r228924 --- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.target/i386/iamcu/test_basic_returning.c | 5 ++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index f56798cb925..90a2c66865b 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2015-10-16 H.J. Lu + + * gcc.target/i386/iamcu/test_basic_returning.c + (def_test_returning_type): Use union to check float return bits. + 2015-10-16 H.J. Lu * gcc.target/i386/iamcu/test_basic_64bit_returning.c (main): diff --git a/gcc/testsuite/gcc.target/i386/iamcu/test_basic_returning.c b/gcc/testsuite/gcc.target/i386/iamcu/test_basic_returning.c index 23efa6e5c01..e617d8dfc82 100644 --- a/gcc/testsuite/gcc.target/i386/iamcu/test_basic_returning.c +++ b/gcc/testsuite/gcc.target/i386/iamcu/test_basic_returning.c @@ -39,7 +39,10 @@ fun_test_returning_float (void) #define def_test_returning_type(fun, type, ret, reg) \ { type var = WRAP_RET (fun) (); \ - assert (ret == (type) reg && ret == var); } + union { type r; unsigned long reg; } u; \ + u.reg = reg; \ + assert (ret == u.r && ret == var); } + int main (void) { -- 2.30.2