aboutsummaryrefslogtreecommitdiff
path: root/gcc/java
diff options
context:
space:
mode:
authorAndrew Haley <aph@redhat.com>2005-03-17 14:43:26 +0000
committerAndrew Haley <aph@gcc.gnu.org>2005-03-17 14:43:26 +0000
commitd8e978472c145fe7052390c671a59f4d008e6f06 (patch)
treee703a818f159b5f8fd0323573e8c25eae2615111 /gcc/java
parentc9982a3fcff659534e0e1a68a8ab358e4855bc2b (diff)
downloadgcc-d8e978472c145fe7052390c671a59f4d008e6f06.zip
gcc-d8e978472c145fe7052390c671a59f4d008e6f06.tar.gz
gcc-d8e978472c145fe7052390c671a59f4d008e6f06.tar.bz2
expr.c (expand_java_arrayload): Don't generate a NullPointerException based on the type of the node.
2005-03-16 Andrew Haley <aph@redhat.com> * expr.c (expand_java_arrayload): Don't generate a NullPointerException based on the type of the node. (build_java_array_length_access): Likewise. From-SVN: r96611
Diffstat (limited to 'gcc/java')
-rw-r--r--gcc/java/ChangeLog6
-rw-r--r--gcc/java/expr.c29
2 files changed, 11 insertions, 24 deletions
diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog
index adf8762..38edfef 100644
--- a/gcc/java/ChangeLog
+++ b/gcc/java/ChangeLog
@@ -1,3 +1,9 @@
+2005-03-16 Andrew Haley <aph@redhat.com>
+
+ * expr.c (expand_java_arrayload): Don't generate a
+ NullPointerException based on the type of the node.
+ (build_java_array_length_access): Likewise.
+
2005-03-15 Zack Weinberg <zack@codesourcery.com>
* Make-lang.in (TEXI_JAVA_FILES): Add gcc-vers.texi.
diff --git a/gcc/java/expr.c b/gcc/java/expr.c
index eaf5fd0..ee67c22 100644
--- a/gcc/java/expr.c
+++ b/gcc/java/expr.c
@@ -818,15 +818,6 @@ build_java_array_length_access (tree node)
tree array_type = TREE_TYPE (type);
HOST_WIDE_INT length;
- /* JVM spec: If the arrayref is null, the arraylength instruction
- throws a NullPointerException. The only way we could get a node
- of type ptr_type_node at this point is `aconst_null; arraylength'
- or something equivalent. */
- if (type == ptr_type_node)
- return build3 (CALL_EXPR, int_type_node,
- build_address_of (soft_nullpointer_node),
- NULL_TREE, NULL_TREE);
-
if (!is_array_type_p (type))
{
/* With the new verifier, we will see an ordinary pointer type
@@ -1229,21 +1220,11 @@ expand_java_arrayload (tree lhs_type_node)
index_node = save_expr (index_node);
array_node = save_expr (array_node);
- if (TREE_TYPE (array_node) == ptr_type_node)
- /* The only way we could get a node of type ptr_type_node at this
- point is `aconst_null; arraylength' or something equivalent, so
- unconditionally throw NullPointerException. */
- load_node = build3 (CALL_EXPR, lhs_type_node,
- build_address_of (soft_nullpointer_node),
- NULL_TREE, NULL_TREE);
- else
- {
- lhs_type_node = build_java_check_indexed_type (array_node,
- lhs_type_node);
- load_node = build_java_arrayaccess (array_node,
- lhs_type_node,
- index_node);
- }
+ lhs_type_node = build_java_check_indexed_type (array_node,
+ lhs_type_node);
+ load_node = build_java_arrayaccess (array_node,
+ lhs_type_node,
+ index_node);
if (INTEGRAL_TYPE_P (lhs_type_node) && TYPE_PRECISION (lhs_type_node) <= 32)
load_node = fold (build1 (NOP_EXPR, int_type_node, load_node));
push_value (load_node);