diff options
author | Richard Guenther <rguenther@suse.de> | 2007-07-12 09:29:26 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2007-07-12 09:29:26 +0000 |
commit | 176be57beaed92f771fd7c86007363e17f65324e (patch) | |
tree | 65d095d6a08cf82cda8ea486135787036289c7f6 /gcc/java | |
parent | eb8f7cafe7a12bcae1ec1ded699d63379e3c0018 (diff) | |
download | gcc-176be57beaed92f771fd7c86007363e17f65324e.zip gcc-176be57beaed92f771fd7c86007363e17f65324e.tar.gz gcc-176be57beaed92f771fd7c86007363e17f65324e.tar.bz2 |
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
Diffstat (limited to 'gcc/java')
-rw-r--r-- | gcc/java/ChangeLog | 9 | ||||
-rw-r--r-- | gcc/java/expr.c | 19 |
2 files changed, 22 insertions, 6 deletions
diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog index f60c2bd..e05b4df 100644 --- a/gcc/java/ChangeLog +++ b/gcc/java/ChangeLog @@ -1,3 +1,12 @@ +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 diff --git a/gcc/java/expr.c b/gcc/java/expr.c index d446e49..81bf8bd 100644 --- a/gcc/java/expr.c +++ b/gcc/java/expr.c @@ -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 = build1 (INDIRECT_REF, nativecode_ptr_type_node, func); + { + 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 |