aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/c-c++-common
diff options
context:
space:
mode:
authorLewis Hyatt <lhyatt@gmail.com>2025-01-26 18:57:00 -0500
committerLewis Hyatt <lhyatt@gcc.gnu.org>2025-02-02 10:09:25 -0500
commitc0008df2118233f1afbed76ce308b4dfb6e6fc1a (patch)
tree083fc81256a14e8f5ac2ee1155f2e867705ce87a /gcc/testsuite/c-c++-common
parent427b871394f3c186326a795e6d4664d2c7ad1635 (diff)
downloadgcc-c0008df2118233f1afbed76ce308b4dfb6e6fc1a.zip
gcc-c0008df2118233f1afbed76ce308b4dfb6e6fc1a.tar.gz
gcc-c0008df2118233f1afbed76ce308b4dfb6e6fc1a.tar.bz2
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.
Diffstat (limited to 'gcc/testsuite/c-c++-common')
-rw-r--r--gcc/testsuite/c-c++-common/cpp/pr115913.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/gcc/testsuite/c-c++-common/cpp/pr115913.c b/gcc/testsuite/c-c++-common/cpp/pr115913.c
new file mode 100644
index 0000000..b9d10cd
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/cpp/pr115913.c
@@ -0,0 +1,7 @@
+/* { dg-do preprocess } */
+/* PR middle-end/115913 */
+#pragma GCC push_options
+#pragma GCC diagnostic warning "-Wundef"
+/* The call to cl_optimization_compare performed by pop_options should not
+ lead to a checking failure. */
+#pragma GCC pop_options