Commit 176be57b by Richard Guenther Committed by Richard Biener

expr.c (expand_java_return): RETURN_EXPR has void type.

2007-07-12  Richard Guenther  <rguenther@suse.de>

	* expr.c (expand_java_return): RETURN_EXPR has void type.
	(build_jni_stub): Likewise.  Use a comparison against zero
	for null-pointer test in COND_EXPR.
	(build_field_ref): Build POINTER_PLUS_EXPR with correct
	type.  Convert result instead.
	(build_invokevirtual): Likewise.

From-SVN: r126574
parent eb8f7caf
2007-07-12 Richard Guenther <rguenther@suse.de>
* expr.c (expand_java_return): RETURN_EXPR has void type.
(build_jni_stub): Likewise. Use a comparison against zero
for null-pointer test in COND_EXPR.
(build_field_ref): Build POINTER_PLUS_EXPR with correct
type. Convert result instead.
(build_invokevirtual): Likewise.
2007-07-09 Geoffrey Keating <geoffk@apple.com>
PR 32617
......
......@@ -1286,7 +1286,7 @@ expand_java_return (tree type)
retval = build1(NOP_EXPR, TREE_TYPE(res), retval);
TREE_SIDE_EFFECTS (retval) = 1;
java_add_stmt (build1 (RETURN_EXPR, TREE_TYPE (retval), retval));
java_add_stmt (build1 (RETURN_EXPR, void_type_node, retval));
}
}
......@@ -1744,8 +1744,10 @@ build_field_ref (tree self_value, tree self_class, tree name)
self_value = java_check_reference (self_value, check);
address
= fold_build2 (POINTER_PLUS_EXPR,
build_pointer_type (TREE_TYPE (field_decl)),
TREE_TYPE (self_value),
self_value, field_offset);
address = fold_convert (build_pointer_type (TREE_TYPE (field_decl)),
address);
return fold_build1 (INDIRECT_REF, TREE_TYPE (field_decl), address);
}
......@@ -2332,13 +2334,16 @@ build_invokevirtual (tree dtable, tree method, tree special)
size_int (TARGET_VTABLE_USES_DESCRIPTORS));
}
func = fold_build2 (POINTER_PLUS_EXPR, nativecode_ptr_ptr_type_node, dtable,
func = fold_build2 (POINTER_PLUS_EXPR, TREE_TYPE (dtable), dtable,
convert (sizetype, method_index));
if (TARGET_VTABLE_USES_DESCRIPTORS)
func = build1 (NOP_EXPR, nativecode_ptr_type_node, func);
else
{
func = fold_convert (nativecode_ptr_ptr_type_node, func);
func = build1 (INDIRECT_REF, nativecode_ptr_type_node, func);
}
return func;
}
......@@ -2715,7 +2720,9 @@ build_jni_stub (tree method)
jni_func_type = build_pointer_type (tem);
jnifunc = build3 (COND_EXPR, ptr_type_node,
meth_var, meth_var,
build2 (NE_EXPR, boolean_type_node,
meth_var, build_int_cst (TREE_TYPE (meth_var), 0)),
meth_var,
build2 (MODIFY_EXPR, ptr_type_node, meth_var,
build_call_nary (ptr_type_node,
build_address_of
......@@ -2777,7 +2784,7 @@ build_jni_stub (tree method)
}
body = build2 (COMPOUND_EXPR, void_type_node, body,
build1 (RETURN_EXPR, res_type, res_var));
build1 (RETURN_EXPR, void_type_node, res_var));
TREE_SIDE_EFFECTS (body) = 1;
/* Prepend class initialization for static methods reachable from
......
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