i386: Check error_mark_node in multiversioning
Since CET is applied to the whole program, it is correct to disallow
-fcf-protection=full without -mcet. But compiler shouldn't crash.
gcc/
PR target/85403
* config/i386/i386.c (get_builtin_code_for_version): Check
error_mark_node.
gcc/testsuite/
PR target/85403
* gcc.target/i386/pr85403.c: New test.
---
gcc/config/i386/i386.c | 2 ++
gcc/testsuite/g++.dg/ext/mv1.C | 2 +-
gcc/testsuite/g++.dg/ext/mv14.C | 2 +-
gcc/testsuite/g++.dg/ext/mv15.C | 2 +-
gcc/testsuite/g++.dg/ext/mv16.C | 2 +-
gcc/testsuite/g++.dg/ext/mv17.C | 2 +-
gcc/testsuite/g++.dg/ext/mv18.C | 2 +-
gcc/testsuite/g++.dg/ext/mv19.C | 2 +-
gcc/testsuite/g++.dg/ext/mv20.C | 2 +-
gcc/testsuite/g++.dg/ext/mv21.C | 2 +-
gcc/testsuite/g++.dg/ext/mv22.C | 2 +-
gcc/testsuite/g++.dg/ext/mv23.C | 2 +-
gcc/testsuite/g++.dg/ext/mv26.C | 1 +
gcc/testsuite/g++.dg/ext/mv6.C | 2 +-
gcc/testsuite/g++.dg/ext/mvc1.C | 1 +
gcc/testsuite/gcc.target/i386/cet-notrack-icf-1.c | 2 +-
gcc/testsuite/gcc.target/i386/cet-notrack-icf-3.c | 2 +-
gcc/testsuite/gcc.target/i386/cet-property-2.c | 2 +-
gcc/testsuite/gcc.target/i386/mvc1.c | 1 +
gcc/testsuite/gcc.target/i386/mvc10.c | 1 +
gcc/testsuite/gcc.target/i386/mvc11.c | 2 +-
gcc/testsuite/gcc.target/i386/mvc6.c | 2 +-
gcc/testsuite/gcc.target/i386/mvc7.c | 1 +
gcc/testsuite/gcc.target/i386/mvc8.c | 2 +-
gcc/testsuite/gcc.target/i386/mvc9.c | 2 +-
gcc/testsuite/gcc.target/i386/pr81213.c | 1 +
gcc/testsuite/gcc.target/i386/pr81214.c | 1 +
gcc/testsuite/gcc.target/i386/pr85403.c | 10 ++++++++++
gcc/testsuite/gcc.target/i386/sse-26.c | 2 +-
29 files changed, 39 insertions(+), 20 deletions(-)
create mode 100644 gcc/testsuite/gcc.target/i386/pr85403.c
diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index
6fa5b0add02..
8a73fc0d316 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -32344,6 +32344,8 @@ get_builtin_code_for_version (tree decl, tree *predicate_list)
&global_options_set);
gcc_assert (target_node);
+ if (target_node == error_mark_node)
+ return 0;
new_target = TREE_TARGET_OPTION (target_node);
gcc_assert (new_target);
diff --git a/gcc/testsuite/gcc.target/i386/pr85403.c b/gcc/testsuite/gcc.target/i386/pr85403.c
new file mode 100644
index
00000000000..
f4fb12dd4e2
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr85403.c
@@ -0,0 +1,10 @@
+/* { dg-do compile } */
+/* { dg-options "-fcf-protection -mcet" } */
+/* { dg-require-ifunc "" } */
+
+__attribute__((target_clones("avx","arch=slm","arch=core-avx2","default")))
+int
+foo ()
+{
+ return -2;
+} /* { dg-error "requires Intel CET support" } */
From-SVN: r259400