aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorPaolo Carlini <paolo.carlini@oracle.com>2018-01-17 21:29:59 +0000
committerPaolo Carlini <paolo@gcc.gnu.org>2018-01-17 21:29:59 +0000
commita533fc76359bf0dfedc15be83f0bfd886712a4b3 (patch)
tree430af7bf91a8a2e202b8b9ecc34ce4bbe0117166 /gcc
parent06b6c6306496e29005a8d34a7232c23846ac564e (diff)
downloadgcc-a533fc76359bf0dfedc15be83f0bfd886712a4b3.zip
gcc-a533fc76359bf0dfedc15be83f0bfd886712a4b3.tar.gz
gcc-a533fc76359bf0dfedc15be83f0bfd886712a4b3.tar.bz2
re PR c++/78344 (ICE on invalid c++ code on x86_64-linux-gnu (internal compiler error: tree check: expected tree_list, have error_mark in cp_check_const_attributes, at cp/decl2.c:1347))
/cp 2018-01-17 Paolo Carlini <paolo.carlini@oracle.com> PR c++/78344 * decl.c (grokdeclarator): Do not append the error_mark_node due to an erroneous optional attribute-specifier-seq. /testsuite 2018-01-17 Paolo Carlini <paolo.carlini@oracle.com> PR c++/78344 * g++.dg/cpp0x/alignas13.C: New. From-SVN: r256821
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog6
-rw-r--r--gcc/cp/decl.c12
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/alignas13.C5
4 files changed, 25 insertions, 3 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 0d73c5b..5978a64 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,9 @@
+2018-01-17 Paolo Carlini <paolo.carlini@oracle.com>
+
+ PR c++/78344
+ * decl.c (grokdeclarator): Do not append the error_mark_node
+ due to an erroneous optional attribute-specifier-seq.
+
2018-01-17 Jakub Jelinek <jakub@redhat.com>
PR c++/83897
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index 148afa6..12022a2 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -11491,9 +11491,15 @@ grokdeclarator (const cp_declarator *declarator,
&& declarator->kind == cdk_id
&& declarator->std_attributes
&& attrlist != NULL)
- /* [dcl.meaning]/1: The optional attribute-specifier-seq following
- a declarator-id appertains to the entity that is declared. */
- *attrlist = chainon (*attrlist, declarator->std_attributes);
+ {
+ /* [dcl.meaning]/1: The optional attribute-specifier-seq following
+ a declarator-id appertains to the entity that is declared. */
+ if (declarator->std_attributes != error_mark_node)
+ *attrlist = chainon (*attrlist, declarator->std_attributes);
+ else
+ /* We should have already diagnosed the issue (c++/78344). */
+ gcc_assert (seen_error ());
+ }
/* Handle parameter packs. */
if (parameter_pack_p)
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 96495d9..364d044 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2018-01-17 Paolo Carlini <paolo.carlini@oracle.com>
+
+ PR c++/78344
+ * g++.dg/cpp0x/alignas13.C: New.
+
2018-01-17 Jakub Jelinek <jakub@redhat.com>
PR c++/83897
diff --git a/gcc/testsuite/g++.dg/cpp0x/alignas13.C b/gcc/testsuite/g++.dg/cpp0x/alignas13.C
new file mode 100644
index 0000000..4811b03
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/alignas13.C
@@ -0,0 +1,5 @@
+// PR c++/78344
+// { dg-do compile { target c++11 } }
+
+alignas(double) int f alignas; // { dg-error "30:expected '\\('" }
+alignas(double) int g alignas(double; // { dg-error "37:expected '\\)'" }