http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60795
--- Comment #4 from Kergonath <kergonath at me dot com> ---
The slightly modified version:
module m
contains
subroutine allocate_array(s_array)
character(:), dimension(:), allocatable, intent(out) :: s_array
allocate(character(2) :: s_array(10))
write(*,*) len(s_array), size(s_array)
end subroutine
end module
program stringtest
use m
character(:), dimension(:), allocatable :: s4
call allocate_array(s4)
write(*,*) len(s4), size(s4)
end program
gives the result:
0 10
0 10
when compiled with: gfortran -o stringtest stringtest.f90
but gives
0 10
32767 10
when using the -pg option.
Using -Wall does only show the following warning, which looks similar to that
in PR56670:
stringtest.f90: In function 'allocate_array':
stringtest.f90:7:0: warning: '.s_array' may be used uninitialized in this
function [-Wmaybe-uninitialized]
write(*,*) len(s_array), size(s_array)
^