http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60549
Bug ID: 60549 Summary: [4.9 Regression] Run time doubled for fatigue.f90 due to SAVE changes Product: gcc Version: 4.9.0 Status: UNCONFIRMED Keywords: missed-optimization Severity: normal Priority: P3 Component: fortran Assignee: unassigned at gcc dot gnu.org Reporter: burnus at gcc dot gnu.org Follow up to PR 55207 and to r208590; see http://gcc.gnu.org/ml/fortran/2014-03/msg00108.html Since r208590, the execution time of Polyhedron's fatigue.f90 doubled from ~1.4s to ~2.9s. I have not closely looked at fatigue.f90, however, I believe that this is due to the following: Fatigue's main program has internal procedures, which access variables defined in the main program. As static variables usually global variables, GCC does not a good job at optimizing static variables - even if it could in case they are defined within one function only. Possible solution: Small variables [of the MAIN program only!] should be (again) created on the stack - possibly even (new!) when they do have an explicitly set SAVE attribute. I think that's especially relevant for integer and real variables. I think it is impossible to see the difference from within the program; the only exception are __attribute__((destructor)) - thus, if one wants to play safe is to exclude those with TARGET attribute.