aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2015-02-01 21:54:27 +0000
committerJakub Jelinek <jakub@redhat.com>2015-02-01 21:54:27 +0000
commit33ac2f9eca85a46ab0d4b0e1943e71a6bb386037 (patch)
tree6d22362732417e5f8c8d6c9fc75444891cde8e4a
parent3c7bcb6cbeae668b84164bdef7b7e702f0dcab8d (diff)
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. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@220335 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/c/ChangeLog9
-rw-r--r--gcc/c/c-typeck.c3
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.dg/pr64766.c9
4 files changed, 25 insertions, 1 deletions
diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog
index 3f56ce7f443..04b33a3cf16 100644
--- a/gcc/c/ChangeLog
+++ b/gcc/c/ChangeLog
@@ -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.
diff --git a/gcc/c/c-typeck.c b/gcc/c/c-typeck.c
index e47c2e5a453..a608fb6ddc6 100644
--- a/gcc/c/c-typeck.c
+++ b/gcc/c/c-typeck.c
@@ -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);
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 0287bccee61..d78cf365d6c 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -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
index 00000000000..bf6fb2d5905
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr64766.c
@@ -0,0 +1,9 @@
+/* PR c/64766 */
+/* { dg-do compile } */
+
+void
+foo ()
+{
+}
+
+void foo () = 0; /* { dg-error "is initialized like a variable|invalid initializer" } */