diff options
author | Tom Tromey <tromey@redhat.com> | 2002-11-18 18:13:36 +0000 |
---|---|---|
committer | Tom Tromey <tromey@gcc.gnu.org> | 2002-11-18 18:13:36 +0000 |
commit | 5602b49d692730366a6e554b52fefa604459d136 (patch) | |
tree | b4871257f616f991308049a0a275320ae8f40138 /gcc/java/expr.c | |
parent | 441c77991340c51604639124d611a38fed1c5292 (diff) | |
download | gcc-5602b49d692730366a6e554b52fefa604459d136.zip gcc-5602b49d692730366a6e554b52fefa604459d136.tar.gz gcc-5602b49d692730366a6e554b52fefa604459d136.tar.bz2 |
re PR java/7912 (invalid verification error for arrays)
Fix for PR java/7912:
* expr.c (can_widen_reference_to): Allow cast of array to
Cloneable or Serializable.
* java-tree.h (java_lang_cloneable_identifier_node): Declare.
(java_io_serializable_identifier_node): Likewise.
* parse.y (java_lang_cloneable, java_io_serializable): Removed.
(valid_ref_assignconv_cast_p): Use new identifier nodes.
* lex.c (java_init_lex): Don't initialize java_lang_cloneable and
java_io_serializable.
* decl.c (java_init_decl_processing): Initialize
java_lang_cloneable_identifier_node and
java_io_serializable_identifier_node.
(java_lang_cloneable_identifier_node): New global.
(java_io_serializable_identifier_node): Likewise.
From-SVN: r59227
Diffstat (limited to 'gcc/java/expr.c')
-rw-r--r-- | gcc/java/expr.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/gcc/java/expr.c b/gcc/java/expr.c index 0c434e9..8db2670 100644 --- a/gcc/java/expr.c +++ b/gcc/java/expr.c @@ -1,5 +1,5 @@ /* Process expressions for the GNU compiler for the Java(TM) language. - Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001 + Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. This file is part of GNU CC. @@ -391,7 +391,12 @@ can_widen_reference_to (source_type, target_type) { HOST_WIDE_INT source_length, target_length; if (TYPE_ARRAY_P (source_type) != TYPE_ARRAY_P (target_type)) - return 0; + { + /* An array implements Cloneable and Serializable. */ + tree name = DECL_NAME (TYPE_NAME (target_type)); + return (name == java_lang_cloneable_identifier_node + || name == java_io_serializable_identifier_node); + } target_length = java_array_type_length (target_type); if (target_length >= 0) { |