Where to enter gnu fortran (MinGW) compiler commands) + CodeBlocks
I study Fortran from the book "Chapman: Fortran 95/2003 for Scientists and Engineers, Third Edition". In chapter 6 (about arrays) , it says that fortran compilers can enable checking for going beyond the array boundary:
Always turn on the bounds checking option on your Fortran compiler during program development and debugging to help you catch programming errors producing out-of-bounds references. The bounds-checking option may be turned off if necessary for greater speed in the final program.
I checked it on my compiler (GNU Fortran Compller) - I have the option to check for going beyond the array boundary turned off.
What do I need to click, which console to launch 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 boundary in the compiler)
I use the Code Blocks + MinGW environment ( GNU Fortran Compller).
2 answers
In the menu, select Settings-Compiler..., a window will appear there, in which you need to select GNU Fortran Compiler at the top, and just below put a check mark Run-time check for array subscriptions:
Then you need to rebuild the project.
According to the documentation, the compiler must pass the option
-fcheck=bounds
Enable generation of run-time checks for array subscripts and against the declared minimum and maximum values.
My free translation:
Allow generation of run-time control for array indexes 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 (don't pay attention to the arrow-it's just a picture found on the web):