Correction.

On my machine I get:
==30585== Possible data race during write of size 8 at 0x7ff0001d0 by thread
#2
==30585==    at 0x4C2C336: mythread_wrapper (hg_intercepts.c:211)
==30585==  This conflicts with a previous read of size 8 by thread #1
==30585==    at 0x4C2C227: pthread_create_WRK (hg_intercepts.c:246)
==30585==    by 0x4C2C2B9: pthread_cre...@* (hg_intercepts.c:268)
==30585==    by 0x40071A: main (in /tmp/main)

Ivan's report is
==12972== Possible data race during read of size 4 at 0xbecc119c by thread
#1
==12972==    at 0x40251FD: pthread_create_WRK (in
/usr/lib/valgrind/vgpreload_helgrind-x86-linux.so)
==12972==    by 0x80484D9: main (main.cpp:84)
....

and it is not suppressed because there is only this suppression:
{


   helgrind-glibc2X-112


   Helgrind:Race


   fun:pthread_create_WRK


   fun:pthread_cre...@*


}


--kcc

2010/9/8 Konstantin Serebryany <[email protected]>

> Hm. indeed, I see this too.
> Most likely, helgrind lacks a proper suppression.
>
> Julian,
> I can see this suppression:
> {
>
>
>    helgrind-glibc2X-102
>
>
>    Helgrind:Race
>
>
>    fun:mythread_wrapper
>
>
>    obj:/lib*/libpthread-2.*so*
>
>
> }
>
> but it doesn't match because for some reason the stack contains just one
> frame.
>
> --kcc
>
>
>
>
> 2010/9/8 Ivan S. Lyapunov <[email protected]>
>
> В Wed, 8 Sep 2010 17:12:46 +0400
>> Konstantin Serebryany <[email protected]> пишет:
>>
>> It still the same.
>>
>> gcc ./main.cpp -o main -g -pthread -D_REENTRANT -D_THREAD_SAFE -lpthread
>>
>> Regards,
>>  Ivan
>>
>> ==12972== Thread #1 is the program's root thread
>> ==12972==
>> ==12972== Thread #2 was created
>> ==12972==    at 0x41371F8: clone (in /lib/libc-2.12.1.so)
>> ==12972==    by 0x4054425: pthread_create@@GLIBC_2.1 (in /lib/
>> libpthread-2.12.1.so)
>> ==12972==    by 0x40251E1: pthread_create_WRK (in
>> /usr/lib/valgrind/vgpreload_helgrind-x86-linux.so)
>> ==12972==    by 0x80484D9: main (main.cpp:84)
>> ==12972==
>> ==12972== Possible data race during read of size 4 at 0xbecc119c by thread
>> #1
>> ==12972==    at 0x40251FD: pthread_create_WRK (in
>> /usr/lib/valgrind/vgpreload_helgrind-x86-linux.so)
>> ==12972==    by 0x80484D9: main (main.cpp:84)
>> ==12972==  This conflicts with a previous write of size 4 by thread #2
>> ==12972==    at 0x40252C9: mythread_wrapper (in
>> /usr/lib/valgrind/vgpreload_helgrind-x86-linux.so)
>> ==12972==    by 0x4053E5F: start_thread (in /lib/libpthread-2.12.1.so)
>> ==12972==    by 0x413720D: clone (in /lib/libc-2.12.1.so)
>> ==12972==
>> tra-la-la
>>
>>
>> > On Wed, Sep 8, 2010 at 5:02 PM, Ivan S. Lyapunov <[email protected]>
>> > wrote:
>> >
>> > > Hello.
>> > >
>> > >  I'm writed a simple pthreads program and can't understand Valgrind
>> > >  output because thre is no error in my case I think ;)
>> > >
>> > > #include <stdio.h>
>> > > #include <stdlib.h>
>> > > #include <unistd.h>
>> > > #include <pthread.h>
>> > >
>> > > extern "C" {
>> > >
>> > >        void * run_handle(void * param) {
>> > >        printf("tra-la-la\n");
>> > >        return 0;
>> > >    }
>> > > }
>> > >
>> > > int main(int argc, char** argv) {
>> > >    pthread_t t;
>> > >    pthread_create(&t, 0, run_handle, 0);
>> > >
>> > >    sleep(10);
>> > >    return 0;
>> > > }
>> > >
>> > >
>> > > compile it
>> > > gcc ./main.cpp -o main -pthread -D_REENTRANT -D_THREAD_SAFE
>> > > -lpthread
>> > >
>> >
>> > As the first step, try adding "-g" to the compile command.
>> >
>> > --kcc
>> >
>> >
>>
>
>
------------------------------------------------------------------------------
This SF.net Dev2Dev email is sponsored by:

Show off your parallel programming skills.
Enter the Intel(R) Threading Challenge 2010.
http://p.sf.net/sfu/intel-thread-sfd
_______________________________________________
Valgrind-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/valgrind-users

Reply via email to