X-Spam-Check-By: sourceware.org Subject: gcc-3.4.4-1: c++: cmath: calling std::isnan results in endless loop From: Thomas Sailer To: cygwin AT cygwin DOT com Content-Type: text/plain Date: Mon, 27 Feb 2006 15:40:17 +0100 Message-Id: <1141051217.3656.14.camel@playstation2.hb9jnx.ampr.org> Mime-Version: 1.0 Content-Transfer-Encoding: 7bit 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: List-Archive: List-Post: List-Help: , 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) as a tail call to __gnu_cxx::__capture_isnan(double), and it compiles __gnu_cxx::__capture_isnan(double) to __gnu_cxx::isnan(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 int __capture_isnan(_Tp __f) { return isnan(__f); } + template<> int __capture_isnan(double __f) { return ::isnan(__f); } + template<> int __capture_isnan(float __f) { return ::isnanf(__f); } + template 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/