]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Backport:
authorKaveh R. Ghazi <ghazi@caip.rutgers.edu>
Tue, 26 Feb 2008 21:54:30 +0000 (21:54 +0000)
committerKaveh Ghazi <ghazi@gcc.gnu.org>
Tue, 26 Feb 2008 21:54:30 +0000 (21:54 +0000)
2007-03-24  Uros Bizjak  <ubizjak@gmail.com>

* 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: r132686

libffi/ChangeLog
libffi/testsuite/libffi.call/return_fl2.c

index 706beaeeefeb5151b0ef7a7d4a41c0fe85c22665..15381f08399e12876933d05209f77bb4f4bf384a 100644 (file)
@@ -1,3 +1,13 @@
+2008-02-26  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
+
+       Backport:
+       2007-03-24  Uros Bizjak  <ubizjak@gmail.com>
+       
+       * 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. 
+
 2008-02-01  Release Manager
 
        * GCC 4.2.3 released.
index 6df5b540985e81fc45d2579ef308aa52835ff241..ddb976cc2bbc71646330747a279f5c0db8635e74 100644 (file)
@@ -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);
 }