https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78187
Thomas Koenig <tkoenig at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Last reconfirmed| |2016-11-02 CC| |tkoenig at gcc dot gnu.org Ever confirmed|0 |1 --- Comment #1 from Thomas Koenig <tkoenig at gcc dot gnu.org> --- Seems like allocatable character functions don't work with -fno-automatic. The problem is not in the main program: $ cat mod.f90 module test_module implicit none contains function scalar(a, b) result(c) character(len=*), intent(in) :: a, b character(len=:), allocatable :: c c = trim(a)//trim(b) print *,c end function scalar end module test_module $ cat a.f90 ! built using the following commands ! gfortran-6 -o testscal_f.exe testallocatablescalars.f90 ! gfortran-6 -fno-automatic -o testscal_f.exe testallocatablescalars.f90 program test use test_module use iso_fortran_env implicit none character(len=:), allocatable :: c c = scalar("abc","def") write(*,*)"c|", c, "|", allocated(c) end program test $ gfortran -c -fno-automatic mod.f90 && gfortran -c a.f90 && gfortran mod.o a.o && ./a.out abcdef c|| T