public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Martin Liska <marxin@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc r12-777] attributes: target_clone expects a string argument Date: Thu, 13 May 2021 17:30:59 +0000 (GMT) [thread overview] Message-ID: <20210513173059.A14E53AA9022@sourceware.org> (raw) https://gcc.gnu.org/g:9feb5822b713c6a12cb290ba0406ba2362d4c09c commit r12-777-g9feb5822b713c6a12cb290ba0406ba2362d4c09c 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 | 7 ++++++- gcc/testsuite/gcc.target/i386/pr100504.c | 7 +++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/gcc/c-family/c-attribs.c b/gcc/c-family/c-attribs.c index c1f652d1dc9..f54388e9939 100644 --- a/gcc/c-family/c-attribs.c +++ b/gcc/c-family/c-attribs.c @@ -5288,7 +5288,12 @@ handle_target_clones_attribute (tree *node, tree name, tree ARG_UNUSED (args), /* Ensure we have a function type. */ if (TREE_CODE (*node) == FUNCTION_DECL) { - if (lookup_attribute ("always_inline", DECL_ATTRIBUTES (*node))) + if (TREE_CODE (TREE_VALUE (args)) != STRING_CST) + { + error ("%qE attribute argument not a string constant", name); + *no_add_attrs = true; + } + else if (lookup_attribute ("always_inline", DECL_ATTRIBUTES (*node))) { warning (OPT_Wattributes, "%qE attribute ignored due to conflict " "with %qs attribute", name, "always_inline"); 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" } */ +}
reply other threads:[~2021-05-13 17:30 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20210513173059.A14E53AA9022@sourceware.org \ --to=marxin@gcc.gnu.org \ --cc=gcc-cvs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).