[Bug fortran/47386] New: Wrong warning:=?UTF-8?Q?=20=E2=80=98w?=.dim[2].=?UTF-8?Q?stride=E2=80=99=20may=20be=20used=20uninitialized=20in=20this=20function=20?=[-Wuninitialized]

anlauf at gmx dot de gcc-bugzilla@gcc.gnu.org
Thu Jan 20 22:02:00 GMT 2011


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

           Summary: Wrong warning: ‘w.dim[2].stride’ may be used
                    uninitialized in this function [-Wuninitialized]
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: anlauf@gmx.de


Hi.

the following testcase demonstrates warnings that can be irritating:

% cat gfcbug112.f90
module gfcbug112
  implicit none
  logical             :: ll = .false.
contains
  subroutine calc_W (N, M)
    integer, intent(in) :: N, M

    real                :: T(N,M,M) ! Temporary array 1
    real, allocatable   :: W(:,:,:) ! Temporary array 2

    if(ll) then
       allocate (W(N,M,M))
    end if

    T=0

    if(ll) then
       W = 0
       deallocate (W)
    end if

  end subroutine calc_W
end module gfcbug112
% gfc-trunk -c -Wall -O gfcbug112.f90
gfcbug112.f90: In function ‘calc_w’:
gfcbug112.f90:5:0: warning: ‘w.dim[2].stride’ may be used uninitialized in this
function [-Wuninitialized]


One can get really many of these in large modules...

Harald



More information about the Gcc-bugs mailing list