From: Jakub Jelinek Date: Tue, 27 Jan 2015 08:13:45 +0000 (+0100) Subject: re PR middle-end/64766 (internal compiler error: tree check: expected block, have... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=dea63e49fa986d91885d192fae0a5c19fea77aa1;p=gcc.git re PR middle-end/64766 (internal compiler error: tree check: expected block, have error_mark in lower_function_body, at gimple-low.c:122) 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: r220152 --- diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog index f361e7cb77f..408fc163ab7 100644 --- a/gcc/c/ChangeLog +++ b/gcc/c/ChangeLog @@ -1,3 +1,9 @@ +2015-01-27 Jakub Jelinek + + 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 PR c/64778 diff --git a/gcc/c/c-typeck.c b/gcc/c/c-typeck.c index 09b1bdf3893..aa74968d28b 100644 --- a/gcc/c/c-typeck.c +++ b/gcc/c/c-typeck.c @@ -6422,7 +6422,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 c66df2007d6..57a58b40a14 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2015-01-27 Jakub Jelinek + + PR c/64766 + * gcc.dg/pr64766.c: New test. + 2015-01-26 Oleg Endo PR target/49263 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" } */