https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88024
Bug ID: 88024
Summary: At -O0 and -Og, GCC should warn if you explicitly try
to enable an option that is ignored
Product: gcc
Version: 9.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: driver
Assignee: unassigned at gcc dot gnu.org
Reporter: sandra at gcc dot gnu.org
Target Milestone: ---
While poking at documentation issue PR59658, I realized that there is a code
bug in the handling of optimization options too: there ought to be a
diagnostic if you try to enable an optimization that is completely ignored due
to the different pass lists for -O0 and -Og. E.g.
gcc -O0 -fif-conversion -fshrink-wrap foo.c
ought to warn you that those options have no effect at -O0.
I think this could be fixed by adding some additional properties to the
default_options_table in opts.c, which would have the additional benefit of
making it easier to document (and maintain the documentation for) these
options.