The following looks to be a bug in the ifort compiler. The example program is:
module srdt_mod implicit none type simple_struct complex(8) c real(8) r end type type special_struct type(simple_struct) s end type contains subroutine calc(srdt) implicit none complex(8) sm type(simple_struct) srdt type(special_struct), allocatable :: eles(:) allocate(eles(17)) !16 does not crash sm = (1.0d0, 1.0d0) eles%s%c = sm sm = sum(eles%s%c) print *, 'Sum: ', sm end subroutine end module !-------------- program prog use srdt_mod implicit none type(simple_struct) srdt call calc(srdt) end program
Running the program gives:
> ifort prog.f90; ./a.out
forrtl: severe (174): SIGSEGV, segmentation fault occurred
Image PC Routine Line Source
a.out 0000000000404983 Unknown Unknown Unknown
libpthread-2.17.s 00007F045884E680 Unknown Unknown Unknown
a.out 000000000040378E Unknown Unknown Unknown
a.out 0000000000403632 Unknown Unknown Unknown
libc-2.17.so 00007F04584943D5 __libc_start_main Unknown Unknown
a.out 0000000000403529 Unknown Unknown Unknown
Notes:
1) Bug appears with ifort V17, V18, V19.
2) If eles is allocated to size 16 there is no problem
3) If "-g" debug is used on the compile line there is no problem.