https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69981
--- Comment #2 from David L. <equinox-gccbugs at diac24 dot net> ---
(In reply to Jakub Jelinek from comment #1)
> I disagree, removing static consts is an optimization, if you tell the
> compiler not to optimize, it doesn't perform the optimizations.
Documentation bug then? It says it's independent of optimization.
-fkeep-static-consts
Emit variables declared static const when optimization isn't turned on,
even if the variables aren't referenced.
GCC enables this option by default. If you want to force the compiler to
check if a variable is referenced, regardless of whether or not
optimization
is turned on, use the -fno-keep-static-consts option.