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

David Marchand david.marchand at redhat.com
Wed Aug 24 15:55:54 CEST 2022


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.


-- 
David Marchand



More information about the stable mailing list