]> 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 21:54:27 +0000 (22:54 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Sun, 1 Feb 2015 21:54:27 +0000 (22:54 +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: r220335

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

index 3f56ce7f443883a90a75b47f14c9e958af826556..04b33a3cf16f04ac52592822e6d6e7ebdcd40a2a 100644 (file)
@@ -1,3 +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.
+
 2014-12-19  Release Manager
 
        * GCC 4.8.4 released.
index e47c2e5a45395161206d2b406726be5eac7ec789..a608fb6ddc6ff4baf15d67899674e4b9a1b34576 100644 (file)
@@ -5788,7 +5788,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 0287bccee613e5a353a71dcb080ad8b3662209ea..d78cf365d6caf03dd086eec86580a8b18956028c 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-13  Jakub Jelinek  <jakub@redhat.com>
 
        PR fortran/64528
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" } */