Can someone explain why the following code produces a segmentation fault when ND is big (1000000)? Increasing the stack limit does not help.
module parametros_mod
integer, parameter :: ND = 1000000
end module parametros_mod
module data_mod
use parametros_mod
implicit none
private
type, public :: data_vec
real(8) :: f0
real(8), dimension(ND) :: fvec
end type data_vec
end module data_mod
!test program
program test
use parametros_mod
use data_mod
implicit none
type(data_vec) :: v1
real(8), dimension(ND) :: rv, xv
rv = 0d0
rv(2) = 1d0
v1 = data_vec(1.1d0,rv)
xv = v1%fvec
write(*,'(*(f0.4,2x))') xv(1:3)
end program test
real(8)thing on massive scale. It does not come from good textbooks or tutorials.data_vec(1.1d0,rv)expression, perhaps it causes a temporary object with your compiler. Tell us more about your compiler, compiler flags, operating system.