isnan() causes segfault

Lev Bishop lev.bishop@gmail.com
Thu Nov 30 19:24:00 GMT 2006


On 11/30/06, Lev Bishop wrote:
> On 11/30/06, Eric Lilja wrote:
> > If compiled with:
> > $ g++ -Wall -Wextra -std=c++98 -pedantic -g isnantest.cpp -o run
> > (those are the flags we have been using in this course).
> > But it doesn't stackdump if compiled simply with:
> > $ make isnantest
> > g++     isnantest.cpp   -o isnantest
>
> I was able to reproduce this behaviour.
>
> There seems to be a difference in the generated assembler.
> The -std=c++98 seems to be the only switch that matters.
> Here is a diff. File isnantest2.s is the stackdumping one (ie the one
> with -std=c++98)

<snip>

And the cause of the failure seems to be mutual recursion in
/usr/lib/gcc/i686-pc-cygwin/3.4.4/include/c++/cmath

where at line 458:
  template<typename _Tp>
    int
    __capture_isnan(_Tp __f) { return isnan(__f); }

which calls at line 532:
  template<typename _Tp>
    int
    isnan(_Tp __f) { return __capture_isnan(__f); }

which calls back to __capture_isnan().

Incidentally, the stackdump file produced here is empty, so addr2line
can't help...

Lev

--
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/



More information about the Cygwin mailing list