Commit c1eacb70 by Bryce McKinlay Committed by Bryce McKinlay

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.

From-SVN: r38363
parent 25cfec08
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
......
......@@ -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)));
......
......@@ -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))
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment