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

Named do loop in fortran

kadahira
Beginner
2,828 Views

here is my code

if (plot_default == 1) then ! Add default list 1

dflt1: do l = 1, size(plt_lst1)

i = 1

do while (i .le. siz_me_list)

if (plt_lst1(l) .eq. me_list(i)%me_flag) then

plot_list(j + k) = plt_lst1(l)

k = k + 1

num_plot = num_plot + 1

cycle dflt1

else

i = i + 1

end if

end do

end do dflt1

else if (plot_default == 2) then ! Add default list 2

dflt2: do l = 1, size(plt_lst2)

i = 1

do while (i .le. siz_me_list)

if (plt_lst2(l) .eq. me_list(i)%me_flag) then

plot_list(j + k) = plt_lst2(l)

k = k + 1

num_plot = num_plot + 1

cycle dflt2

else

i = i + 1

end if

end do

end do dflt2

end if


I can compile and run the code without any problem,

My question is regarding portability and any other potential problems
arises due to cycling outer do loop inside inner do loop.

Will there be any potential problem due to changing outerloop inside inner loop

0 Kudos
1 Reply
Steven_L_Intel1
Employee
2,828 Views
This is all standard Fortran 90. Any compiler that can't handle this is one you should not be using.

When you say "cycle diff2", you are telling the compiler to, effectively, go to the END DO of the loop labeled diff2. This is perfectly fine.
0 Kudos
Reply