Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
Announcements
Welcome to the Intel Community. If you get an answer you like, please mark it as an Accepted Solution to help others. Thank you!

Error Fortran

ТАПОВ__ЕВГЕНИЙ
211 Views

33    CONTINUE
      CALL NSN(XN,YN,XK,YK,CNX,CNY)
      CX=CN*CNX
      CE=CN*CNY
      AK(IAK+1)=CN
      AK(IAK+2)=CX
      AK(IAK+3)=CY
      AK(IAK+4)=EMZ
      IAK=IAK+5
      IF(IWPS.LT.0) GO TO 25
      PRINT 12
      DO 25 j=1,KY
      YW=YI+DY*(j-1)
      M=1
      DO 26 I=1,KX
      A(M)=XI+DX*(j-1)
      A(M+1)=YW
      CALL SKOR(A(M),A(M+1),1,N,XB,YB,RB,G,UX,UY,A(M+2),A(M+3))
      A(M+4)=ATAN(A(M+3)/A(M+2))*57.3
      A(M+5)=A(M+2)*A(M+2)+A(M+3)*A(M+3)-1
26    M=M+6
      M=M-1
      PRINT 11
      PRINT 10,(A(I),I=1,M)
25    CONTINUE

: Error: A branch to a do-term-shared-stmt has occurred from outside the range of the corresponding inner-shared-do-construct.   [25]
      DO 25 j=1,KY
---------^

0 Kudos
3 Replies
Steve_Lionel
Black Belt Retired Employee
211 Views

The problem is the "IF(IWPS.LT.0) GO TO 25", which occurs outside of the DO 25 loop. The "25 CONTINUE" is the termination statement of the DO 25 loop and is part of that loop. You're not allowed to jump into a loop from outside it.

Ideally you should use DO..END DO. If you want to skip the loop, add a label to a statement outside the loop.

Interestingly, when I turn your excerpt into a compilable source, I get a different, better error:

t.f90(3): error #6526: A branch to a do-term-shared-stmt has occurred from outside the range of the corresponding inner-shared-do-construct.
      IF(IWPS.LT.0) GO TO 25
--------------------------^

The format of the error you show suggests to me that you are using a VERY old DEC compiler - perhaps even VAX FORTRAN.

LRaim
New Contributor I
211 Views

At that time with a single CONTINUE the programmer was able to save one punched card.

Steve_Lionel
Black Belt Retired Employee
211 Views

This isn't actually shared DO continuation, which is evil, misunderstood and has been deleted from the language.  It's a simple branch into a block from outside that block.

Reply