NOAA-EMC / NCEPLIBS-grib_util

This is a collection of NCEP GRIB related utilities.
Other
21 stars 11 forks source link

in degrib2 prvtime(), variable tmpval2 may be used without being set first #231

Closed edwardhartnett closed 1 year ago

edwardhartnett commented 1 year ago

In degrib2, in prvtime.F90, we have:

     is = ipos(ipdtn) ! Continuous time interval
     write(endtime, fmt = '(i4,3i2.2,":",i2.2,":",i2.2)') (ipdtmpl(j), j = is, is + 5)
     if (ipdtn .eq. 8 .and. ipdtmpl(9) .lt. 0) then
        tabbrev = "(" // trim(tmpval) // " -" &
             // trim(tmpval2) // ") valid  " // trim(tmpval) // &
             " " // trim(tunit) // " before " &
             // reftime // " to " //endtime

     elseif ((ipdtn .ge. 8 .and. ipdtn .le. 14) .or. &
          (ipdtn .ge. 42 .and. ipdtn .le. 47) .or. &
          ipdtn .eq. 91) then ! Continuous time interval
        itemp2 = abs (ipdtmpl(iutpos2 + 1)) * iunit2
        itemp2 = itemp + itemp2
        write(tmpval2, '(I0)') itemp2

        tabbrev = "(" // trim(tmpval) // " -" &
             // trim(tmpval2) // " hr) valid  " // trim(tmpval) // &
             " " // trim(tunit) // " after " &
             // reftime // " to " // endtime

     endif

Note that tmpval2 is used in the first if condition, but not set until the elseif. So it is not set to anything.