gfortran -c -Wall -O1 gfort_warnings.f90
using gcc version 4.2.0 20061011 (experimental) on Windows XP
for the code
module foo_mod
implicit none
contains
subroutine print_sub(fmt_acf,iu,labels)
character (len=*), intent(in), optional :: fmt_acf
integer , intent(in), optional :: iu
character (len=*), intent(in), optional :: labels(:)
if (present(iu)) then
print*,iu
end if
if (present(fmt_acf)) then
print*,fmt_acf
end if
if (present(labels)) then
write (*,*) labels
end if
end subroutine print_sub
!
end module foo_mod
produces the spurious warnings
gfort_warnings.f90: In function 'print_sub':
gfort_warnings.f90:4: warning: 'stride.1' may be used uninitialized in this
function
gfort_warnings.f90:4: warning: 'ubound.0' may be used uninitialized in this
function
gfort_warnings.f90:4: warning: 'labels.0' may be used uninitialized in this
function
gfort_warnings.f90:4: warning: '<anonymous>' may be used uninitialized in this
function
--
Summary: Spurious warning about uninitialized optional arguments
Product: gcc
Version: 4.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: vivekrao4 at yahoo dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29459