This is the mail archive of the gdb-prs@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

gdb/178: Floating Point NaN on first fp operation when compiling with -lpthread



>Number:         178
>Category:       gdb
>Synopsis:       Floating Point NaN on first fp operation when compiling with -lpthread
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Jul 23 12:48:01 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator:     Marius VLAD (Digital Media Institute, Tampere Univ. of Technology, FINLAND)
>Release:        gdb-5.0
>Organization:
>Environment:
Linux Mandrake 8.0
Linux cookie.dmi.tut.fi 2.4.2-15mdk #1 Wed Mar 14 12:15:14 CET 2001 i686 unknown
Intel P3 800Mhz
256MB RAM (DRAM 400Mhz)
gcc 2.96 (gcc-gcc-2.96-0.44mdk)
gdb 5.0 (gdb-5.0-10mdk)
glibc (glibc-2.2.2-4mdk)
>Description:
I get a strange NAN value when running a program in gdb somewhere 
around first floating point operation, and this only occure
if I compile the program with -lpthread...
For example:
$cat test.cpp
#include <stdio.h>
int main()
{
  float f=1.0;
  printf("f=%5.3f\n",f);
  printf("f=%5.3f\n",f);
  return 0;
}
$ gcc -g -lpthread test.cpp
$ ./a.out
f=1.000
f=1.000
$ gdb a.out
GNU gdb 5.0
Copyright 2000 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i386-mandrake-linux"...
(gdb) run
Starting program: /home/marius/work/VideoServer/a.out
[New Thread 1024 (LWP 4524)]
f=  nan
f=1.000

Program exited normally.
Current language:  auto; currently c
(gdb) b main
Breakpoint 1 at 0x8048476: file test.cpp, line 4.
(gdb) run
Starting program: /home/marius/work/VideoServer/a.out
[New Thread 1024 (LWP 4526)]
[Switching to Thread 1024 (LWP 4526)]

Breakpoint 1, main () at test.cpp:4
4         float f=1.0;
Current language:  auto; currently c++
(gdb) n
5         printf("f=%5.3f\n",f);
(gdb) p f
$1 = 1
(gdb) n
f=  nan
6         printf("f=%5.3f\n",f);
(gdb) p f
$2 = 1
(gdb) n
f=  nan
7         return 0;
(gdb) n
8       }
(gdb) n
0x400570de in __libc_start_main () from /lib/libc.so.6
(gdb) n
Single stepping until exit from function __libc_start_main,
which has no line number information.

Program exited normally.
(gdb)

>How-To-Repeat:
the error is persistent ...
>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: application/octet-stream; name="test.cpp"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="test.cpp"

I2luY2x1ZGUgPHN0ZGlvLmg+CmludCBtYWluKCkKewogIGZsb2F0IGY9MS4wOwogIGludCBpPShp
bnQpZjsKICBwcmludGYoImk9JWRcbiIsaSk7CiAgcHJpbnRmKCJmPSU1LjNmXG4iLGYpOwogIHBy
aW50ZigiZj0lNS4zZlxuIixmKTsKICByZXR1cm4gMDsKfQo=


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]