This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Patch: fix PR java/23300
- From: Tom Tromey <tromey at redhat dot com>
- To: Java Patch List <java-patches at gcc dot gnu dot org>
- Cc: Gcc Patch List <gcc-patches at gcc dot gnu dot org>
- Date: 15 Aug 2005 10:09:44 -0600
- Subject: Patch: fix PR java/23300
- Reply-to: tromey at redhat dot com
This patch fixes PR java/23300.
The immediate cause of the crash is fixed by the expr.c patch. We
were generating an otable reference when DECL_FIELD_OFFSET was 0.
But, it makes no sense to do this, because if !flag_indirect_dispatch,
we will end up with bogus trees.
The ultimate cause of the bug turned out to be a name resolution
failure. I fixed this by arranging to pass the class' outer class (if
any) to do_resolve_class in maybe_layout_super_class.
Tested on x86 FC4, including mauve and jacks. Ok?
Tom
Index: ChangeLog
from Tom Tromey <tromey@redhat.com>
PR java/23300.
* expr.c (build_field_ref): Don't generate otable reference when
DECL_FIELD_OFFSET is 0.
* class.c (maybe_layout_super_class): Pass outer class to
do_resolve_class.
Index: class.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/class.c,v
retrieving revision 1.237
diff -u -r1.237 class.c
--- class.c 8 Aug 2005 14:56:18 -0000 1.237
+++ class.c 15 Aug 2005 16:05:18 -0000
@@ -2093,8 +2093,9 @@
DECL_SOURCE_LINE (this_decl), 0);
#endif
}
- super_class = do_resolve_class (NULL_TREE, this_class,
- super_class, NULL_TREE, this_wrap);
+ super_class
+ = do_resolve_class (DECL_CONTEXT (TYPE_NAME (this_class)),
+ this_class, super_class, NULL_TREE, this_wrap);
if (!super_class)
return NULL_TREE; /* FIXME, NULL_TREE not checked by caller. */
super_class = TREE_TYPE (super_class);
Index: expr.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/expr.c,v
retrieving revision 1.233
diff -u -r1.233 expr.c
--- expr.c 28 Jul 2005 18:28:12 -0000 1.233
+++ expr.c 15 Aug 2005 16:05:19 -0000
@@ -1735,13 +1735,7 @@
tree base_type = promote_type (base_class);
if (base_type != TREE_TYPE (self_value))
self_value = fold (build1 (NOP_EXPR, base_type, self_value));
- if (! flag_syntax_only
- && (flag_indirect_dispatch
- /* DECL_FIELD_OFFSET == 0 if we have no reference for
- the field, perhaps because we couldn't find the class
- in which the field is defined.
- FIXME: We should investigate this. */
- || DECL_FIELD_OFFSET (field_decl) == 0))
+ if (! flag_syntax_only && flag_indirect_dispatch)
{
tree otable_index
= build_int_cst (NULL_TREE, get_symbol_table_index