aboutsummaryrefslogtreecommitdiff
path: root/gcc/java
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/java')
-rw-r--r--gcc/java/ChangeLog8
-rw-r--r--gcc/java/class.c29
-rw-r--r--gcc/java/parse.y14
3 files changed, 51 insertions, 0 deletions
diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog
index af55e5b..0f71e7f 100644
--- a/gcc/java/ChangeLog
+++ b/gcc/java/ChangeLog
@@ -1,3 +1,11 @@
+2000-12-17 Bryce McKinlay <bryce@albatross.co.nz>
+
+ Fix for PRs gcj/312 and gcj/253:
+ * parse.y (valid_ref_assignconv_cast_p): Load classes for source and
+ dest if they arn't already.
+ * class.c (layout_class): Call maybe_layout_super_class on
+ superinterfaces also, but only if compiling from bytecode.
+
2000-12-15 Tom Tromey <tromey@redhat.com>
* jcf-parse.c (jcf_parse_source): Set wfl_operator if not already
diff --git a/gcc/java/class.c b/gcc/java/class.c
index 00cf42e..92dd0b9 100644
--- a/gcc/java/class.c
+++ b/gcc/java/class.c
@@ -1841,6 +1841,35 @@ layout_class (this_class)
layout_type (this_class);
+ /* Also recursively load/layout any superinterfaces, but only if class was
+ loaded from bytecode. The source parser will take care of this itself. */
+ if (!CLASS_FROM_SOURCE_P (this_class))
+ {
+ tree basetype_vec = TYPE_BINFO_BASETYPES (this_class);
+
+ if (basetype_vec)
+ {
+ int n = TREE_VEC_LENGTH (basetype_vec) - 1;
+ int i;
+ for (i = n; i > 0; i--)
+ {
+ tree vec_elt = TREE_VEC_ELT (basetype_vec, i);
+ tree super_interface = BINFO_TYPE (vec_elt);
+
+ tree maybe_super_interface
+ = maybe_layout_super_class (super_interface, NULL_TREE);
+ if (maybe_super_interface == NULL
+ || TREE_CODE (TYPE_SIZE (maybe_super_interface)) == ERROR_MARK)
+ {
+ TYPE_SIZE (this_class) = error_mark_node;
+ CLASS_BEING_LAIDOUT (this_class) = 0;
+ list = TREE_CHAIN (list);
+ return;
+ }
+ }
+ }
+ }
+
/* Convert the size back to an SI integer value */
TYPE_SIZE_UNIT (this_class) =
fold (convert (int_type_node, TYPE_SIZE_UNIT (this_class)));
diff --git a/gcc/java/parse.y b/gcc/java/parse.y
index 7a23e72..ec09a49 100644
--- a/gcc/java/parse.y
+++ b/gcc/java/parse.y
@@ -12778,6 +12778,20 @@ valid_ref_assignconv_cast_p (source, dest, cast)
source = TREE_TYPE (source);
if (TREE_CODE (dest) == POINTER_TYPE)
dest = TREE_TYPE (dest);
+
+ /* If source and dest are being compiled from bytecode, they may need to
+ be loaded. */
+ if (CLASS_P (source) && !CLASS_LOADED_P (source))
+ {
+ load_class (source, 1);
+ safe_layout_class (source);
+ }
+ if (CLASS_P (dest) && !CLASS_LOADED_P (dest))
+ {
+ load_class (dest, 1);
+ safe_layout_class (dest);
+ }
+
/* Case where SOURCE is a class type */
if (TYPE_CLASS_P (source))
{