]> git.ipfire.org Git - thirdparty/gcc.git/commit
options: Adjust cl_optimization_compare to avoid checking ICE [PR115913]
authorLewis Hyatt <lhyatt@gmail.com>
Sun, 26 Jan 2025 23:57:00 +0000 (18:57 -0500)
committerLewis Hyatt <lhyatt@gcc.gnu.org>
Tue, 4 Feb 2025 13:12:49 +0000 (08:12 -0500)
commit251f6ba9131ebc8deab463c052e099a065796c2a
tree89513a7a19d745dad859c64c4db58b107703fca5
parent11d14c3affedff8b0dd963a902c0d01f50ed1380
options: Adjust cl_optimization_compare to avoid checking ICE [PR115913]

At the end of a sequence like:
 #pragma GCC push_options
 ...
 #pragma GCC pop_options

the handler for pop_options calls cl_optimization_compare() (as generated by
optc-save-gen.awk) to make sure that all global state has been restored to
the value it had prior to the push_options call. The verification is
performed for almost all entries in the global_options struct. This leads to
unexpected checking asserts, as discussed in the PR, in case the state of
warnings-related options has been intentionally modified in between
push_options and pop_options via a call to #pragma GCC diagnostic. Address
that by skipping the verification for CL_WARNING-flagged options.

gcc/ChangeLog:

PR middle-end/115913
* optc-save-gen.awk (cl_optimization_compare): Skip options with
CL_WARNING flag.

gcc/testsuite/ChangeLog:

PR middle-end/115913
* c-c++-common/cpp/pr115913.c: New test.
gcc/optc-save-gen.awk
gcc/testsuite/c-c++-common/cpp/pr115913.c [new file with mode: 0644]