I have the following code that uses a character variable with allocatable length.
PROGRAM testprog
IMPLICIT NONE
CHARACTER(LEN=5) :: param
CHARACTER(LEN=:), ALLOCATABLE :: val
param = '12455'
val = param
WRITE(*,*) val
END PROGRAM testprog
I compile it using gfortran versions 7.5 or 8.4 with all warnings activated (option -Wall) and I get the following warning:
test.f90:6:0:
val = param
Warning: ‘.val’ may be used uninitialized in this function [-Wmaybe-uninitialized]
The program works. However, I do not understand why this warning message appears.