Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Loop bounds changed in loop #208

Open
Beliavsky opened this issue Dec 7, 2024 · 0 comments
Open

Loop bounds changed in loop #208

Beliavsky opened this issue Dec 7, 2024 · 0 comments
Labels
rule A new rule for the linter

Comments

@Beliavsky
Copy link

Since the # of iterations in a loop is set at the beginning of the loop, the code

implicit none
integer :: i, n
n = 3
do i=1,n
   n = n-1
   print*,i,n
end do
end

is valid, giving

           1           2
           2           1
           3           0

but it is confusing, so fortitude could warn about reassigning loop bound variables within a loop.

@ZedThree ZedThree added the rule A new rule for the linter label Dec 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
rule A new rule for the linter
Projects
None yet
Development

No branches or pull requests

2 participants