[Bug fortran/77504] New: "is used uninitialized" with allocatable string and array constructors
tkoenig at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Tue Sep 6 19:24:00 GMT 2016
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77504
Bug ID: 77504
Summary: "is used uninitialized" with allocatable string and
array constructors
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
Assignee: unassigned at gcc dot gnu.org
Reporter: tkoenig at gcc dot gnu.org
Target Milestone: ---
Original bug report from John Urban, from
https://gcc.gnu.org/ml/fortran/2016-09/msg00015.html
program testit
implicit none
character(len=:),allocatable :: help_text(:)
integer :: i
help_text=[ CHARACTER(LEN=80) :: &
'defines length and size with different length expressions. Yeah!',&
' aaaaaaaaaaaaa',&
' bbbbbbbbbbbbbbbbb',&
' ddddddddddddddddddddd',&
'']
write(*,'(a)')repeat('=',len(help_text(1))) !assumed at least size one
write(*,'(a)')(trim(help_text(i)),i=1,size(help_text))
write(*,'(a)')repeat('=',len(help_text(1))) !assumed at least size one
end program testit
yields:
fortran -Wuninitialized a.f90
a.f90:3:0:
character(len=:),allocatable :: help_text(:)
Warning: '.help_text' is used uninitialized in this function [-Wuninitialized]
with a current trunk.
Valgrind does not complain, so it might be spurious
More information about the Gcc-bugs
mailing list