public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libgomp/67141] New: wrong libgomp mutex initialisation order
@ 2015-08-06 21:47 mattiase at acm dot org
  2015-08-11 17:33 ` [Bug libgomp/67141] " xantares09 at hotmail dot com
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: mattiase at acm dot org @ 2015-08-06 21:47 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 67141
           Summary: wrong libgomp mutex initialisation order
           Product: gcc
           Version: 5.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libgomp
          Assignee: unassigned at gcc dot gnu.org
          Reporter: mattiase at acm dot org
                CC: jakub at gcc dot gnu.org
  Target Milestone: ---

Libgomp may use a mutex, acc_device_lock, prior to initialising it depending on
the constructor calling order: it is initialised in initialize_env and used in
goacc_host_init, both declared __attribute__ ((constructor)) but in different
files.

This was discovered on Windows after a change to the pthread library in
mingw-w64, making all-zero an invalid mutex value. Apparently the constructors
were called in the "wrong" order, and pthread_mutex_lock called before
pthread_mutex_init.


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

* [Bug libgomp/67141] wrong libgomp mutex initialisation order
  2015-08-06 21:47 [Bug libgomp/67141] New: wrong libgomp mutex initialisation order mattiase at acm dot org
@ 2015-08-11 17:33 ` xantares09 at hotmail dot com
  2015-08-12  8:01 ` xantares09 at hotmail dot com
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: xantares09 at hotmail dot com @ 2015-08-11 17:33 UTC (permalink / raw)
  To: gcc-bugs

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

xantares09 at hotmail dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |xantares09 at hotmail dot com

--- Comment #1 from xantares09 at hotmail dot com ---
Created attachment 36169
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=36169&action=edit
call initialize_env before goacc_host_init

I can reproduce here:
err:module:attach_process_dlls "libgomp-1.dll" failed to initialize, aborting

Mattias is totally right:
if i assign a higher initialization priority to env.c:initialize_env than
oacc-host.c:goacc_host_init the dll is correctly initialized

the patch may not be ok, but you get the idea


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

* [Bug libgomp/67141] wrong libgomp mutex initialisation order
  2015-08-06 21:47 [Bug libgomp/67141] New: wrong libgomp mutex initialisation order mattiase at acm dot org
  2015-08-11 17:33 ` [Bug libgomp/67141] " xantares09 at hotmail dot com
@ 2015-08-12  8:01 ` xantares09 at hotmail dot com
  2015-08-24 18:42 ` jakub at gcc dot gnu.org
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: xantares09 at hotmail dot com @ 2015-08-12  8:01 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from xantares09 at hotmail dot com ---
Note that you'll need mingw-w64 4.0.4, not 4.0.2 to reproduce, I used gcc
5.2.0.


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

* [Bug libgomp/67141] wrong libgomp mutex initialisation order
  2015-08-06 21:47 [Bug libgomp/67141] New: wrong libgomp mutex initialisation order mattiase at acm dot org
  2015-08-11 17:33 ` [Bug libgomp/67141] " xantares09 at hotmail dot com
  2015-08-12  8:01 ` xantares09 at hotmail dot com
@ 2015-08-24 18:42 ` jakub at gcc dot gnu.org
  2015-09-11 10:17 ` ktietz at gcc dot gnu.org
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: jakub at gcc dot gnu.org @ 2015-08-24 18:42 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |nathan at gcc dot gnu.org

--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
CCing OpenACC folks.


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

* [Bug libgomp/67141] wrong libgomp mutex initialisation order
  2015-08-06 21:47 [Bug libgomp/67141] New: wrong libgomp mutex initialisation order mattiase at acm dot org
                   ` (2 preceding siblings ...)
  2015-08-24 18:42 ` jakub at gcc dot gnu.org
@ 2015-09-11 10:17 ` ktietz at gcc dot gnu.org
  2015-09-21  9:36 ` tschwinge at gcc dot gnu.org
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: ktietz at gcc dot gnu.org @ 2015-09-11 10:17 UTC (permalink / raw)
  To: gcc-bugs

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

Kai Tietz <ktietz at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2015-09-11
                 CC|                            |ktietz at gcc dot gnu.org
     Ever confirmed|0                           |1

--- Comment #4 from Kai Tietz <ktietz at gcc dot gnu.org> ---
I added to mingw-w64's libwinpthread a work-a-round for this sloppy code. 
Nevertheless the issue should be fixed IMO in libgomp, too


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

* [Bug libgomp/67141] wrong libgomp mutex initialisation order
  2015-08-06 21:47 [Bug libgomp/67141] New: wrong libgomp mutex initialisation order mattiase at acm dot org
                   ` (3 preceding siblings ...)
  2015-09-11 10:17 ` ktietz at gcc dot gnu.org
@ 2015-09-21  9:36 ` tschwinge at gcc dot gnu.org
  2015-09-22  6:46 ` cltang at gcc dot gnu.org
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: tschwinge at gcc dot gnu.org @ 2015-09-21  9:36 UTC (permalink / raw)
  To: gcc-bugs

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

Thomas Schwinge <tschwinge at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
           Assignee|tschwinge at gcc dot gnu.org       |cltang at gcc dot gnu.org

--- Comment #5 from Thomas Schwinge <tschwinge at gcc dot gnu.org> ---
<http://news.gmane.org/find-root.php?message_id=%3C55FBC02A.5080306%40codesourcery.com%3E>.


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

