This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: Unexpected value-at for NULL'd pointer with pthreads
- From: Kyle Harper <kylejharper at gmail dot com>
- To: Jonathan Wakely <jwakely dot gcc at gmail dot com>
- Cc: Andrew Haley <aph at redhat dot com>, Jeffrey Walton <noloader at gmail dot com>, "gcc-help at gcc dot gnu dot org" <gcc-help at gcc dot gnu dot org>
- Date: Mon, 24 Aug 2015 08:28:12 -0700
- Subject: Re: Unexpected value-at for NULL'd pointer with pthreads
- Authentication-results: sourceware.org; auth=none
- References: <CAPcbWWxx3g9Uk9sn5jgG1GgmxSk1fjy5ybHKuRMzdKN3LJqt2Q at mail dot gmail dot com> <CAH8yC8nSNMGkbLWWcToBX6ZP5ygFFVqjKOmjq_pnvvFmfnxqSA at mail dot gmail dot com> <CAH6eHdSw84L3t9AqUjwGkvEU=4knZJvAod+d72OgusP0F5q0pA at mail dot gmail dot com> <CAPcbWWx-CQpJQvKHdHkObJ4wRv=9idRi1PaJuJ0nScMM7o6E_g at mail dot gmail dot com> <55DAD5B7 dot 90604 at redhat dot com> <CAPcbWWw8jv6kayXL-hZKOVhbMCQGoNNbT3e5j0hvYbPfPqfFBA at mail dot gmail dot com> <CAH6eHdSGfekLSX2rEksM_pg2rxPCW8Qu-YfxpU7La_bfMHEUaw at mail dot gmail dot com> <CAH6eHdQY+SqDe1djJz9iCab2w-TM_jO97VR+fYgox8QhbGzAtQ at mail dot gmail dot com>
>> You are nulling the local variable, not the array element it points to.
>
> In case that doesn't make the problem obvious: each thread executing
> start_routine has its own local variables.
>
That makes perfect sense. I'll incorporate the changes into the
simplified program and then into my main project and report back.
Sadly I knew about all the pass-by-value-only stuff and still missed
this even after hours of looking; thanks for the second set of eyes.