[Bug fortran/91442] Wrong "may be used uninitialized" warning with allocation on assignment

paul.luckner@rwth-aachen.de gcc-bugzilla@gcc.gnu.org
Thu Dec 3 12:09:11 GMT 2020


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91442

paul.luckner@rwth-aachen.de changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |paul.luckner@rwth-aachen.de

--- Comment #2 from paul.luckner@rwth-aachen.de ---
Same is true for any other intrinsic data type. 

Test case for integer array:

program test
  implicit none
  integer, allocatable :: i(:)
  i = [1]
end program

Compilation and warning:
$ gfortran -Wall -g3 -fcheck=all -fuse-ld=bfd a.f90

    4 |   i = [1]
      | 
Warning: ‘i.offset’ may be used uninitialized in this function
[-Wmaybe-uninitialized]
a.f90:4:0: Warning: ‘i.dim[0].lbound’ may be used uninitialized in this
function [-Wmaybe-uninitialized]


More information about the Gcc-bugs mailing list