aboutsummaryrefslogtreecommitdiff
path: root/libffi/testsuite
diff options
context:
space:
mode:
authorUros Bizjak <ubizjak@gmail.com>2007-03-24 08:13:17 +0100
committerUros Bizjak <uros@gcc.gnu.org>2007-03-24 08:13:17 +0100
commit34a6ccda5c83f44f27eb1f29408e40a3350dd9c8 (patch)
treea8035e754dff36a8bb9039fcf3d32243a9642617 /libffi/testsuite
parent653de3e34cc726e4c6a07d07abbf33e005b81036 (diff)
downloadgcc-34a6ccda5c83f44f27eb1f29408e40a3350dd9c8.zip
gcc-34a6ccda5c83f44f27eb1f29408e40a3350dd9c8.tar.gz
gcc-34a6ccda5c83f44f27eb1f29408e40a3350dd9c8.tar.bz2
return_fl2.c (return_fl): Mark as static.
* testsuite/libffi.call/return_fl2.c (return_fl): Mark as static. Use 'volatile float sum' to create sum of floats to avoid false negative due to excess precision on ix86 targets. (main): Ditto. From-SVN: r123180
Diffstat (limited to 'libffi/testsuite')
-rw-r--r--libffi/testsuite/libffi.call/return_fl2.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/libffi/testsuite/libffi.call/return_fl2.c b/libffi/testsuite/libffi.call/return_fl2.c
index 6df5b54..ddb976c 100644
--- a/libffi/testsuite/libffi.call/return_fl2.c
+++ b/libffi/testsuite/libffi.call/return_fl2.c
@@ -7,12 +7,13 @@
/* { dg-do run } */
#include "ffitest.h"
-/* To avoid a false negative on ix86 do not declare the return_fl static.
- See PR323.
-*/
-float return_fl(float fl1, float fl2, float fl3, float fl4)
+/* Use volatile float to avoid false negative on ix86. See PR target/323. */
+static float return_fl(float fl1, float fl2, float fl3, float fl4)
{
- return fl1 + fl2 + fl3 + fl4;
+ volatile float sum;
+
+ sum = fl1 + fl2 + fl3 + fl4;
+ return sum;
}
int main (void)
{
@@ -20,6 +21,7 @@ int main (void)
ffi_type *args[MAX_ARGS];
void *values[MAX_ARGS];
float fl1, fl2, fl3, fl4, rfl;
+ volatile float sum;
args[0] = &ffi_type_float;
args[1] = &ffi_type_float;
@@ -40,6 +42,8 @@ int main (void)
ffi_call(&cif, FFI_FN(return_fl), &rfl, values);
printf ("%f vs %f\n", rfl, return_fl(fl1, fl2, fl3, fl4));
- CHECK(rfl == fl1 + fl2 + fl3 + fl4);
+
+ sum = fl1 + fl2 + fl3 + fl4;
+ CHECK(rfl == sum);
exit(0);
}