[Libclc-dev] [PATCH] Define NAN as (0.0f / 0.0f)

Tom Stellard thomas.stellard at amd.com
Tue Sep 9 07:20:02 PDT 2014


We can't use __builtin_nanf(""), because string literals are in the
constant address space, and __builtin_nanf only accepts pointers
to values in the default address space.
---
 generic/include/clc/float/definitions.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/generic/include/clc/float/definitions.h b/generic/include/clc/float/definitions.h
index 329b623..6922dfd 100644
--- a/generic/include/clc/float/definitions.h
+++ b/generic/include/clc/float/definitions.h
@@ -1,7 +1,7 @@
 #define MAXFLOAT        0x1.fffffep127f
 #define HUGE_VALF       __builtin_huge_valf()
 #define INFINITY        __builtin_inff()
-#define NAN             __builtin_nanf("")
+#define NAN             (0.0f / 0.0f)
 
 #define FLT_DIG         6
 #define FLT_MANT_DIG    24
-- 
1.8.5.5





More information about the Libclc-dev mailing list