2001-12-02 14:33:23

by Blindauer Emmanuel

[permalink] [raw]
Subject: what happened with thread, from 2.2 to 2.4 ?!

Hi
what happenned with thread from 2.2 to 2.4?
I have some problems with threaded programs, working under 2.2 and no more
under 2.4
The test program is short:
----
#include <stdlib.h>
void main() {
char *t="1.0";
double d=0;
d=strtod(t,(char **)NULL);
}
---
this program compiled with "gcc -g -lpthread test.c" has strange behaviour.
The problem only appear using gdb to see the value of d
In most case, the value returned by strtod under a 2.4 kernel is nan.
I say most, because some 2.4 kernels don't fail other this line.
I have done some test with differents distributions, and so differents
version of kernel, gcc, gdb and libc.
http://manu.agat.net/bug.html

When it was possible, for the computer with the bug, under an 2.4 kernel,
I've recompiled a 2.2.20, and the bug has disappeared!

Does someone have an idea about that ?


2001-12-02 15:43:11

by Manfred Spraul

[permalink] [raw]
Subject: Re: what happened with thread, from 2.2 to 2.4 ?!

>
> When it was possible, for the computer with the bug, under an 2.4 kernel,
> I've recompiled a 2.2.20, and the bug has disappeared!
>
Could you strace a gdb session for the same executable, with 2.2.20 and 2.4?

--
Manfred


2001-12-02 16:33:18

by David Relson

[permalink] [raw]
Subject: Re: what happened with thread, from 2.2 to 2.4 ?!

At 09:33 AM 12/2/01, you wrote:
>Hi
>what happenned with thread from 2.2 to 2.4?
>I have some problems with threaded programs, working under 2.2 and no more
>under 2.4
>The test program is short:
>----
>#include <stdlib.h>
>void main() {
> char *t="1.0";
> double d=0;
> d=strtod(t,(char **)NULL);
>}
>---
>this program compiled with "gcc -g -lpthread test.c" has strange behaviour.
>The problem only appear using gdb to see the value of d
>In most case, the value returned by strtod under a 2.4 kernel is nan.
>I say most, because some 2.4 kernels don't fail other this line.
>I have done some test with differents distributions, and so differents
>version of kernel, gcc, gdb and libc.
>http://manu.agat.net/bug.html
>
>When it was possible, for the computer with the bug, under an 2.4 kernel,
>I've recompiled a 2.2.20, and the bug has disappeared!
>
>Does someone have an idea about that ?

I verified your problem using 2.4.16 (with gdb-20010813(MI_OUT)) and
2.2.15pre18 (with gdb-4.18). Thinking about it, I remembered that in the
past there have been some problems with newer versions of gdb with threaded
programs. So, I tried using gdb-4.18 on 2.4.16 and it worked fine.

Methinks that this looks like a gdb issue.

As further testing I added a couple of statements after the strtod() call:
printf( "%f\n", d);
return;

If I step through the program, I see the nan value displayed by gdb and
also printed by printf(). If I put a breakpoint at the printf() and run
the program, the proper value is printed out. This looks a whole lot like
gdb is having a problem when stepping over the strtod() call.

I will forward a copy of this message to the gdb mailing list.

David

2001-12-04 18:43:10

by Gerold Jury

[permalink] [raw]
Subject: Re: what happened with thread, from 2.2 to 2.4 ?!

The kernel version may not be the reason for this.
glibc 2.2.1 or 2.2.2 had a problem which some uninitialised variables when
linked to pthread. (i think i can remember the strfmon call)
What is your glibc version ?

Gerold

On Sunday 02 December 2001 15:33, Blindauer Emmanuel wrote:
> Hi
> what happenned with thread from 2.2 to 2.4?
> I have some problems with threaded programs, working under 2.2 and no more
> under 2.4