summaryrefslogtreecommitdiff
path: root/testsuite
diff options
context:
space:
mode:
authorRichard Henderson <rth@twiddle.net>2014-11-05 16:33:44 +0100
committerRichard Henderson <rth@twiddle.net>2014-11-12 09:15:35 +0100
commitfc501750f41e2ee7f4268f490f590ce97a25a818 (patch)
treecd6dd8673c8c5d3bc1df6ba2ab5a19ab28960cfe /testsuite
parent610c90bf7131de70318dc981a529a63ae36981b8 (diff)
downloadlibffi-fc501750f41e2ee7f4268f490f590ce97a25a818.tar.gz
testsuite: Fix return_complex2 vs excessive precision
Use the previously computed rc2 to validate, rather than recomputing a floating point result with excess precision.
Diffstat (limited to 'testsuite')
-rw-r--r--testsuite/libffi.call/return_complex2.inc10
1 files changed, 7 insertions, 3 deletions
diff --git a/testsuite/libffi.call/return_complex2.inc b/testsuite/libffi.call/return_complex2.inc
index dad4a0f..265170b 100644
--- a/testsuite/libffi.call/return_complex2.inc
+++ b/testsuite/libffi.call/return_complex2.inc
@@ -2,10 +2,14 @@
#include "ffitest.h"
#include <complex.h>
-static _Complex T_C_TYPE return_c(_Complex T_C_TYPE c1, _Complex T_C_TYPE c2, unsigned int in3, _Complex T_C_TYPE c4)
+_Complex T_C_TYPE
+return_c(_Complex T_C_TYPE c1, _Complex T_C_TYPE c2,
+ unsigned int in3, _Complex T_C_TYPE c4)
{
- return c1 + c2 + in3 + c4;
+ volatile _Complex T_C_TYPE r = c1 + c2 + in3 + c4;
+ return r;
}
+
int main (void)
{
ffi_cif cif;
@@ -35,6 +39,6 @@ int main (void)
printf ("%f,%fi vs %f,%fi\n",
T_CONV creal (rc), T_CONV cimag (rc),
T_CONV creal (rc2), T_CONV cimag (rc2));
- CHECK(rc == c1 + c2 + in3 + c4);
+ CHECK(rc == rc2);
exit(0);
}