[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
GDB threading/FP bug
From: |
bennet |
Subject: |
GDB threading/FP bug |
Date: |
7 Aug 2002 13:39:13 -0700 |
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 >>
- GDB threading/FP bug,
bennet <=