* version: 4.6.2 20111019 (prerelease) (GCC) * system type: Mac OS 10.7.4 * built command: gfortran -o BUG BUG.f90 -save-temps -J ./build * bug behavior: compiler throws internal compiler error: Segmentation fault * source files: BUG.f90 ! ----------------------------------- MODULE MY_ARRAY TYPE ARRAY REAL, ALLOCATABLE :: VALS(:) END TYPE ARRAY CONTAINS FUNCTION MAKE_ARRAY(X) RESULT(Y) REAL, INTENT(IN) :: X(:) TYPE(ARRAY) :: Y Y%VALS = X END FUNCTION MAKE_ARRAY SUBROUTINE PRINT_ARRAY(Y) TYPE(ARRAY), INTENT(IN) :: Y PRINT *, Y%VALS END SUBROUTINE PRINT_ARRAY END MODULE MY_ARRAY PROGRAM MAIN USE MY_ARRAY CALL PRINT_ARRAY(MAKE_ARRAY((/1.,2./))) END PROGRAM MAIN ! ----------------------------------
I can confirm the error with: gcc version 4.6.0 20110505 [gcc-4_6-branch revision 173419] (SUSE Linux) However, all other versions I tried compile the test case correctly (including 4.3, 4.5, 4.7 and trunk).
Slightly reduced test case: MODULE MY_ARRAY TYPE ARRAY REAL, ALLOCATABLE :: VALS END TYPE CONTAINS TYPE(ARRAY) FUNCTION MAKE_ARRAY() END FUNCTION SUBROUTINE PRINT_ARRAY(Y) TYPE(ARRAY) :: Y END SUBROUTINE END MODULE PROGRAM MAIN USE MY_ARRAY CALL PRINT_ARRAY(MAKE_ARRAY()) END PROGRAM MAIN
(In reply to comment #1) > I can confirm the error with: > > gcc version 4.6.0 20110505 [gcc-4_6-branch revision 173419] (SUSE Linux) > > However, all other versions I tried compile the test case correctly (including > 4.3, 4.5, 4.7 and trunk). In fact it seems that it has also been fixed on the 4.6 branch already: gcc version 4.6.3 20120531 [gcc-4_6-branch revision 188067] (SUSE Linux) works for me on both comment 0 and comment 2. Closing as fixed!