Missing declaration causes ICE or segmentation fault

John David Anglin dave@hiauly1.hia.nrc.ca
Fri Jun 16 13:12:00 GMT 2000


> # ../stage1/cc1 -O3 xxx.i
>  build_mangled_name
> ../../../gcc/cp/method.c: In function `build_mangled_name':
> ../../../gcc/cp/method.c:150: `nofold' undeclared (first use in this function)
> ../../../gcc/cp/method.c:150: (Each undeclared identifier is reported only once
> ../../../gcc/cp/method.c:150: for each function it appears in.)
> ../../../gcc/cp/method.c:150: Tree check: expected class 't', have 'x' (error_mark)
> ../../../gcc/cp/method.c:150: Internal compiler error in `digest_init', at c-typeck.c:4585
> Please submit a full bug report.
> See <URL: http://www.gnu.org/software/gcc/bugs.html > for instructions.

After noting the following with gdb in digest_init,

(gdb) print global_trees[TI_ERROR_MARK]
$1 = 0x19ed20
(gdb) print init->common.type
$2 = (union tree_node *) 0x19ed20

it is clear that the problem occurs because digest_init was called with
TREE_TYPE (init) == error_mark_node.  This suggests that TREE_TYPE (init)
should also be tested to see if it is an error_mark_node, in addition
to type and init.  I am testing the enclosed patch which appears to
resolve the problem.  However, I would be the first to admit that this
may not be the correct solution.  Suggestions?

Dave
-- 
J. David Anglin                                  dave.anglin@nrc.ca
National Research Council of Canada              (613) 990-0752 (FAX: 952-6605)

2000-06-16  J. David Anglin  <dave@hiauly1.hia.nrc.ca>

	* c-typeck.c (digest_init): Return error_mark_node node when
	TREE_TYPE (init)  == error_mark_node.

--- c-typeck.c.orig	Fri Jun  9 18:33:51 2000
+++ c-typeck.c	Fri Jun 16 15:04:11 2000
@@ -4518,7 +4518,9 @@
   enum tree_code code = TREE_CODE (type);
   tree inside_init = init;
 
-  if (type == error_mark_node || init == error_mark_node)
+  if (type == error_mark_node
+      || init == error_mark_node
+      || TREE_TYPE (init)  == error_mark_node)
     return error_mark_node;
 
   /* Strip NON_LVALUE_EXPRs since we aren't using as an lvalue.  */


More information about the Gcc-bugs mailing list