seg fault at pgf90_mm_real8_str1_

I’ve a fortran code(mix of F77 & F90 source) with openmp parallelism. The code works fine with gfortran compiler for serial and as well as with openmp threads. But with PGI - pgf90 -15.1 compiler, the serial executable executes well. But for OpenMP compilation, the executable seg-faults. I tried debugging code with pgdbg, and it shows seg-fault with following message:

pgdbg> s
Stopped at 0x4DAB00, function exner_hyb, file exner_h
yb_m.f90, line 58
 #58:            if (llm.eq.1) then

pgdbg> s
Stopped at 0x4DAB70, function exner_hyb, file exner_h
yb_m.f90, line 69

pgdbg> c
Signalled SIGSEGV at 0x7F713163B38F, function pgf90_mm_real8_str1_
0x7F713163B38F:  48 89 8C 24 58 1 0 0   movq   %rcx,344(%rsp)

Is this problem due to our code or a bug with pgf90-15.1 compiler itself?


Hi SanBc,

The segv is occurring when accessing the stack pointer, “%rsp”, so you’re most likely encountering a stack overflow.

You can test this by adding the flag “-Mchkstk” to your compilation. The runtime will abort if there isn’t enough stack.

Try increasing your shell’s stack limit and/or set the environment variable “OMP_STACKSIZE” to a large value to see if it gets you around the problem.

Hope this helps,

Thanks Mat for the quick reply

Setting OMP_STACKSIZE did not help.
Then recompiled the code with -Mchkstk flag and during execution it fails with following message:

$ cat gcm_stack_out
Error: in routine some_function_name there is a
stack overflow: thread 0, max 10228KB, used 4464KB, request 12303792B

Do we have to increase stack limit using ulimit -s ? Or any other suggestion?


Do we have to increase stack limit using ulimit -s ?

You can. Though you might not have set OMP_STACKSIZE big enough so you can try bigger sizes as well.

  • Mat