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.

-- 
           Summary: Floating point functions in cmath (like isinf, isnan)
                    recurse and cause stack overflow.
           Product: gcc
           Version: 3.4.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: temporal at gauge3d dot org
                CC: gcc-bugs at gcc dot gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20919

Reply via email to