From 753e9f9e064f27099efceceebd955c05d2a92e29 Mon Sep 17 00:00:00 2001 From: Steven Franke Date: Wed, 17 May 2017 13:27:11 +0000 Subject: [PATCH] Fix an out of bounds error. Thanks Joe. git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@7682 ab8295b8-cf94-4d9e-aec4-7959e3be5d79 --- lib/fsk4hf/osd300.f90 | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/lib/fsk4hf/osd300.f90 b/lib/fsk4hf/osd300.f90 index 434447067..9ef2a8397 100644 --- a/lib/fsk4hf/osd300.f90 +++ b/lib/fsk4hf/osd300.f90 @@ -164,18 +164,19 @@ subroutine nextpat(mi,k,iorder,iflag) do i=1,k-1 if( mi(i).eq.0 .and. mi(i+1).eq.1) ind=i enddo - if(ind.ge.1 .and. ind.le.k) then !### JHT temporary ### Correct ??? - ms=0 - ms(1:ind-1)=mi(1:ind-1) - ms(ind)=1 - ms(ind+1)=0 - if( ind+1 .lt. k ) then - nz=iorder-sum(ms) - ms(k-nz+1:k)=1 - endif - mi=ms - endif !### JHT temporary ### + if( ind .lt. 0 ) then ! no more patterns of this order + iflag=ind + return + endif + ms=0 + ms(1:ind-1)=mi(1:ind-1) + ms(ind)=1 + ms(ind+1)=0 + if( ind+1 .lt. k ) then + nz=iorder-sum(ms) + ms(k-nz+1:k)=1 + endif + mi=ms iflag=ind - return end subroutine nextpat