The code below segfaults in ifort 17.0.4 unless I remove the associate lines. The address of `this` passed to `write_i` is 0xccccccccc
program associate_pass type :: t integer :: i = 1 end type integer :: i class(t), dimension(:), allocatable :: a ! class(t) is important allocate(a(100)) !$omp parallel do default(private) shared(a) do i=1,size(a,1) associate (p => a(i)) ! remove this line to 'fix' call write_i(p) end associate ! remove this one also end do !$omp end parallel do contains subroutine write_i(this) class(t) :: this write(*,*) this%i end subroutine write_i end program associate_pass
Compilation line is
mpiifort -mt_mpi -qopenmp -O0 -g -traceback -ftrapuv -debug all -debug-parameters -fstack-security-check -i4 -diag-disable 5462 -align -warn all -warn nointerfaces -warn nounused -fpp -r8 -check all,noarg_temp_created -check bounds -check uninit -init=snan -init=zero -init=arrays -gen-interfaces -warn-interfaces -implicitnone associate_pass.f90 -o associate_pass
but I doubt anything except -qopenmp is of importance there.