* [Bug libgomp/67141] wrong libgomp mutex initialisation order
  2015-08-06 21:47 [Bug libgomp/67141] New: wrong libgomp mutex initialisation order mattiase at acm dot org
                   ` (4 preceding siblings ...)
  2015-09-21  9:36 ` tschwinge at gcc dot gnu.org
@ 2015-09-22  6:46 ` cltang at gcc dot gnu.org
  2015-09-22 11:19 ` cltang at gcc dot gnu.org
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: cltang at gcc dot gnu.org @ 2015-09-22  6:46 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from Chung-Lin Tang <cltang at gcc dot gnu.org> ---
Author: cltang
Date: Tue Sep 22 06:45:22 2015
New Revision: 227994

URL: https://gcc.gnu.org/viewcvs?rev=227994&root=gcc&view=rev
Log:
2015-09-22  Chung-Lin Tang  <cltang@codesourcery.com>

        PR libgomp/67141
        * oacc-int.h (goacc_host_init): Add declaration.
        * oacc-host.c (goacc_host_init): Remove static and constructor
attribute.
        * oacc-init.c (goacc_runtime_initialize): Call goacc_host_init() at
end.


Modified:
    trunk/libgomp/ChangeLog
    trunk/libgomp/oacc-host.c
    trunk/libgomp/oacc-init.c
    trunk/libgomp/oacc-int.h


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

* [Bug libgomp/67141] wrong libgomp mutex initialisation order
  2015-08-06 21:47 [Bug libgomp/67141] New: wrong libgomp mutex initialisation order mattiase at acm dot org
                   ` (5 preceding siblings ...)
  2015-09-22  6:46 ` cltang at gcc dot gnu.org
@ 2015-09-22 11:19 ` cltang at gcc dot gnu.org
  2015-09-24 13:33 ` cltang at gcc dot gnu.org
  2015-10-28 13:31 ` xantares09 at hotmail dot com
  8 siblings, 0 replies; 10+ messages in thread
From: cltang at gcc dot gnu.org @ 2015-09-22 11:19 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from Chung-Lin Tang <cltang at gcc dot gnu.org> ---
Author: cltang
Date: Tue Sep 22 11:18:23 2015
New Revision: 228011

URL: https://gcc.gnu.org/viewcvs?rev=228011&root=gcc&view=rev
Log:
2015-09-22  Chung-Lin Tang  <cltang@codesourcery.com>

        Backport from mainline:

        2015-09-22  Chung-Lin Tang  <cltang@codesourcery.com>

        PR libgomp/67141
        * oacc-int.h (goacc_host_init): Add declaration.
        * oacc-host.c (goacc_host_init): Remove static and constructor
attribute.
        * oacc-init.c (goacc_runtime_initialize): Call goacc_host_init() at
end.


Modified:
    branches/gcc-5-branch/libgomp/ChangeLog
    branches/gcc-5-branch/libgomp/oacc-host.c
    branches/gcc-5-branch/libgomp/oacc-init.c
    branches/gcc-5-branch/libgomp/oacc-int.h


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

* [Bug libgomp/67141] wrong libgomp mutex initialisation order
  2015-08-06 21:47 [Bug libgomp/67141] New: wrong libgomp mutex initialisation order mattiase at acm dot org
                   ` (6 preceding siblings ...)
  2015-09-22 11:19 ` cltang at gcc dot gnu.org
@ 2015-09-24 13:33 ` cltang at gcc dot gnu.org
  2015-10-28 13:31 ` xantares09 at hotmail dot com
  8 siblings, 0 replies; 10+ messages in thread
From: cltang at gcc dot gnu.org @ 2015-09-24 13:33 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #8 from Chung-Lin Tang <cltang at gcc dot gnu.org> ---
Can the MinGW folks confirm if the reported problem was fixed?
Thanks.


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

* [Bug libgomp/67141] wrong libgomp mutex initialisation order
  2015-08-06 21:47 [Bug libgomp/67141] New: wrong libgomp mutex initialisation order mattiase at acm dot org
                   ` (7 preceding siblings ...)
  2015-09-24 13:33 ` cltang at gcc dot gnu.org
@ 2015-10-28 13:31 ` xantares09 at hotmail dot com
  8 siblings, 0 replies; 10+ messages in thread
From: xantares09 at hotmail dot com @ 2015-10-28 13:31 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #9 from xantares09 at hotmail dot com ---
I can confirm the patch from gcc-5 branch applied on top of 5.2.0 fixes the
mingw problem.
Thanks a lot.
xan.


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

end of thread, other threads:[~2015-10-28 13:31 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-08-06 21:47 [Bug libgomp/67141] New: wrong libgomp mutex initialisation order mattiase at acm dot org
2015-08-11 17:33 ` [Bug libgomp/67141] " xantares09 at hotmail dot com
2015-08-12  8:01 ` xantares09 at hotmail dot com
2015-08-24 18:42 ` jakub at gcc dot gnu.org
2015-09-11 10:17 ` ktietz at gcc dot gnu.org
2015-09-21  9:36 ` tschwinge at gcc dot gnu.org
2015-09-22  6:46 ` cltang at gcc dot gnu.org
2015-09-22 11:19 ` cltang at gcc dot gnu.org
2015-09-24 13:33 ` cltang at gcc dot gnu.org
2015-10-28 13:31 ` xantares09 at hotmail dot com

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).