The automatic formatting in VS has a problem if there is a do statement in an if block. The following statements give an example:
if(RCA(M, Zi) .eq. 0) then else allocate (YPLOTA(P,RCA(M, Zi)), STAT = astat) if(astat == 0) then write(*,*)"Allocated matrix RCA(K,K)" else stop "Failed to allocate matrix RCA(K,K)" end if do 400 i = 1,51 if(zi .eq. Z(i)) then YPLOTA(:,count) = X(:,i) count = count + 1 endif 400 end do YMAX = maxval(YPLOTA)
Line 17 and line 20 are incorrectly placed if you are following the intent of the algorithm for setting out the code. This is pulled from a few hundred lines, all the lines after 20 are incorrectly placed.
I do not know if there is a fix?