This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Bogus "is used uninitialized" warnings


Hi list,

if I compile the attached code with -Wall, 4.4.2 gives the me the
following bogus warnings, while 4.3.[2|3|4] and 4.2.4 don't complain:

test.f90: In function 'test1':
test.f90:10: warning: 'j' is used uninitialized in this function
test.f90: In function 'test2':
test.f90:15: warning: 'i' is used uninitialized in this function

I did spot something fishy in the (pruned) tree-dump:

test2 (integer(kind=4) & n)
{
  integer(kind=4) i;
  loopvar.3 = i;
  i = 1;

}

test1 shows the same thing for i and j, but only complains about j. Am
I following the wrong lead?

test1 (integer(kind=4) & n, integer(kind=4) & m)
{
  integer(kind=4) i;
  integer(kind=4) j;
  {
      integer(kind=4) loopvar.9;
      loopvar.9 = j;
      j = 1;
        {
          if (j > D.1540) goto L.4;
          {
            integer(kind=4) loopvar.8;
            loopvar.8 = i;
            i = 1;

Unless someones proves me wrong, it looks like a (minor) 4.4
regression - shall I file a PR?

Cheers,
Dennis
PROGRAM test

  CALL test1(2,2)
  CALL test2(2)

CONTAINS
  
  SUBROUTINE test1(N,M)
    INTEGER :: i, j, M, N
    PRINT *, [ ((i, i=1,M), j=1,N) ]
  END SUBROUTINE test1
  
  SUBROUTINE test2(N)
    INTEGER :: i, N
    PRINT *, [(1.0, i=1,N)]
  END SUBROUTINE test2

END PROGRAM test


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]