| delorie.com/archives/browse.cgi | search |
| X-Spam-Check-By: | sourceware.org |
| Subject: | 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 |
| Message-Id: | <1141051217.3656.14.camel@playstation2.hb9jnx.ampr.org> |
| Mime-Version: | 1.0 |
| X-Virus-Status: | Clean |
| X-DCC-spamcheck-01.tornado.cablecom.ch-Metrics: | smtp-06.tornado.cablecom.ch 32700; Body=1 Fuz1=1 Fuz2=1 |
| Mailing-List: | contact cygwin-help AT cygwin DOT com; run by ezmlm |
| List-Subscribe: | <mailto:cygwin-subscribe AT cygwin DOT com> |
| List-Archive: | <http://sourceware.org/ml/cygwin/> |
| List-Post: | <mailto:cygwin AT cygwin DOT com> |
| List-Help: | <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs> |
| Sender: | cygwin-owner AT cygwin DOT com |
| Mail-Followup-To: | cygwin AT cygwin DOT com |
| Delivered-To: | mailing list cygwin AT cygwin DOT com |
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/
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |