This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c/9163] [3.3/3.4 regression] ICE in genrtl_compound_stmt at c-semantics.c:776 with c99 mode and checking enabled


------- Additional Comments From pinskia at gcc dot gnu dot org  2003-12-22 16:07 -------
Since my email has not come through yet (why?):
ChangeLog:

	* c-decl.c (poplevel): Only set DECL_INITIAL of a current function
	if it is non-null.
	(finish_function): Check for error_mark_node on DECL_RESULT and DECL_RESULT
	of fndecl.
	(c_expand_body): Only expand when DECL_INITIAL of fndecl is not
	error_mark_node.


Patch:
Index: c-decl.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/c-decl.c,v
retrieving revision 1.462
diff -u -p -r1.462 c-decl.c
--- c-decl.c	21 Dec 2003 14:08:32 -0000	1.462
+++ c-decl.c	22 Dec 2003 06:04:20 -0000
@@ -676,7 +676,7 @@ poplevel (int keep, int dummy ATTRIBUTE_
     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)
+    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_CONTEXT (DECL_RESULT (fndecl)) = fndecl;

   if (MAIN_NAME_P (DECL_NAME (fndecl)) && flag_hosted)
     {
@@ -6223,7 +6225,9 @@ c_expand_body_1 (tree fndecl, int nested
 void
 c_expand_body (tree fndecl)
 {
-  c_expand_body_1 (fndecl, 0);
+
+  if (DECL_INITIAL (fndecl) != error_mark_node)
+    c_expand_body_1 (fndecl, 0);
 }
 

 /* Check the declarations given in a for-loop for satisfying the C99


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=9163


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]