summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2016-02-19 16:01:50 +0000
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2016-02-19 16:01:50 +0000
commita45bce11aed43b1e9dec7731d787fc2d664a32a5 (patch)
treee5a018c85eb5153fd7dee63c69b092e027fefa0c
parentcf2ed1b7a02dae9dfc6e3c19ce81626ab5643f42 (diff)
downloadgcc-a45bce11aed43b1e9dec7731d787fc2d664a32a5.tar.gz
PR c++/67767
* parser.c (cp_parser_std_attribute_spec_seq): Don't assume attr_spec is always single element chain, chain all the attributes properly together in the right order. * g++.dg/cpp0x/pr67767.C: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@233560 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/cp/ChangeLog7
-rw-r--r--gcc/cp/parser.c11
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/pr67767.C10
4 files changed, 29 insertions, 4 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 96150be59f2..12a3967114a 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,10 @@
+2016-02-19 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/67767
+ * parser.c (cp_parser_std_attribute_spec_seq): Don't assume
+ attr_spec is always single element chain, chain all the attributes
+ properly together in the right order.
+
2016-02-18 Jason Merrill <jason@redhat.com>
* mangle.c (maybe_check_abi_tags): Add for_decl parm. Call
diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index 18f390206d0..53decdc1617 100644
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -24104,7 +24104,8 @@ cp_parser_std_attribute_spec (cp_parser *parser)
static tree
cp_parser_std_attribute_spec_seq (cp_parser *parser)
{
- tree attr_specs = NULL;
+ tree attr_specs = NULL_TREE;
+ tree attr_last = NULL_TREE;
while (true)
{
@@ -24114,11 +24115,13 @@ cp_parser_std_attribute_spec_seq (cp_parser *parser)
if (attr_spec == error_mark_node)
return error_mark_node;
- TREE_CHAIN (attr_spec) = attr_specs;
- attr_specs = attr_spec;
+ if (attr_last)
+ TREE_CHAIN (attr_last) = attr_spec;
+ else
+ attr_specs = attr_last = attr_spec;
+ attr_last = tree_last (attr_last);
}
- attr_specs = nreverse (attr_specs);
return attr_specs;
}
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 604bb3c27da..f916c9c7cde 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2016-02-19 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/67767
+ * g++.dg/cpp0x/pr67767.C: New test.
+
2016-02-19 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
* lib/target-supports.exp: Define aarch64_asm_FUNC_ok checks
diff --git a/gcc/testsuite/g++.dg/cpp0x/pr67767.C b/gcc/testsuite/g++.dg/cpp0x/pr67767.C
new file mode 100644
index 00000000000..fd4ae2d3f35
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/pr67767.C
@@ -0,0 +1,10 @@
+// PR c++/67767
+// { dg-do compile { target c++11 } }
+// { dg-options "-Wsuggest-attribute=noreturn" }
+
+void foo [[gnu::cold, gnu::noreturn]] ();
+
+void foo () // { dg-bogus "function might be candidate for attribute" }
+{
+ throw 1;
+}