]> gcc.gnu.org Git - gcc.git/commitdiff
expr.c (expand_java_return): RETURN_EXPR has void type.
authorRichard Guenther <rguenther@suse.de>
Thu, 12 Jul 2007 09:29:26 +0000 (09:29 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Thu, 12 Jul 2007 09:29:26 +0000 (09:29 +0000)
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

gcc/java/ChangeLog
gcc/java/expr.c

index f60c2bdd3a1476888c24f87640e981ce771cdd08..e05b4df365f031f94b4f042d674876c0874b9a31 100644 (file)
@@ -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
index d446e490abb8e07ad91364b47bdd23fa4cc349ea..81bf8bd085c89ac314a739ffe52c3eb440cada2f 100644 (file)
@@ -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
This page took 0.093003 seconds and 5 git commands to generate.