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

Reply via email to