[PATCH 21.11] examples/performance-thread: fix build with GCC 12

Kevin Traynor ktraynor at redhat.com
Thu Aug 25 11:55:45 CEST 2022


On 24/08/2022 14:55, David Marchand wrote:
> On Wed, Aug 24, 2022 at 11:58 AM Kevin Traynor <ktraynor at redhat.com> wrote:
>>
>> [1/2] Compiling C object examples/dpdk-pthrea...
>> formance-thread_pthread_shim_pthread_shim.c.o
>> ../examples/performance-thread/pthread_shim/pthread_shim.c:
>> In function ‘pthread_setspecific’:
>> ../examples/performance-thread/pthread_shim/pthread_shim.c:592:27:
>> warning: ‘data’ may be used uninitialized [-Wmaybe-uninitialized]
>> 592 |    int rv =  lthread_setspecific((unsigned int)key, data);
>>      |              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> ../examples/performance-thread/pthread_shim/pthread_shim.c:589:56:
>> note: accessing argument 2 of a function declared with attribute
>> ‘access (none, 2)’
>> 589 | int pthread_setspecific(pthread_key_t key, const void *data)
>>      |                                            ~~~~~~~~~~~~^~~~
>>
>> This is a false positive as pthread_setspecific() does not read from
>> the (const void *) so we can squash the warning.
>>
>> performance-thread example is already removed from DPDK main branch.
>>
>> Signed-off-by: Kevin Traynor <ktraynor at redhat.com>
> 
> Another workaround would be to redirect calls to pthread_setspecific
> to this function "overriden" function.
> The same is done for pthread_exit (see pthread_exit_override).
> 
> But otherwise this patch seems good enough.
> 
> 

ok, thanks. I'll just keep the current workaround as neither are 
particularly pretty and the example was dropped soon after 21.11, so I 
don't think anyone cares too much about it.



More information about the stable mailing list