Someone reported on bug on a trivial statically-linked Fortran progam with OpenMP and a I/O operation. I can reproduce the segfault, which happens at:

(gdb) where
#0  0x00000000 in ?? ()
#1  0x0804cdbb in get_external_unit (n=6, do_create=1)
    at
/home/fxcoudert/gfortran_nightbuild/trunk/libgfortran/../gcc/gthr- posix.h:613
#2  0x0804b987 in data_transfer_init (dtp=0xbfe9b024, read_flag=0)
at /home/fxcoudert/gfortran_nightbuild/trunk/libgfortran/io/ transfer.c:1702
#3  0x0804827f in MAIN__.omp_fn.0 (.omp_data_i=0x0) at hello.f90:2
#4  0x08048235 in MAIN__ () at hello.f90:2
#5  0x080482dd in main (argc=Cannot access memory at address 0x1

The line 613 in gcc/gthr-posix.h is the call to pthread_mutex_trylock () in:

static inline int
__gthread_mutex_trylock (__gthread_mutex_t *mutex)
{
  if (__gthread_active_p ())
    return __gthrw_(pthread_mutex_trylock) (mutex);
  else
    return 0;
}


Andrew suggested on bugzilla that this might be a GLIBC issue (I use glibc-2.4 from redhat), with "pthreads not linking in correctly". Does this ring a bell? Can someone confirm that it's not a GCC issue (or that it is)? Details can be found in PR 31604.

Thanks,
FX

Reply via email to