[Bug fortran/29459] Spurious warning about uninitialized optional arguments

fxcoudert at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Mon Jul 9 22:03:00 GMT 2007



------- Comment #6 from fxcoudert at gcc dot gnu dot org  2007-07-09 22:03 -------
With the initial testcase:

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

we still have the following warning with -O1 -Wall:
u.f90: In function ‘print_sub’:
u.f90:4: warning: ‘<anonymous>’ may be used uninitialized in this function


-- 

fxcoudert at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|fxcoudert at gcc dot gnu dot|unassigned at gcc dot gnu
                   |org                         |dot org
             Status|ASSIGNED                    |NEW
           Keywords|patch                       |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29459



More information about the Gcc-bugs mailing list