Re: be used uninitialized in this function
- From: "cjpsimon@xxxxxxxxx" <cjpsimon@xxxxxxxxx>
- Date: Sat, 15 Jan 2011 07:47:54 -0800 (PST)
On 15 jan, 15:44, Jinsong Zhao <jsz...@xxxxxxxx> wrote:
Hi there,
With the example code below, gfortran (4.5.0) give a strange warning
message with -O2 flag:
> gfortran -Wall -O2 -c readmo.f90
readmo.f90: In function 'readmo':
readmo.f90:4:0: warning: 'convrt' may be used uninitialized in this function
When with -O0, the warning message disappear.
In fact, the array lopt is not initialized in the code, however, the
compiler does not give warning about that.
Any suggestions or comments? Thanks in advance!
Regards,
Jinsong
subroutine readmo()
!!!! example code readmo.f90 !!!!
implicit none
real :: convrt
integer :: i, iflag, j
integer, dimension(3,5) :: lopt
iflag = 0
do i = 1, 5
do j = 1, 3
if ( lopt(j,i) < 0 ) then
convrt = 1.0
if ( j > 1 ) convrt = 2.0
iflag = 1
endif
enddo
enddo
if ( iflag /= 0 ) then
do i = 1, 5
write(6,*) i*convrt
enddo
endif
end subroutine readmo
For me, lopt seems to be seen as a function returning an integer of
dimension (3,5).
In that case lopt must be missing at link time.
.
- Follow-Ups:
- Re: be used uninitialized in this function
- From: Richard Maine
- Re: be used uninitialized in this function
- From: Jinsong Zhao
- Re: be used uninitialized in this function
- References:
- be used uninitialized in this function
- From: Jinsong Zhao
- be used uninitialized in this function
- Prev by Date: Re: be used uninitialized in this function
- Next by Date: Re: C_LOC tt%t%i(1) where tt%t is an array
- Previous by thread: Re: be used uninitialized in this function
- Next by thread: Re: be used uninitialized in this function
- Index(es):
Relevant Pages
|