This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: Missing declaration causes ICE or segmentation fault
- To: dave at hiauly1 dot hia dot nrc dot ca (John David Anglin)
- Subject: Re: Missing declaration causes ICE or segmentation fault
- From: "John David Anglin" <dave at hiauly1 dot hia dot nrc dot ca>
- Date: Fri, 16 Jun 2000 16:12:43 -0400 (EDT)
- Cc: gcc-bugs at gcc dot gnu dot org
> # ../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. */