[Bug fortran/67679] -Wunitialized reports on compiler generated variables
janus at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Fri Jul 28 12:58:00 GMT 2017
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67679
--- Comment #2 from janus at gcc dot gnu.org ---
Here is another test case with similar behavior:
subroutine s(h, Gmin, r)
implicit none
real, intent(in) :: Gmin(3), h(3)
integer, intent(inout) :: r
integer :: x_min(3), x_max(3), k, iStat
logical, dimension(:), allocatable :: check
do k = 1,1
x_min(k) = int(Gmin(k)*h(k))
x_max(k) = int(Gmin(k)*h(k))
end do
allocate(check(x_min(1):x_max(1)),stat=iStat)
check(:) = .false.
do k = x_min(1),x_max(1)
r = r + 1
end do
end
shows things like ...
Warning: ‘check.dim[0].lbound’ may be used uninitialized in this function
[-Wmaybe-uninitialized]
Warning: ‘check.dim[0].ubound’ may be used uninitialized in this function
[-Wmaybe-uninitialized]
Warning: ‘check.offset’ may be used uninitialized in this function
[-Wmaybe-uninitialized]
... with -O1 and higher.
I see it with all versions starting from 4.7, while 4.4 and 4.6 do not seem to
be affected, so I guess this is a regression?
More information about the Gcc-bugs
mailing list