Quantcast
Viewing all articles
Browse latest Browse all 415

Cycling an unnamed do concurrent loop

Hi,

why isn't the compiler associating the following cycle statement with the appropriate do concurrent loop?:

program test
    implicit none
    integer :: i,j,k

    do concurrent (i=1:10000)
        k=-10
        do j=1,i
            k=k+k**j
        end do
        if (mod(i,3).eq.0) then
            k=int(sqrt(real(k)))
            write(*,*)'For i = ',i,', k set to ',k,', cycling'
            cycle
        end if
        write(*,*)'Block ended with i = ',i
    end do
end program

I get the error:

cycletest.f90(13): error #6602: A CYCLE or EXIT statement must not be used with a non-DO block.
            cycle
------------^
compilation aborted for cycletest.f90 (code 1)

It works when I name the loop and cycle it with its name (tested with ifort 17.0).

Thanks for help!

 


Viewing all articles
Browse latest Browse all 415

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>