PR java/17779: ICE: Seg fault
Andrew Haley
aph@redhat.com
Fri Jan 4 12:55:00 GMT 2008
The old kludge to work around this corner case broke, so this is a
new, improved kludge.
This will keep java working until the logic that reads and lays out
classes is fixed not to recurse infinitely if a nested class is a
subclass of its enclosing class.
Andrew.
2008-01-03 Andrew Haley <aph@redhat.com>
PR java/17779
* jcf-parse.c (parse_zip_file_entries): Unset TYPE_ALIAS_SET if
we're about to re-layout the type.
Index: java/jcf-parse.c
===================================================================
--- java/jcf-parse.c (revision 131036)
+++ java/jcf-parse.c (working copy)
@@ -2076,6 +2076,7 @@
{
char *class_name = compute_class_name (zdir);
class = lookup_class (get_identifier (class_name));
+ int previous_alias_set = -1;
FREE (class_name);
current_jcf = TYPE_JCF (class);
output_class = current_class = class;
@@ -2090,12 +2091,20 @@
This can happen if we earlier failed to lay out this
class because its superclass was still in the process
of being laid out; this occurs when we have recursive
- class dependencies via inner classes. Setting
- TYPE_SIZE to null here causes CLASS_LOADED_P to return
- false, so layout_class() will be called again. */
+ class dependencies via inner classes. We must record
+ the previous alias set and restore it after laying out
+ the class.
+
+ FIXME: this really is a kludge. We should figure out a
+ way to lay out the class properly before this
+ happens. */
if (TYPE_SIZE (class) && CLASSTYPE_SUPER (class)
&& integer_zerop (TYPE_SIZE (class)))
+ {
TYPE_SIZE (class) = NULL_TREE;
+ previous_alias_set = TYPE_ALIAS_SET (class);
+ TYPE_ALIAS_SET (class) = -1;
+ }
if (! CLASS_LOADED_P (class))
{
@@ -2108,6 +2117,9 @@
load_inner_classes (current_class);
}
+ if (previous_alias_set != -1)
+ TYPE_ALIAS_SET (class) = previous_alias_set;
+
if (TYPE_SIZE (current_class) != error_mark_node)
{
parse_class_file ();
--
Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SL4 1TE, UK
Registered in England and Wales No. 3798903
More information about the Gcc-patches
mailing list