Fortran function remembers values (newbie help)

I agree. However, considering how difficult, uncertain and lengthy this process would be, more pragmatically we should in parallel lobby compiler vendors to offer a switch linked to a flag.

Yet another time, LFortran does the right thing™ by default: kudos.