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

Matt Arsenault arsenm2 at gmail.com
Tue Sep 9 10:20:48 PDT 2014


On Sep 9, 2014, at 10:20 AM, Tom Stellard <thomas.stellard at amd.com> wrote:

> 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.

This really should be fixed in clang and not worked around in the library



> ---
> 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
> 
> 
> _______________________________________________
> Libclc-dev mailing list
> Libclc-dev at pcc.me.uk
> http://www.pcc.me.uk/cgi-bin/mailman/listinfo/libclc-dev





More information about the Libclc-dev mailing list