fix Issue 9309 - Regression (2.061): -O -release generates wrong code

In current, all nested functions should be weak purity at most.
Merge pull request #1474 from 9rnsr/fix9309

Issue 9309 - Regression (2.061): -O -release generates wrong code