I study Fortran on the book "Chapman: Fortran 95/2003 for Scientists and Engineers, Third Edition". Chapter 6 (about arrays) says that in Fortran compilers, you can turn on checking for overrun of an array:

If you’re on the road, you’ll find out. It can be turned down.

I checked it on my compiler (GNU Fortran Compller) - I have the option to check for overrunning an array off.

What you need to click, which console to run, in order to enter control commands for off / on. compiler options? (in particular, you need to enable the option to check the output of the array in the compiler)

I use the environment Code Blocks + MinGw (GNU Fortran Compller).

  • If you are given an exhaustive answer, mark it as correct (a daw opposite the selected answer). - Nicolas Chabanovsky ♦

2 answers 2

In the menu, select Settings - Compiler ..., a window will appear in which you should select the GNU Fortran Compiler at the top, and a little lower check the box for array subscripts:

enter image description here

Then you need to rebuild the project.

  • Thank you very much, @Wildcat, for your help. Now it became clear how you can change the compiler settings. - foxis

according to the documentation , the compiler must pass an option

-fcheck=bounds 

This is a list of the minimum and maximum values.

my free translation:

Allow the generation of run-time control for array indices and declared minimum and maximum values.


about codeblocks : probably, you can manually specify the compiler options somewhere in the area of ​​the “other options” tab (do not pay attention to the arrow - this is just a picture found on the network):

enter image description here

  • Thank you very much, @alexander barakin, for your help. - foxis