Loop variable reaching integer `huge` causes infinite loop

I forgot to mention, also use -fcheck=all

At runtime for the test case given, it detects the infinite loop and throws an error.
.
.
.
i= 122 b=01111010
i= 123 b=01111011
i= 124 b=01111100
i= 125 b=01111101
i= 126 b=01111110
At line 4 of file looper.f90
Fortran runtime error: Loop iterates infinitely

gfortran is a very good compiler. It is not perfect. We have not implemented the -fwrite-my-code-for-me option yet.

Cheers

2 Likes