changeset 29547:85b400323b09

Fix test to work on IRIX 6.5 with cc.
author Bruno Haible <bruno@clisp.org>
date Wed, 02 Apr 2008 03:29:50 +0200
parents 4a0da4852e38
children f45408be6eca
files ChangeLog tests/test-math.c
diffstat 2 files changed, 18 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Wed Apr 02 03:23:43 2008 +0200
+++ b/ChangeLog	Wed Apr 02 03:29:50 2008 +0200
@@ -1,3 +1,9 @@
+2008-04-01  Bruno Haible  <bruno@clisp.org>
+
+	Fix test to work on IRIX 6.5 with cc.
+	* tests/test-math.c (numeric_equal): New function.
+	(main): Use it.
+
 2008-04-01  Bruno Haible  <bruno@clisp.org>
 
 	* doc/posix-headers/math.texi: Refine documentation of NAN problem.
--- a/tests/test-math.c	Wed Apr 02 03:23:43 2008 +0200
+++ b/tests/test-math.c	Wed Apr 02 03:29:50 2008 +0200
@@ -30,9 +30,20 @@
 static float n = NAN;
 #endif
 
+/* Compare two numbers with ==.
+   This is a separate function because IRIX 6.5 "cc -O" miscompiles an
+   'x == x' test.  */
+static int
+numeric_equal (double x, double y)
+{
+  return x == y;
+}
+
 int
 main ()
 {
   double d = NAN;
-  return d == d;
+  if (numeric_equal (d, d))
+    return 1;
+  return 0;
 }