http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58883
Bug ID: 58883 Summary: Segmentation fault when reshaping a allocatable array to allocatable function Product: gcc Version: 4.8.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran Assignee: unassigned at gcc dot gnu.org Reporter: songtao.thu at gmail dot com When I reshape a allocatable array to allocatable function output, segmentation fault appears. Test Case1: program main implicit none print *, foo() contains function foo() integer, allocatable :: foo(:,:) integer, allocatable :: temp(:) temp = [1,2,3,4,5,6,7,8] foo = reshape(temp,[2,4]) end function end program However, test case2 works fine: program main implicit none print *, foo() contains function foo() integer, allocatable :: foo(:,:) integer, allocatable :: temp(:), temp2(:,:) temp = [1,2,3,4,5,6,7,8] temp2 = reshape(temp,[2,4]) foo = temp2 ! or call move_alloc(temp2,foo) end function end program Hopefully someone can figure it out. Tao Song