SAVE statement, according to 8.6.14, must apply to the same scoping unit, that excludes nested scoping units. For example, if the SAVE statement is found in a MODULE, the functions contained in that module should not inherit the SAVE attribute. I think that the code was doing this, failing the following source:
MODULE pippo SAVE CONTAINS PURE FUNCTION fft_stick_index( ) IMPLICIT NONE INTEGER :: fft_stick_index INTEGER :: mc !error: A pure subprogram may not have a variable with the SAVE attribute END FUNCTION END MODULE
It's not clear to me why the call to hasSAVE is necessary at all. In resolve-names.cpp we set the SAVE attribute on the appropriate entities when a SAVE statement is encountered. So the symbol should have the SAVE attribute set here if SAVE is set in the scope.
I think you can remove the call to hasSAVE completely. And since it's the only call, remove the function and related stuff.
@klausler, do you know of any reason we need hasSAVE?