Hi
I've found a bug, in 8.0 and 8.1 related to libc.
I'm not sure this is mandrake related, but the bug doesn't appear on a redhat 
7.0

Here is the sample program:
--><--
#include <stdlib.h>

int main(){
  char chaine[]="1.0";
  double d=0;
  d=strtod(chaine,(char **)NULL);
};
--><--
the program is compiled with the default compiler, and linked with pthread
gcc -o prg -g test.cc -lpthread
Now debugging the program with gdb vers 5 (5.0, under 5.1 this is same)

(gdb) b 6
Breakpoint 1 at 0x804848c: file test.cc, line 6.
(gdb) r
Starting program: /home/manu/prg
[New Thread 1024 (LWP 28306)]
[Switching to Thread 1024 (LWP 28306)]

Breakpoint 1, main () at test.cc:6
6         d=strtod(chaine,(char **)NULL);
(gdb) print d
$1 = 0
(gdb) print chaine
$2 = "1.0"
(gdb) n
7       };
(gdb) print d
$3 = -nan(0x8000000000000)

so value from d isn't 1.0, but NaN.
I've looked at strtod source,
debbuging strtod show that "fraction=1e9 * frac1 +frac2"
is the failing line, with frac1=0 and frac2=1

all this doesn't appear if the program isn"t linked with pthread

I've tried this bug on mdk8.0 and 8.1 with mdk's RPM, and bug was present.
Under RH7.0, and debian woody, no bug.


If anyone can have a look at this ...

Reply via email to