aboutsummaryrefslogtreecommitdiff
path: root/gcc/java/decl.c
diff options
context:
space:
mode:
authorTom Tromey <tromey@cygnus.com>2000-04-28 00:21:06 +0000
committerTom Tromey <tromey@gcc.gnu.org>2000-04-28 00:21:06 +0000
commite815887f4d7e3aaa8e68584729c18c9b3c5fef05 (patch)
tree8b68598e702242c042747ef9d9b00aed4e7d7ab0 /gcc/java/decl.c
parentdb6a1df0e0f18a86827e97092fa1293adcc2e89e (diff)
downloadgcc-e815887f4d7e3aaa8e68584729c18c9b3c5fef05.zip
gcc-e815887f4d7e3aaa8e68584729c18c9b3c5fef05.tar.gz
gcc-e815887f4d7e3aaa8e68584729c18c9b3c5fef05.tar.bz2
re GNATS gcj/2 (Method call on null instance should throw NullPointerException)
Fix for PR gcj/2: * expr.c (expand_invoke): Generate check to see if object pointer is null in nonvirtual invocation case. * java-tree.h (soft_nullpointer_node): Declare. * decl.c (soft_nullpointer_node): New global. (init_decl_processing): Initialize soft_nullpointer_node. * parse.y (invocation_mode): Return INVOKE_NONVIRTUAL for `final' or `private' methods. (patch_invoke): Handle INVOKE_NONVIRTUAL case. From-SVN: r33495
Diffstat (limited to 'gcc/java/decl.c')
-rw-r--r--gcc/java/decl.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/gcc/java/decl.c b/gcc/java/decl.c
index 659d419..385a8aa 100644
--- a/gcc/java/decl.c
+++ b/gcc/java/decl.c
@@ -375,6 +375,7 @@ tree soft_newarray_node;
tree soft_anewarray_node;
tree soft_multianewarray_node;
tree soft_badarrayindex_node;
+tree soft_nullpointer_node;
tree throw_node [2];
tree soft_checkarraystore_node;
tree soft_monitorenter_node;
@@ -813,6 +814,15 @@ init_decl_processing ()
TREE_THIS_VOLATILE (soft_badarrayindex_node) = 1;
TREE_SIDE_EFFECTS (soft_badarrayindex_node) = 1;
+ soft_nullpointer_node
+ = builtin_function ("_Jv_ThrowNullPointerException",
+ build_function_type (void_type_node, endlink),
+ 0, NOT_BUILT_IN, NULL_PTR);
+ /* Mark soft_nullpointer_node as a `noreturn' function with side
+ effects. */
+ TREE_THIS_VOLATILE (soft_nullpointer_node) = 1;
+ TREE_SIDE_EFFECTS (soft_nullpointer_node) = 1;
+
t = tree_cons (NULL_TREE, class_ptr_type,
tree_cons (NULL_TREE, object_ptr_type_node, endlink));
soft_checkcast_node