Excellent, we ended up with the following warning in LFortran after a few iterations:
warning: Assuming implicit save attribute for variable declaration
--> a.f90:2:9
|
2 | real :: var = 0.0
| ^^^^^^^^^ help: add explicit save attribute or parameter attribute or initialize in a separate statement
Which enumerates the same three cases that you mentioned. So this is good.
Perhaps the term “initialize” is a little confusing here. In fortran, “initialize” usually means at compile/link time, not at run time. The third alternative in this situation is a run time assignment statement. That is “initialization” in a mathematical or algorithm context, but not in a fortran context.
@RonShepard thanks for feedback. How would you formulate it, let’s say: “help: add explicit save attribute or parameter attribute or use a separate runtime assignment statement”?
Last time I put SAVE among the specification statements of a subroutine to save everything savable that was declared there, lfortran gave me a lot of warnings I had hoped it wouldn’t, and I had to put things like real,save:: in all the declarations of variables.
Is there a chance that one day we could use something like NO_SAVE where we can now use SAVE if we wanted that effect?