Segfault caused by derived-type with allocatable component in private clause
Steve Kargl
sgk@troutmask.apl.washington.edu
Sun Jan 4 21:04:00 GMT 2009
All,
I just submitted a PR 38724 with the code following my sig. This is
derived (pun intended) from code posted by Gib Bogle in c.l.f.
http://groups.google.com/group/comp.lang.fortran/browse_frm/thread/fc36db02a922ff07#
pault replied in the clf thread that the code worked with gfortran.
To the contrary, I've found that the code leads to segfault. Can
some others compile the code and run a test.
--
Steve
!
! Original program found at
! http://groups.google.com/group/comp.lang.fortran/browse_frm/thread/fc36db02a922ff07#
!
program test_omp
type cell_type
integer, allocatable :: dclist(:)
end type
integer, parameter :: nlist = 1000
type(cell_type) :: cell_array(nlist)
type(cell_type) :: cell
integer :: k
call omp_set_num_threads(1)
!
! Initialize cell_array()
!
do k = 1, nlist
allocate(cell_array(k)%dclist(2))
cell_array(k)%dclist = (/k, k/)
end do
print *, cell_array(10)%dclist
cell = cell_array(1)
print*, cell%dclist
!$omp parallel private(k,cell)
do k = 1,nlist
cell = cell_array(k)
end do
!$omp end parallel
end
More information about the Fortran
mailing list