Skip to content

Commit

Permalink
Fix uninitialized function variable and add testing on its return
Browse files Browse the repository at this point in the history
  • Loading branch information
jonbob committed Feb 16, 2017
1 parent 4f3d4f0 commit 2b2335c
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions components/cice/src/source/ice_spacecurve.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1139,6 +1139,7 @@ function FirstFactor(fac) result(res)
integer (int_kind) :: i

found = .false.
res = 0
i=1
do while (i<=fac%numfact .and. (.not. found))
if(fac%used(i) == 0) then
Expand Down Expand Up @@ -1189,8 +1190,10 @@ subroutine MatchFactor(fac1,fac2,val,found)

val1 = FirstFactor(fac1)
!JMD print *,'Matchfactor: found value: ',val1
found = FindandMark(fac2,val1,.true.)
tmp = FindandMark(fac1,val1,found)
if (val1.ge.1) then
found = FindandMark(fac2,val1,.true.)
tmp = FindandMark(fac1,val1,found)
endif
if (found) then
val = val1
else
Expand Down

0 comments on commit 2b2335c

Please sign in to comment.