News:

As usual while waiting for the next release - don't forget to check the nightly builds in the forum.

Main Menu

How to initialize all local variables to zero in fortran

Started by Manuel, July 06, 2019, 01:38:55 AM

Previous topic - Next topic

Manuel

Hello, I'm trying to convert an old program from fortran 77  to fortran 90, but the program has a lot of nested subroutines, I changed the way local and global variables worked but the problem is that while calling a subroutine some variables could contain massive numbers like 2.0155e+285 it could be a scalar double precision or an array. I could identify the local variables and initialize it to zero, but this program contains more than 60 subroutines, so I was thinking if there is a way to initialize automatically those local variables to zero. I quick search send me to this link: https://www.cleancss.com/explain-command/gfortran/82451, but I dont know how to insert this command -finit-local-zero into code blocks. Any help would be appreciated!!

gd_on

add your option in the project build option.
To do that, right clic in the workspace arrea on the name of your project (so you must use a project to generate your code).
Chhose Build Option... in the menu, you should see a window with your fortran compiler seeting (GNU fortran for me), select "Other options" at general level (or debug or relaease depending how your project is set), then add your option.

gd_on
Windows 11 64 bits (25H2), svn C::B (last version or almost!), wxWidgets 3.3.2, Msys2 Compilers 16.1.0, 64 bits (seh, posix : gcc, g++ and gfortran in C:\msys64\mingw64) or 32 bits (dwarf2, posix  in C:\msys64\mingw32).

Manuel