Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
Announcements
The Intel sign-in experience is changing in February to support enhanced security controls. If you sign in, click here for more information.
27551 Discussions

Interesting Observation with Intel Fortran and VS 2019

JohnNichols
Valued Contributor II
273 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
258 Views

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

 

DavidWhite
Black Belt
232 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