https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69981
--- Comment #4 from David L. <equinox-gccbugs at diac24 dot net> ---
Argh, for some reason this submitted in the middle of editing...
Poking around a bit, in wrapup_global_declaration_2() in gcc/toplev.c, the
check for
else if (TREE_READONLY (decl) && !TREE_PUBLIC (decl)
&& (optimize || !flag_keep_static_consts
|| DECL_ARTIFICIAL (decl)))
is never hit because the earlier
else if (node && node->definition)
needed = false;
is taken (on both -O0 or -O1).
Thus, the value of flag_keep_static_consts is irrelevant (and this is the only
place in the code where it's used...)