public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libgomp/99984] New: bootstrap failure on uclibc for libgomp. error: 'local_thr' may be used uninitialized [-Werror=maybe-uninitialized]
@ 2021-04-09  5:53 unlvsur at live dot com
  2021-04-09  6:06 ` [Bug libgomp/99984] " unlvsur at live dot com
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: unlvsur at live dot com @ 2021-04-09  5:53 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 99984
           Summary: bootstrap failure on uclibc for libgomp. error:
                    'local_thr' may be used uninitialized
                    [-Werror=maybe-uninitialized]
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libgomp
          Assignee: unassigned at gcc dot gnu.org
          Reporter: unlvsur at live dot com
                CC: jakub at gcc dot gnu.org
  Target Milestone: ---

Makefile:873: warning: overriding recipe for target 'all-multi'
Makefile:864: warning: ignoring old recipe for target 'all-multi'
Makefile:873: warning: overriding recipe for target 'all-multi'
Makefile:864: warning: ignoring old recipe for target 'all-multi'
Makefile:873: warning: overriding recipe for target 'all-multi'
Makefile:864: warning: ignoring old recipe for target 'all-multi'
../../../../gcc/libgomp/team.c: In function 'gomp_thread_start':
../../../../gcc/libgomp/team.c:81:3: error: 'local_thr' may be used
uninitialized [-Werror=maybe-uninitialized]
   81 |   pthread_setspecific (gomp_tls_key, thr);
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ../../../../gcc/libgomp/libgomp.h:50,
                 from ../../../../gcc/libgomp/team.c:29:
D:/msys64/x86_64-linux-uclibc/x86_64-linux-uclibc/include/pthread.h:595:12:
note: by argument 2 of type 'const void *' to 'pthread_setspecific' declared
here
  595 | extern int pthread_setspecific (pthread_key_t __key,
      |            ^~~~~~~~~~~~~~~~~~~
../../../../gcc/libgomp/team.c:79:22: note: 'local_thr' declared here
   79 |   struct gomp_thread local_thr;
      |                      ^~~~~~~~~
cc1.exe: all warnings being treated as errors
make[4]: *** [Makefile:798: team.lo] Error 1
make[3]: *** [Makefile:1021: all-recursive] Error 1
make[2]: *** [Makefile:622: all] Error 2
make[1]: *** [Makefile:16010: all-target-libgomp] Error 2
make[1]: *** Waiting for unfinished jobs....
make: *** [Makefile:976: all] Error 2

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug libgomp/99984] bootstrap failure on uclibc for libgomp. error: 'local_thr' may be used uninitialized [-Werror=maybe-uninitialized]
  2021-04-09  5:53 [Bug libgomp/99984] New: bootstrap failure on uclibc for libgomp. error: 'local_thr' may be used uninitialized [-Werror=maybe-uninitialized] unlvsur at live dot com
@ 2021-04-09  6:06 ` unlvsur at live dot com
  2021-04-09  8:23 ` cvs-commit at gcc dot gnu.org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: unlvsur at live dot com @ 2021-04-09  6:06 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from cqwrteur <unlvsur at live dot com> ---
Created attachment 50533
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=50533&action=edit
Demo patch

I tried to initialize this struct in libgomp and the build of GCC succeed.
Strange. I do not know what's happening here tbh.

I do not know whether initialize this struct would incur performance overhead.

BTW, Jakub, I did not add you to the CC List. The system adds you in the list
by default.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug libgomp/99984] bootstrap failure on uclibc for libgomp. error: 'local_thr' may be used uninitialized [-Werror=maybe-uninitialized]
  2021-04-09  5:53 [Bug libgomp/99984] New: bootstrap failure on uclibc for libgomp. error: 'local_thr' may be used uninitialized [-Werror=maybe-uninitialized] unlvsur at live dot com
  2021-04-09  6:06 ` [Bug libgomp/99984] " unlvsur at live dot com
@ 2021-04-09  8:23 ` cvs-commit at gcc dot gnu.org
  2021-04-09  8:24 ` unlvsur at live dot com
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-04-09  8:23 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jakub Jelinek <jakub@gcc.gnu.org>:

https://gcc.gnu.org/g:8cc863ca8f48662e9c9339710fa303587479bf71

commit r11-8075-g8cc863ca8f48662e9c9339710fa303587479bf71
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Fri Apr 9 10:18:47 2021 +0200

    libgomp: Silence false positive -Wmaybe-uninitialized warning [PR99984]

    pthread_setspecific second argument is const void *, so that one can
    call it even with pointers to const, but the function only stores the
    pointer and does nothing else, so the new assumption of
-Wmaybe-uninitialized
    that functions taking such pointers will read from what those pointers
    will point to is wrong.  Maybe it would be useful to have some whitelist
    of functions that surely don't do that.

    Anyway, in this case it is easy to workaround the warning by moving the
    pthread_setspecific call after the initialization without slowing anything
    down.

    2021-04-09  Jakub Jelinek  <jakub@redhat.com>

            PR libgomp/99984
            * team.c (gomp_thread_start): Call pthread_setspecific for
            !(defined HAVE_TLS || defined USE_EMUTLS) only after local_thr
            has been initialized to avoid false positive warning.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug libgomp/99984] bootstrap failure on uclibc for libgomp. error: 'local_thr' may be used uninitialized [-Werror=maybe-uninitialized]
  2021-04-09  5:53 [Bug libgomp/99984] New: bootstrap failure on uclibc for libgomp. error: 'local_thr' may be used uninitialized [-Werror=maybe-uninitialized] unlvsur at live dot com
  2021-04-09  6:06 ` [Bug libgomp/99984] " unlvsur at live dot com
  2021-04-09  8:23 ` cvs-commit at gcc dot gnu.org
