aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorAndrew Pinski <pinskia@physics.uc.edu>2003-12-22 18:16:56 +0000
committerAndrew Pinski <pinskia@gcc.gnu.org>2003-12-22 10:16:56 -0800
commitaf3fbed11080efd038c3c6185b51891a72852b31 (patch)
tree048f12d869c915b72cbee5312c2f7021f104637b /gcc
parent2d6c4025cc779a00702e96fb9e524a2b7e3a7511 (diff)
downloadgcc-af3fbed11080efd038c3c6185b51891a72852b31.zip
gcc-af3fbed11080efd038c3c6185b51891a72852b31.tar.gz
gcc-af3fbed11080efd038c3c6185b51891a72852b31.tar.bz2
re PR c/9163 (ICE in genrtl_compound_stmt at c-semantics.c:776 with c99 mode and checking enabled)
2003-12-22 Andrew Pinski <pinskia@physics.uc.edu> PR c/9163 * c-decl.c (poplevel): Only set DECL_INITIAL of a current function if it is non-null. (finish_function): Check for error_mark_node or null on DECL_RESULT and DECL_RESULT of fndecl. (c_expand_body): Only expand when DECL_INITIAL of fndecl is not error_mark_node and not null. 2003-12-22 Andrew Pinski <pinskia@physics.uc.edu> PR c/9163 * gcc.dg/20031222-1.c: New test. From-SVN: r74934
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog10
-rw-r--r--gcc/c-decl.c14
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.dg/20031222-1.c18
4 files changed, 42 insertions, 5 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 9c94cf1..60244ba 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,13 @@
+2003-12-22 Andrew Pinski <pinskia@physics.uc.edu>
+
+ PR c/9163
+ * c-decl.c (poplevel): Only set DECL_INITIAL of a current function
+ if it is non-null.
+ (finish_function): Check for error_mark_node or null on DECL_RESULT and
+ DECL_RESULT of fndecl.
+ (c_expand_body): Only expand when DECL_INITIAL of fndecl is not
+ error_mark_node and not null.
+
2003-12-21 Dan Nicolaescu <dann@ics.uci.edu>
* rtl.h (dump_rtx_statistics): Declare it.
diff --git a/gcc/c-decl.c b/gcc/c-decl.c
index 7e426ab..65e7176 100644
--- a/gcc/c-decl.c
+++ b/gcc/c-decl.c
@@ -676,7 +676,7 @@ poplevel (int keep, int dummy ATTRIBUTE_UNUSED, int functionbody)
IDENTIFIER_TAG_VALUE (TREE_PURPOSE (p)) = TREE_VALUE (p);
/* Dispose of the block that we just made inside some higher level. */
- if (scope->function_body)
+ if (scope->function_body && current_function_decl)
DECL_INITIAL (current_function_decl) = block;
else if (scope->outer)
{
@@ -6088,11 +6088,13 @@ finish_function (void)
}
}
- BLOCK_SUPERCONTEXT (DECL_INITIAL (fndecl)) = fndecl;
+ if (DECL_INITIAL (fndecl) != error_mark_node && DECL_INITIAL (fndecl))
+ BLOCK_SUPERCONTEXT (DECL_INITIAL (fndecl)) = fndecl;
/* Must mark the RESULT_DECL as being in this function. */
- DECL_CONTEXT (DECL_RESULT (fndecl)) = fndecl;
+ if (DECL_RESULT (fndecl) != error_mark_node && DECL_RESULT (fndecl))
+ DECL_CONTEXT (DECL_RESULT (fndecl)) = fndecl;
if (MAIN_NAME_P (DECL_NAME (fndecl)) && flag_hosted)
{
@@ -6192,7 +6194,7 @@ c_expand_body_1 (tree fndecl, int nested_p)
/* Squirrel away our current state. */
push_function_context ();
}
-
+
tree_rest_of_compilation (fndecl, nested_p);
if (nested_p)
@@ -6223,7 +6225,9 @@ c_expand_body_1 (tree fndecl, int nested_p)
void
c_expand_body (tree fndecl)
{
- c_expand_body_1 (fndecl, 0);
+
+ if (DECL_INITIAL (fndecl) != error_mark_node && DECL_INITIAL (fndecl))
+ c_expand_body_1 (fndecl, 0);
}
/* Check the declarations given in a for-loop for satisfying the C99
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index d96d8c6..3d9d88a 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2003-12-22 Andrew Pinski <pinskia@physics.uc.edu>
+
+ PR c/9163
+ * gcc.dg/20031222-1.c: New test.
+
2003-12-21 Mark Mitchell <mark@codesourcery.com>
PR c++/13438
diff --git a/gcc/testsuite/gcc.dg/20031222-1.c b/gcc/testsuite/gcc.dg/20031222-1.c
new file mode 100644
index 0000000..b0d1a2d
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/20031222-1.c
@@ -0,0 +1,18 @@
+/* PR c/9163 */
+/* The following test used to ICE after an error message in C99 mode
+ because GCC was trying to expand the tree to rtl. */
+
+/* { dg-do compile } */
+/* { dg-options "-std=c99" } */
+
+
+
+void f ()
+{
+ for (; int ; ); /* { dg-error "" } */
+}
+
+void foo ()
+{
+ while (int i); /* { dg-error "" } */
+}