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

Exit statement from block results in error #6604

avinashs
New Contributor I
793 Views

I have a simple block construct:

BLKF: block
  call fcn(x, f, flag)
  nf = nf + 1
  if (flag < 0) then
     exit BLKF
  end if
  phi = f**2
end block BLKF

Using Intel Parallel Studio XE 2015 for Windows, the following error is generated causing compilation to be aborted:

Error 1  error #6604: The CYCLE or EXIT statement must belong to a particular DO construct, and they do not.

Apparently, exit statements are not allowed in blocks. However, it was my understanding that it is one of the major benefits of using a block.

Any help will be greatly appreciated in this regard.

Best,

Avinash


 

0 Kudos
5 Replies
FortranFan
Honored Contributor III
793 Views

See this and this 

0 Kudos
Steven_L_Intel1
Employee
793 Views

This has been implemented for the 16.0 compiler, which you can get a beta version of. In Fortran 2008, EXIT can be used in any block construct. The 16.0 compiler allows it in BLOCK only - in the future that will be expanded.

0 Kudos
FortranFan
Honored Contributor III
793 Views

Steve Lionel (Intel) wrote:

This has been implemented for the 16.0 compiler, which you can get a beta version of. In Fortran 2008, EXIT can be used in any block construct. The 16.0 compiler allows it in BLOCK only - in the future that will be expanded.

That's great news, Steve.  I didn't notice it in the Release Notes nor the browser-based documentation, so I assumed it was not implemented yet.

0 Kudos
Steven_L_Intel1
Employee
793 Views

Ah, it didn't make the initial beta. It will be in the beta update.

0 Kudos
avinashs
New Contributor I
793 Views

Thank-you everyone for the helpful answers.

0 Kudos
Reply