]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
backport: re PR middle-end/64766 (internal compiler error: tree check: expected block...
authorJakub Jelinek <jakub@redhat.com>
Sun, 1 Feb 2015 17:36:26 +0000 (18:36 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Sun, 1 Feb 2015 17:36:26 +0000 (18:36 +0100)
Backported from mainline
2015-01-27  Jakub Jelinek  <jakub@redhat.com>

PR c/64766
* c-typeck.c (store_init_value): Don't overwrite DECL_INITIAL
of FUNCTION_DECLs with error_mark_node.

* gcc.dg/pr64766.c: New test.

From-SVN: r220327

gcc/c/ChangeLog
gcc/c/c-typeck.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/pr64766.c [new file with mode: 0644]

index 4185d98365984a37af24ac801d26a786323810be..57be674171d228da39448825b8e1c59777ef2428 100644 (file)
@@ -1,6 +1,12 @@
 2015-02-01  Jakub Jelinek  <jakub@redhat.com>
 
        Backported from mainline
+       2015-01-27  Jakub Jelinek  <jakub@redhat.com>
+
+       PR c/64766
+       * c-typeck.c (store_init_value): Don't overwrite DECL_INITIAL
+       of FUNCTION_DECLs with error_mark_node.
+
        2015-01-26  Jakub Jelinek  <jakub@redhat.com>
 
        PR c/64778
index 166c4d57401a90b1987c2549676b2594d5106e0b..2a335ae33bf1bad1d9bf1a86eca0bead56c36845 100644 (file)
@@ -6249,7 +6249,8 @@ store_init_value (location_t init_loc, tree decl, tree init, tree origtype)
     warning (OPT_Wtraditional, "traditional C rejects automatic "
             "aggregate initialization");
 
-  DECL_INITIAL (decl) = value;
+  if (value != error_mark_node || TREE_CODE (decl) != FUNCTION_DECL)
+    DECL_INITIAL (decl) = value;
 
   /* ANSI wants warnings about out-of-range constant initializers.  */
   STRIP_TYPE_NOPS (value);
index 8cab2d3fd6949584bb935ae473e4570a92ddf632..193f611bbd6e5ee258bdd535bc078ac9a191ce38 100644 (file)
@@ -1,6 +1,11 @@
 2015-02-01  Jakub Jelinek  <jakub@redhat.com>
 
        Backported from mainline
+       2015-01-27  Jakub Jelinek  <jakub@redhat.com>
+
+       PR c/64766
+       * gcc.dg/pr64766.c: New test.
+
        2015-01-26  Jakub Jelinek  <jakub@redhat.com>
 
        PR c/64778
diff --git a/gcc/testsuite/gcc.dg/pr64766.c b/gcc/testsuite/gcc.dg/pr64766.c
new file mode 100644 (file)
index 0000000..bf6fb2d
--- /dev/null
@@ -0,0 +1,9 @@
+/* PR c/64766 */
+/* { dg-do compile } */
+
+void
+foo ()
+{
+}
+
+void foo () = 0; /* { dg-error "is initialized like a variable|invalid initializer" } */