I tried to use gfortran together with a library that uses pthreads. This caused
a segfault. Note that my own code didn't directly call pthreads nor use openmp
(this is trunk, not gomp branch).
~/src/benchmark/matmul-bench% gfortran -g -O0 matmul-bench.f90 -o mbgfc-goto
-lgoto -lpthread
~/src/benchmark/matmul-bench% gdb ./mbgfc-goto
GNU gdb 6.3-debian
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "i486-linux-gnu"...Using host libthread_db library
"/lib/tls/i686/cmov/libthread_db.so.1".
(gdb) b transfer.c:2159
No source file named transfer.c.
Make breakpoint pending on future shared library load? (y or [n]) y
Breakpoint 1 (transfer.c:2159) pending.
(gdb) r
Starting program: /home/joib/src/benchmark/matmul-bench/mbgfc-goto
[Thread debugging using libthread_db enabled]
[New Thread 1076887104 (LWP 30593)]
Breakpoint 2 at 0x40188b98: file ../../../trunk/libgfortran/io/transfer.c, line
2159.
Pending breakpoint "transfer.c:2159" resolved
Single precision matrix multiplication test
[Switching to Thread 1076887104 (LWP 30593)]
Breakpoint 2, *_gfortran_st_write_done (dtp=0xbfa1665c)
at ../../../trunk/libgfortran/io/transfer.c:2159
2159 unlock_unit (dtp->u.p.current_unit);
(gdb) step
*_gfortrani_unlock_unit (u=0x804f118) at
../../../trunk/libgfortran/io/unit.c:555
555 {
(gdb)
538 gthr-posix.h: No such file or directory.
in gthr-posix.h
(gdb)
539 in gthr-posix.h
(gdb)
557 }
(gdb)
*_gfortrani_unlock_unit (u=0xbfa1665c) at gthr-posix.h:539
539 gthr-posix.h: No such file or directory.
in gthr-posix.h
(gdb)
0x402ed223 in in6addr_any () from /lib/tls/i686/cmov/libc.so.6
(gdb)
Single stepping until exit from function in6addr_any,
which has no line number information.
Program received signal SIGSEGV, Segmentation fault.
0x402ed231 in in6addr_any () from /lib/tls/i686/cmov/libc.so.6
--
Summary: libgfortran/io/transfer.c:2159 unlock_unit causes
segfault
Product: gcc
Version: 4.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: libfortran
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: jb at gcc dot gnu dot org
GCC build triplet: i686-pc-linux-gnu
GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25377