Segmentation fault in OpenMP
Hi,
I'm testing the OpenMP support in the Linux version of the Sun compiler collection with the very simple application given below:
[code]#include <stdio.h>
#include <omp.h>
int main(void)
{
int tid;
#pragma omp parallel private(tid)
{
tid = omp_get_thread_num();
printf("Hello world from thread %d\n", tid);
}
return 0;
}[/code]
The code compiles cleanly with [b]cc -xopenmp -O3[/b] but then segfaults when run. The problem seems to be in the libmtsk function [b]new_user_thread[/b]:
[code](gdb) where
#0 0x00002aaaaabd6a6b in new_user_thread ()
from /usr/local/sun/sunstudiomars/lib/amd64/libmtsk.so.1
#1 0x00002aaaaabc96a4 in __mt_MasterFunction_rtc_ ()
from /usr/local/sun/sunstudiomars/lib/amd64/libmtsk.so.1
#2 0x0000000000400658 in main () at omp_test.c:6[/code]
I tried various settings for the stack limit, both global (ulimit -s) and with the STACKSIZE environment variable but that helps not.
Does somebody have positive experience with cc's OpenMP on Linux? The Fortran version of the program gives the same segfault with f90. I'm running Ubuntu 6.06 x86_64 (kernel 2.6.15-26-amd64-k8 and libc 2.3.6) on an AMD64 machine. The same segfault persists on Fedora Core 4 x86_64 (kernel 2.6.12-1.1456_FC4smp and libc 2.3.6-3) also. The program compiles and runs with no problems on Solaris 10 x86 on the same machine using Sun Studio 11.

