re PR c++/78647 (ICE on invalid C++ code on x86_64-linux-gnu (internal compiler error...
authorMarek Polacek <polacek@redhat.com>
Mon, 12 Dec 2016 17:58:00 +0000 (17:58 +0000)
committerMarek Polacek <mpolacek@gcc.gnu.org>
Mon, 12 Dec 2016 17:58:00 +0000 (17:58 +0000)
PR c++/78647
* c-common.c (attribute_fallthrough_p): Return false for
error_mark_node.

* g++.dg/parse/error58.C: New.

From-SVN: r243575

gcc/c-family/ChangeLog
gcc/c-family/c-common.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/parse/error58.C [new file with mode: 0644]

index d6e1b8b15b04735e013bdc3e6ce9ef39a5062721..547edadab3d6d5095f635c42bfa6e82aa54b534e 100644 (file)
@@ -1,3 +1,9 @@
+2016-12-12  Marek Polacek  <polacek@redhat.com>
+
+       PR c++/78647
+       * c-common.c (attribute_fallthrough_p): Return false for
+       error_mark_node.
+
 2016-12-08  Martin Sebor  <msebor@redhat.com>
 
        PR c/78284
index 0749361fb4414e3197ff38638b0fd8655e2c8ae8..c8e1f0da3c100e57466cdb9643dc1348439ae45d 100644 (file)
@@ -5558,6 +5558,8 @@ parse_optimize_options (tree args, bool attr_p)
 bool
 attribute_fallthrough_p (tree attr)
 {
+  if (attr == error_mark_node)
+   return false;
   tree t = lookup_attribute ("fallthrough", attr);
   if (t == NULL_TREE)
     return false;
index f1f518411db54709784313988a3c987c2d8ec926..d6657b574d9f1aca778327aae057a59433a2a779 100644 (file)
@@ -1,3 +1,8 @@
+2016-12-12  Marek Polacek  <polacek@redhat.com>
+
+       PR c++/78647
+       * g++.dg/parse/error58.C: New.
+
 2016-12-12  David Malcolm  <dmalcolm@redhat.com>
 
        PR preprocessor/78680
diff --git a/gcc/testsuite/g++.dg/parse/error58.C b/gcc/testsuite/g++.dg/parse/error58.C
new file mode 100644 (file)
index 0000000..5ed6e1e
--- /dev/null
@@ -0,0 +1,7 @@
+// PR c++/78647
+// { dg-do compile { target c++11 } }
+// { dg-options "-w" }
+
+struct A;
+void foo ();
+void f() { alignas (foo (A)); } // { dg-error "expected" "" }