https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71523
Bug ID: 71523 Summary: Static variables given automatic initializers with -finit-* and -fmax-stack-var-size Product: gcc Version: 7.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran Assignee: unassigned at gcc dot gnu.org Reporter: fritzoreese at gmail dot com Target Milestone: --- This bug is similar to pr41860. When a variable becomes static due to being larger than -fmax-stack-var-size, the variable is still given an automatic initializer on entry to its namespace by the -finit-* flags (-finit-integer, -finit-local-zero, etc...) This is probably an oversight due to the fact that the initializers are generated at resolution time in resolve.c, but the size of the variable is not known until translation time (in trans-decl.c). S.A. the thread at https://gcc.gnu.org/ml/fortran/2016-06/msg00023.html