public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libfortran/41504]  New: Incorrect __gthread_active_p version with weak symbols (pthread_cancel does not bring in pthread_mutex_trylock)
@ 2009-09-29 14:22 DumaShkurko at gmail dot com
  2009-09-29 14:31 ` [Bug libfortran/41504] " rguenth at gcc dot gnu dot org
  2009-09-29 15:10 ` DumaShkurko at gmail dot com
  0 siblings, 2 replies; 3+ messages in thread
From: DumaShkurko at gmail dot com @ 2009-09-29 14:22 UTC (permalink / raw)
  To: gcc-bugs

Hello,

Compile the following file with gcc:

void s () {
  pthread_cancel();
  /*pthread_mutex_trylock (); */
}

and the following file with gfortran:
program test
   print*, "Bug"
end program test

Link both files using "gfortran -static -pthread". Note that the program dies
with SEGV in pthread_mutex_trylock (weak symbol equal to 0x0).

It is due to the fact that __gthread_active_p checks only for pthread_cancel
and pthread_mutex_trylock is not automatically taken from libpthread.a.

Un-commenting pthread_mutex_trylock in s() fixes the problem.

Regards,
Dima


-- 
           Summary: Incorrect __gthread_active_p version with weak symbols
                    (pthread_cancel does not bring in pthread_mutex_trylock)
           Product: gcc
           Version: 4.3.4
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libfortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: DumaShkurko at gmail dot com
 GCC build triplet: x86_64-unknown-linux-gnu
  GCC host triplet: x86_64-unknown-linux-gnu
GCC target triplet: x86_64-unknown-linux-gnu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41504


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

* [Bug libfortran/41504] Incorrect __gthread_active_p version with weak symbols (pthread_cancel does not bring in pthread_mutex_trylock)
  2009-09-29 14:22 [Bug libfortran/41504] New: Incorrect __gthread_active_p version with weak symbols (pthread_cancel does not bring in pthread_mutex_trylock) DumaShkurko at gmail dot com
@ 2009-09-29 14:31 ` rguenth at gcc dot gnu dot org
  2009-09-29 15:10 ` DumaShkurko at gmail dot com
  1 sibling, 0 replies; 3+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2009-09-29 14:31 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from rguenth at gcc dot gnu dot org  2009-09-29 14:31 -------
You need to link libpthread.a with -Wl,--whole-archive

In general static linking is not recommended with glibc and threads.


-- 

rguenth at gcc dot gnu dot org changed:

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


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41504


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

* [Bug libfortran/41504] Incorrect __gthread_active_p version with weak symbols (pthread_cancel does not bring in pthread_mutex_trylock)
  2009-09-29 14:22 [Bug libfortran/41504] New: Incorrect __gthread_active_p version with weak symbols (pthread_cancel does not bring in pthread_mutex_trylock) DumaShkurko at gmail dot com
  2009-09-29 14:31 ` [Bug libfortran/41504] " rguenth at gcc dot gnu dot org
@ 2009-09-29 15:10 ` DumaShkurko at gmail dot com
  1 sibling, 0 replies; 3+ messages in thread
From: DumaShkurko at gmail dot com @ 2009-09-29 15:10 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from DumaShkurko at gmail dot com  2009-09-29 15:09 -------
Is it possible to adjust specs file for -static and/or -pthread?


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41504


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

end of thread, other threads:[~2009-09-29 15:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-09-29 14:22 [Bug libfortran/41504] New: Incorrect __gthread_active_p version with weak symbols (pthread_cancel does not bring in pthread_mutex_trylock) DumaShkurko at gmail dot com
2009-09-29 14:31 ` [Bug libfortran/41504] " rguenth at gcc dot gnu dot org
2009-09-29 15:10 ` DumaShkurko at gmail 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).