ICE with enable-checking in toplev.c:3594
Mark Mitchell
mark@codesourcery.com
Sun Nov 7 09:34:00 GMT 1999
This is caused by Kenner's recent merge. I fixed part of the problem,
but didn't notice the other part. Here's a patch I think will fix it;
will you let me know? The get_containing_scope function is an
abstraction that is longer overdue anyhow.
--
Mark Mitchell mark@codesourcery.com
CodeSourcery, LLC http://www.codesourcery.com
Index: toplev.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/toplev.c,v
retrieving revision 1.255
diff -c -p -r1.255 toplev.c
*** toplev.c 1999/11/05 00:49:03 1.255
--- toplev.c 1999/11/07 17:32:38
*************** rest_of_compilation (decl)
*** 3591,3597 ****
generating code for this one is not only not necessary but will
confuse some debugging output writers. */
for (parent = DECL_CONTEXT (current_function_decl);
! parent != 0; parent = DECL_CONTEXT (parent))
if (TREE_CODE (parent) == FUNCTION_DECL
&& DECL_INLINE (parent) && DECL_EXTERNAL (parent))
{
--- 3591,3598 ----
generating code for this one is not only not necessary but will
confuse some debugging output writers. */
for (parent = DECL_CONTEXT (current_function_decl);
! parent != NULL_TREE;
! parent = get_containing_scope (parent))
if (TREE_CODE (parent) == FUNCTION_DECL
&& DECL_INLINE (parent) && DECL_EXTERNAL (parent))
{
Index: tree.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/tree.c,v
retrieving revision 1.101
diff -c -p -r1.101 tree.c
*** tree.c 1999/11/01 01:11:22 1.101
--- tree.c 1999/11/07 17:32:41
*************** int_fits_type_p (c, type)
*** 4772,4777 ****
--- 4772,4787 ----
&& TREE_UNSIGNED (TREE_TYPE (c))));
}
+ /* Given a DECL or TYPE, return the scope in which it was declared, or
+ NUL_TREE if there is no containing scope. */
+
+ tree
+ get_containing_scope (t)
+ tree t;
+ {
+ return (TYPE_P (t) ? TYPE_CONTEXT (t) : DECL_CONTEXT (t));
+ }
+
/* Return the innermost context enclosing DECL that is
a FUNCTION_DECL, or zero if none. */
*************** decl_function_context (decl)
*** 4791,4805 ****
while (context && TREE_CODE (context) != FUNCTION_DECL)
{
! if (TREE_CODE_CLASS (TREE_CODE (context)) == 't')
! context = TYPE_CONTEXT (context);
! else if (TREE_CODE_CLASS (TREE_CODE (context)) == 'd')
! context = DECL_CONTEXT (context);
! else if (TREE_CODE (context) == BLOCK)
context = BLOCK_SUPERCONTEXT (context);
! else
! /* Unhandled CONTEXT !? */
! abort ();
}
return context;
--- 4801,4810 ----
while (context && TREE_CODE (context) != FUNCTION_DECL)
{
! if (TREE_CODE (context) == BLOCK)
context = BLOCK_SUPERCONTEXT (context);
! else
! context = get_containing_scope (context);
}
return context;
Index: tree.h
===================================================================
RCS file: /cvs/gcc/egcs/gcc/tree.h,v
retrieving revision 1.100
diff -c -p -r1.100 tree.h
*** tree.h 1999/11/01 01:11:22 1.100
--- tree.h 1999/11/07 17:32:43
*************** extern tree get_inner_reference PROTO((
*** 1950,1955 ****
--- 1950,1960 ----
enum machine_mode *, int *,
int *, int *));
+ /* Given a DECL or TYPE, return the scope in which it was declared, or
+ NUL_TREE if there is no containing scope. */
+
+ extern tree get_containing_scope PROTO((tree));
+
/* Return the FUNCTION_DECL which provides this _DECL with its context,
or zero if none. */
extern tree decl_function_context PROTO((tree));
More information about the Gcc-bugs
mailing list