Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
27429 Discussions

Interesting Observation with Intel Fortran and VS 2019

JohnNichols
Valued Contributor II
263 Views

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?

 

0 Kudos
2 Replies
andrew_4619
Honored Contributor II
248 Views

The numbers mess thing up, why have those at all?

 

DavidWhite
Black Belt
222 Views

I think that using the do numbering confuses the formatting between free format and fixed formatting.

 

When DO / END DO is used without numbers, the indentation normally works for me.

Reply