$ cat hello.f90 integer :: tid !$omp parallel private(tid) tid = 0 if (tid .eq. 0) write(*,*) 'hello' !$omp end parallel end $ gfortran -fopenmp hello.f90 -g -static $ ./a.out zsh: segmentation fault ./a.out
It appears to be due to the combination of (i) spawning a thread (ii) writing to a preconnected unit (iii) having a statically linked binary If you remove any of these three, it works fine. -- Summary: Segfault at runtime on I/O to preconnected unit with OpenMP Product: gcc Version: 4.3.0 Status: UNCONFIRMED Keywords: wrong-code Severity: normal Priority: P3 Component: libfortran AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: fxcoudert at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31604