While trying to build GCC with uclibc instead of glibc I ran into a build
failure in libstdc++.  uclibc doesn't seem to provide the isfinite function
like glibc does so that means that libstdc++ doesn't have std::isfinite.

This in turn caused include/ext/random.tcc to not compile because it uses
std::isfinite.  I can easily see how this might be considered a uclibc
bug but given that it is the only build problem I ran into I was hoping
we could fix it in libstdc++ by using __builtin_finite instead of
std::isfinite.  This fixes my uclibc build and also worked for glibc
with no regressions.

OK to checkin?

Steve Ellcey
sell...@imgtec.com


2016-01-05  Steve Ellcey  <sell...@imgtec.com>

        * include/ext/random.tcc: Use __builtin_finite instead of
        std::isfinite.


diff --git a/libstdc++-v3/include/ext/random.tcc 
b/libstdc++-v3/include/ext/random.tcc
index a9c5a2b..3467823 100644
--- a/libstdc++-v3/include/ext/random.tcc
+++ b/libstdc++-v3/include/ext/random.tcc
@@ -1570,7 +1570,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
                              return __t; });
              __norm = std::sqrt(__sum);
            }
-         while (__norm == _RealType(0) || ! std::isfinite(__norm));
+         while (__norm == _RealType(0) || ! __builtin_finite(__norm));
 
          std::transform(__ret.begin(), __ret.end(), __ret.begin(),
                         [__norm](_RealType __val){ return __val / __norm; });

Reply via email to