[Beignet] Fix definition of FLT_MIN/FLT_MAX for clang-3.8 compilation

Andrew Lavin aj.lavin at gmail.com
Thu May 26 16:22:34 UTC 2016


>From 4604f4b55ada846913c744895d40335ce0f133d7 Mon Sep 17 00:00:00 2001
From: Andrew Lavin <alavin at acm.org>
Date: Thu, 26 May 2016 09:12:09 -0700
Subject: [PATCH] Changed ldexp to ldexpf when defining float min/max.

---
 utests/builtin_exp.cpp    | 2 +-
 utests/utest_generator.py | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/utests/builtin_exp.cpp b/utests/builtin_exp.cpp
index 1eaa187..6d51c33 100644
--- a/utests/builtin_exp.cpp
+++ b/utests/builtin_exp.cpp
@@ -5,7 +5,7 @@
 #define udebug 0

 #define FLT_MAX 0x1.fffffep127f
-#define FLT_MIN ldexp(1.0,-126)
+#define FLT_MIN ldexpf(1.0,-126)
 #define FLT_ULP  (1.0e-6f)

 #define printf_c(...) \
diff --git a/utests/utest_generator.py b/utests/utest_generator.py
index 38d9ea0..cde2dbe 100644
--- a/utests/utest_generator.py
+++ b/utests/utest_generator.py
@@ -4,8 +4,8 @@ import os,sys,re

 FLT_MAX_POSI='0x1.fffffep127f'
 FLT_MIN_NEGA='-0x1.fffffep127f'
-FLT_MIN_POSI='ldexp(1.0, -126)'
-FLT_MAX_NEGA='ldexp(-1.0, -126)'
+FLT_MIN_POSI='ldexpf(1.0, -126)'
+FLT_MAX_NEGA='ldexpf(-1.0, -126)'

 paraTypeList={'float':'%e','int':'%d','double':'%lf','uint':'%d','string':'%s'}

-- 
2.7.4


On Thu, May 26, 2016 at 9:18 AM, Andrew Lavin <aj.lavin at gmail.com> wrote:

> Using clang-3.8, I need the attached patch in order to compile beignet.
> Otherwise I get lots of errors that look like:
>
> /home/andrew/Downloads/beignet-intel_subgroups/utests/builtin_exp.cpp:18:48:
> error:
>       non-constant-expression cannot be narrowed from type 'double' to
> 'float' in initializer list
>       [-Wc++11-narrowing]
> const float input_data[] = {FLT_MAX, -FLT_MAX, FLT_MIN, -FLT_MIN, 80, -80,
> 3.14, -3.14, -0.5, 0.5, ...
>
> - Andrew
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/beignet/attachments/20160526/7e9d458b/attachment.html>


More information about the Beignet mailing list