https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82617
kargl at gcc dot gnu.org changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Last reconfirmed| |2017-10-19 CC| |kargl at gcc dot gnu.org Component|fortran |middle-end Ever confirmed|0 |1 --- Comment #1 from kargl at gcc dot gnu.org --- Can you post the backtrace you get? With top of tree, I see % gfcx -c h.f90 h.f90:22:0: FUNCTION str_words(str,white) RESULT(items) Error: Local declaration from a different function ..__result h.f90:27:0: items = strwords_impl(str,white) note: in statement ..__result = ..__result; h.f90:22:0: FUNCTION str_words(str,white) RESULT(items) Error: Local declaration from a different function ..__result h.f90:27:0: items = strwords_impl(str,white) note: in statement _28 = (integer(kind=8)) ..__result; h.f90:22:0: FUNCTION str_words(str,white) RESULT(items) Error: Local declaration from a different function ..__result h.f90:27:0: items = strwords_impl(str,white) note: in statement D.3686 = (sizetype) ..__result; during GIMPLE pass: cfg h.f90:22:0: FUNCTION str_words(str,white) RESULT(items) internal compiler error: verify_gimple failed 0xda9ea6 verify_gimple_in_cfg(function*, bool) ../../gcc/gcc/tree-cfg.c:5397 0xcb152f execute_function_todo ../../gcc/gcc/passes.c:1992 0xcb234e execute_todo ../../gcc/gcc/passes.c:2046 Please submit a full bug report, with preprocessed source if appropriate. Please include the complete backtrace with any bug report. See <https://gcc.gnu.org/bugs/> for instructions. The reduced testcase module test implicit none contains function str_words(x,y) result(z) character(len=:), dimension(:), allocatable :: z character(len=*), intent(in) :: x, y z = strwords_impl(x,y) end function str_words function strwords_impl(a, b) result(c) character(len=:), dimension(:), allocatable :: c character(len=*), intent(in) :: a, b allocate(character(len=0) :: c(0)) end function strwords_impl end module test yields the same result. These errors appear to be coming from the middle-end.