https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81416
--- Comment #4 from bz0815 at tirol dot com --- (In reply to Andrew Pinski from comment #3) > > DOUBLE PRECISION,DIMENSION(n) :: b > > This array is on the stack. So DOUBLE PRECISION,DIMENSION(n) :: b is put on the stack if it is passed as an argument but put on heap if it isn't? If it is passed as argument even small dimensions cause a segmentation fault: PROGRAM Prog USE Mod USE OMP_LIB IMPLICIT NONE INTEGER :: nthreads INTEGER,PARAMETER :: n = 262144 DOUBLE PRECISION,DIMENSION(n) :: b nthreads = 4 CALL OMP_SET_NUM_THREADS(nthreads) PRINT *,omp_get_num_procs() PRINT *,omp_get_max_threads() PRINT *,omp_get_num_threads() CALL Print_Info(b) END PROGRAM Prog $ make $ gfortran -Wl,--stack,2097152 -fopenmp -c mod.f08 -o mod.o $ gfortran -Wl,--stack,2097152 -fopenmp -o prog mod.o prog.f08 $ ./prog Segmentation fault (core dumped) However, if array b is not passed as an argument even dimensions greater than stack limit work fine: PROGRAM Prog USE Mod USE OMP_LIB IMPLICIT NONE INTEGER :: nthreads INTEGER,PARAMETER :: n = 134217728 DOUBLE PRECISION,DIMENSION(n) :: b nthreads = 4 CALL OMP_SET_NUM_THREADS(nthreads) PRINT *,omp_get_num_procs() PRINT *,omp_get_max_threads() PRINT *,omp_get_num_threads() ! CALL Print_Info(b) END PROGRAM Prog $ gfortran -Wl,--stack,2097152 -fopenmp -c mod.f08 -o mod.o $ gfortran -Wl,--stack,2097152 -fopenmp -o prog mod.o prog.f08 $ ./prog 8 4 1 Anyway, many thanks for the hint. My program is now up and running.