GDB threading/FP bug

[email protected] (bennet)
Newsgroups gmane.comp.gdb.bugs.general
Organization http://groups.google.com/
Message-ID <[email protected]>
There's a floating point bug in GDB that occurs when debugging a
program with thread libraries linked in.  I've seen it occur with gcc
3.0.4/gdb5.0 3.1.1/gdb 5.2.1 and I believe also gcc 3.0.2/gdb
19991004.  As shown below, the first FP operation that GDB does is
turned into a NAN.  Subsequent operations succeed.  The non-gdb
execution is listed for comparison.  Anyone know if there's a few in
the works for this?  (I tried to search the newsgroup for relevant
reports but its hard to see through all the spam.)

-----------example test.cpp--------------------
#include <stdio.h>

void foo() {
    double bar = (double)0;
    printf("<< %f >>\n", bar);
}

int main() {
    foo();
    foo();
    return 0;
}
-----------example test.cpp--------------------

$ gdb -v
GNU gdb 5.2.1

$ gcc -v
Reading specs from /usr/local/lib/gcc-lib/i686-pc-linux-gnu/3.1.1/specs
Configured with: ./configure --enable-threads=posix
Thread model: posix
gcc version 3.1.1

$ echo run > gdbcmd && c++ -lpthread -o test test.cpp && gdb -x gdbcmd
-batch test && ./test
[New Thread 1024 (runnable)]
<< nan >>
<< 0.000000 >>

Program exited normally.
<< 0.000000 >>
<< 0.000000 >>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.