@ 2021-04-09  8:24 ` unlvsur at live dot com
  2021-04-09 16:30 ` msebor at gcc dot gnu.org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: unlvsur at live dot com @ 2021-04-09  8:24 UTC (permalink / raw)
  To: gcc-bugs

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

cqwrteur <unlvsur at live dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|UNCONFIRMED                 |RESOLVED

--- Comment #3 from cqwrteur <unlvsur at live dot com> ---
Thank you jakub

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug libgomp/99984] bootstrap failure on uclibc for libgomp. error: 'local_thr' may be used uninitialized [-Werror=maybe-uninitialized]
  2021-04-09  5:53 [Bug libgomp/99984] New: bootstrap failure on uclibc for libgomp. error: 'local_thr' may be used uninitialized [-Werror=maybe-uninitialized] unlvsur at live dot com
                   ` (2 preceding siblings ...)
  2021-04-09  8:24 ` unlvsur at live dot com
@ 2021-04-09 16:30 ` msebor at gcc dot gnu.org
  2021-04-09 17:21 ` unlvsur at live dot com
  2021-04-09 17:39 ` msebor at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: msebor at gcc dot gnu.org @ 2021-04-09 16:30 UTC (permalink / raw)
  To: gcc-bugs

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

Martin Sebor <msebor at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |msebor at gcc dot gnu.org
                URL|                            |https://sourceware.org/bugz
                   |                            |illa/show_bug.cgi?id=27714

--- Comment #4 from Martin Sebor <msebor at gcc dot gnu.org> ---
The following Glibc bug calls for suppressing the warning by adding attribute
access none to the function declaration:
https://sourceware.org/bugzilla/show_bug.cgi?id=27714

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug libgomp/99984] bootstrap failure on uclibc for libgomp. error: 'local_thr' may be used uninitialized [-Werror=maybe-uninitialized]
  2021-04-09  5:53 [Bug libgomp/99984] New: bootstrap failure on uclibc for libgomp. error: 'local_thr' may be used uninitialized [-Werror=maybe-uninitialized] unlvsur at live dot com
                   ` (3 preceding siblings ...)
  2021-04-09 16:30 ` msebor at gcc dot gnu.org
@ 2021-04-09 17:21 ` unlvsur at live dot com
  2021-04-09 17:39 ` msebor at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: unlvsur at live dot com @ 2021-04-09 17:21 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from cqwrteur <unlvsur at live dot com> ---
(In reply to Martin Sebor from comment #4)
> The following Glibc bug calls for suppressing the warning by adding
> attribute access none to the function declaration:
> https://sourceware.org/bugzilla/show_bug.cgi?id=27714

well. this is an issue related to uclibc. Not glibc nor musl nor bionic.

I built glibc on windows, no issue at all tbh.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug libgomp/99984] bootstrap failure on uclibc for libgomp. error: 'local_thr' may be used uninitialized [-Werror=maybe-uninitialized]
  2021-04-09  5:53 [Bug libgomp/99984] New: bootstrap failure on uclibc for libgomp. error: 'local_thr' may be used uninitialized [-Werror=maybe-uninitialized] unlvsur at live dot com
                   ` (4 preceding siblings ...)
  2021-04-09 17:21 ` unlvsur at live dot com
@ 2021-04-09 17:39 ` msebor at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: msebor at gcc dot gnu.org @ 2021-04-09 17:39 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from Martin Sebor <msebor at gcc dot gnu.org> ---
The same change should be made there (in uclibc).  FWIW, I looked for a bug
database to report the problem there but, AFAICS, uclibc-ng is the currently
maintained fork, but it has no bug database (https://bugs.uclibc.org looks like
the old one).  If you know where to report bugs I'd suggest you open a request
there.

Short of changing the upstream headers, the two alternatives to avoid this
problem in GCC that come to mind are: 1) add a pthread_setspecific declaration
with the attribute to GCC source code, or 2) add a pthread_setspecific built-in
to GCC.

(But I mention all this to raise awareness of the problem and the available
suppression mechanism, not to lecture anyone.  If you don't find it helpful
feel free to disregard it.)

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2021-04-09 17:39 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-09  5:53 [Bug libgomp/99984] New: bootstrap failure on uclibc for libgomp. error: 'local_thr' may be used uninitialized [-Werror=maybe-uninitialized] unlvsur at live dot com
2021-04-09  6:06 ` [Bug libgomp/99984] " unlvsur at live dot com
2021-04-09  8:23 ` cvs-commit at gcc dot gnu.org
2021-04-09  8:24 ` unlvsur at live dot com
2021-04-09 16:30 ` msebor at gcc dot gnu.org
2021-04-09 17:21 ` unlvsur at live dot com
2021-04-09 17:39 ` msebor at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).