https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102329

--- Comment #5 from Hugo van der Sanden <hv at crypt dot org> ---
(In reply to Martin Sebor from comment #4)
> For functions like pthread_getspecific() and pthread_setspecific() that do
> not access the object GCC provides attribute access none to suppress the
> warning:
> 
>   extern __attribute__ ((access (none, 1))) void f1 (const void *pointer);

Well that's not a solution for developers of perl, since these system headers
are not under our control. I'm not sure it's a solution right now for
developers of those system headers either, since adding the attribute yields a
different warning under slightly earlier versions of gcc, eg with gcc-9.2.1:
test.c:8:1: warning: 'access' attribute directive ignored [-Wattributes]
    8 | extern int pthread_setspecific (unsigned int key, const void *pointer)
__attribute__ ((access (none, 2)));
      | ^~~~~~

I think we still find the original sort of maybe-uninitialized warnings useful,
so we'll probably just do the useless initialization, and the code will run a
bit slower under gcc.

Reply via email to