This is the mail archive of the
cygwin
mailing list for the Cygwin project.
gcc-3.4.4-1: c++: cmath: calling std::isnan results in endless loop
- From: Thomas Sailer <sailer at sailer dot dynip dot lugs dot ch>
- To: cygwin at cygwin dot com
- Date: Mon, 27 Feb 2006 15:40:17 +0100
- Subject: gcc-3.4.4-1: c++: cmath: calling std::isnan results in endless loop
When I try to call std::isnan(double) from a program compiled with g++
3.4.4, the program gets into an endless loop.
The problem is that gcc compiles
__gnu_cxx::isnan<double>(double) as a tail call to
__gnu_cxx::__capture_isnan<double>(double), and it compiles
__gnu_cxx::__capture_isnan<double>(double) to
__gnu_cxx::isnan<double>(double). It looks to me that this wrapping hack
(that is also in current glibc) only works if isnan is a macro. But on
cygwin, this isn't the case.
I'm using the patch below to work around this problem, but I'm not C++
language lawyer enough to know whether this fulfills all applicable
namespace purity standards...
Tom
--- cmath.orig 2006-02-27 15:15:05.101562500 +0100
+++ cmath 2006-02-27 15:18:51.882812500 +0100
@@ -455,10 +455,16 @@
int
__capture_isinf(_Tp __f) { return isinf(__f); }
+ using ::isnan;
+ using ::isnanf;
+
template<typename _Tp>
int
__capture_isnan(_Tp __f) { return isnan(__f); }
+ template<> int __capture_isnan<double>(double __f) { return ::isnan(__f); }
+ template<> int __capture_isnan<float>(float __f) { return ::isnanf(__f); }
+
template<typename _Tp>
int
__capture_isnormal(_Tp __f) { return isnormal(__f); }
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/