This is the mail archive of the
gdb@sources.redhat.com
mailing list for the GDB project.
Re: Problem with threaded program
- From: Kevin Buettner <kevinb at redhat dot com>
- To: David Relson <relson at osagesoftware dot com>, gdb at sources dot redhat dot com
- Date: Thu, 6 Dec 2001 17:03:57 -0700
- Subject: Re: Problem with threaded program
- References: <4.3.2.7.2.20011202114313.00c40ab0@mail.osagesoftware.com>
On Dec 2, 11:44am, David Relson wrote:
> Here's the test program, test.c:
>
> #include <stdlib.h>
> int main() {
> char *t="1.0";
> double d=0;
> d=strtod(t,(char **)NULL);
> printf( "%f\n", d );
> return 0;
> }
>
> Build using "gcc -g -lpthread test.c"; run using "gdb a.out".
>
> If you step through the program one line at a time and display variable d
> after each assignment, the strtod() call seems to return
> "nan(0x8000000000000)", which is also shown by print().
>
> If you restart the program with a breakpoint at printf(), let it run, and
> display d at the breakpoint, the value shown is "1.000000" which is correct.
>
> Is this a defect in gdb, or is my analysis wrong?
It's a defect in gdb.
I've just posted a patch which fixes this bug. See
http://sources.redhat.com/ml/gdb-patches/2001-12/msg00183.html
It hasn't been approved yet, but once it has, I'll push for getting
it into 5.1.1 too.
Thanks,
Kevin