User account creation filtered due to spam.

Bug 47386 - Wrong warning: ‘w.dim[2].stride’ may be used uninitialized in this function [-Wuninitialized]
Summary: Wrong warning: ‘w.dim[2].stride’ may be used uninitialized in this function [...
Status: NEW
Alias: None
Product: gcc
Classification: Unclassified
Component: middle-end (show other bugs)
Version: 4.6.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
Keywords: diagnostic
Depends on:
Reported: 2011-01-20 21:19 UTC by Harald Anlauf
Modified: 2011-01-21 11:12 UTC (History)
0 users

See Also:
Known to work:
Known to fail:
Last reconfirmed: 2011-01-21 11:12:28


Note You need to log in before you can comment on or make changes to this bug.
Description Harald Anlauf 2011-01-20 21:19:45 UTC

the following testcase demonstrates warnings that can be irritating:

% cat gfcbug112.f90
module gfcbug112
  implicit none
  logical             :: ll = .false.
  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


    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...

Comment 1 Andrew Pinski 2011-01-20 21:21:58 UTC
This is the "standard" uninitialized warning for predicates.  There are a few other bugs like this.
Comment 2 Richard Biener 2011-01-21 11:12:28 UTC