public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc(refs/users/marxin/heads/PR100504-target_clones-non-str)] attributes: target_clone expects a string argument
@ 2021-05-13 12:04 Martin Liska
0 siblings, 0 replies; only message in thread
From: Martin Liska @ 2021-05-13 12:04 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:d5177ceb9a05cb43a7555fe520a3a1e19e6cd201
commit d5177ceb9a05cb43a7555fe520a3a1e19e6cd201
Author: Martin Liska <mliska@suse.cz>
Date: Thu May 13 13:59:59 2021 +0200
attributes: target_clone expects a string argument
PR middle-end/100504
gcc/c-family/ChangeLog:
* c-attribs.c (handle_target_clones_attribute): Expect a string
argument to target_clone argument.
gcc/testsuite/ChangeLog:
* gcc.target/i386/pr100504.c: New test.
Diff:
---
gcc/c-family/c-attribs.c | 6 ++++++
gcc/testsuite/gcc.target/i386/pr100504.c | 7 +++++++
2 files changed, 13 insertions(+)
diff --git a/gcc/c-family/c-attribs.c b/gcc/c-family/c-attribs.c
index c1f652d1dc9..9905ee56947 100644
--- a/gcc/c-family/c-attribs.c
+++ b/gcc/c-family/c-attribs.c
@@ -5300,6 +5300,12 @@ handle_target_clones_attribute (tree *node, tree name, tree ARG_UNUSED (args),
"with %qs attribute", name, "target");
*no_add_attrs = true;
}
+ else if (TREE_CODE (TREE_VALUE (args)) != STRING_CST)
+ {
+ error ("%qE attribute argument not a string constant", name);
+ *no_add_attrs = true;
+ }
+
else
/* Do not inline functions with multiple clone targets. */
DECL_UNINLINABLE (*node) = 1;
diff --git a/gcc/testsuite/gcc.target/i386/pr100504.c b/gcc/testsuite/gcc.target/i386/pr100504.c
new file mode 100644
index 00000000000..2910dfb948b
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr100504.c
@@ -0,0 +1,7 @@
+/* PR middle-end/100504 */
+/* { dg-do compile } */
+
+__attribute__((target_clones(0)))
+foo()
+{ /* { dg-error ".target_clones. attribute argument not a string constant" } */
+}
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2021-05-13 12:04 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-13 12:04 [gcc(refs/users/marxin/heads/PR100504-target_clones-non-str)] attributes: target_clone expects a string argument Martin Liska
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).