Bug 20919 - Floating point functions in cmath (like isinf, isnan) recurse and cause stack overflow.
Summary: Floating point functions in cmath (like isinf, isnan) recurse and cause stack...
Status: RESOLVED DUPLICATE of bug 19322
Alias: None
Product: gcc
Classification: Unclassified
Component: libstdc++ (show other bugs)
Version: 3.4.2
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-04-09 19:28 UTC by Kenton Varda
Modified: 2005-07-23 22:49 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Kenton Varda 2005-04-09 19:28:52 UTC
from <cmath>
 458       template<typename _Tp> 
 459         int 
 460         __capture_isnan(_Tp __f) { return isnan(__f); }
 
 532       template<typename _Tp> 
 533         int 
 534         isnan(_Tp __f) { return __capture_isnan(__f); }

Now, on line 460, the "isnan" call refers to a macro.  However, that macro in
turn expands to call a function which is also named "isnan".  This ends up
calling the function as defined on line 534 (is this correct behavior?  I don't
know).

The result is, calling <cmath>'s isnan() causes infinite recursion and crashes
with a stack overflow.

Oopsies.

This bug is present in the version of GCC that comes with FreeBSD 5.3.
Comment 1 Andrew Pinski 2005-04-09 19:32:41 UTC

*** This bug has been marked as a duplicate of 19322 ***