aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Tromey <tromey@redhat.com>2005-12-07 00:31:58 +0000
committerTom Tromey <tromey@gcc.gnu.org>2005-12-07 00:31:58 +0000
commit53bbb42e578a30ce8203879494d1f8521d022a7d (patch)
treee8092dac2a4bf9eb20a38a60a6bc40d0ff9431b6
parent67c4e19e47c1a4a6776c7d379e53c49bfe47a9da (diff)
downloadgcc-53bbb42e578a30ce8203879494d1f8521d022a7d.zip
gcc-53bbb42e578a30ce8203879494d1f8521d022a7d.tar.gz
gcc-53bbb42e578a30ce8203879494d1f8521d022a7d.tar.bz2
re PR java/25283 (gcj generates invalid signature)
PR java/25283: * parse.y (patch_new_array_init): Revert previous patch. (lookup_method_invoke): Use size-less array type when creating an anonymous constructor. From-SVN: r108143
-rw-r--r--gcc/java/ChangeLog7
-rw-r--r--gcc/java/parse.y19
2 files changed, 20 insertions, 6 deletions
diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog
index 22b1387..08075ac 100644
--- a/gcc/java/ChangeLog
+++ b/gcc/java/ChangeLog
@@ -1,3 +1,10 @@
+2005-12-06 Tom Tromey <tromey@redhat.com>
+
+ PR java/25283:
+ * parse.y (patch_new_array_init): Revert previous patch.
+ (lookup_method_invoke): Use size-less array type when creating an
+ anonymous constructor.
+
2005-12-05 Tom Tromey <tromey@redhat.com>
* parse.y (patch_new_array_init): Don't set length on array.
diff --git a/gcc/java/parse.y b/gcc/java/parse.y
index 0a1d8e2..056feea 100644
--- a/gcc/java/parse.y
+++ b/gcc/java/parse.y
@@ -11204,6 +11204,17 @@ lookup_method_invoke (int lc, tree cl, tree class, tree name, tree arg_list)
/* And promoted */
if (TREE_CODE (current_arg) == RECORD_TYPE)
current_arg = promote_type (current_arg);
+ /* If we're building an anonymous constructor call, and one of
+ the arguments has array type, cast it to a size-less array
+ type. This prevents us from getting a strange gcj-specific
+ "sized array" signature in the constructor's signature. */
+ if (lc && ANONYMOUS_CLASS_P (class)
+ && TREE_CODE (current_arg) == POINTER_TYPE
+ && TYPE_ARRAY_P (TREE_TYPE (current_arg)))
+ {
+ tree elt = TYPE_ARRAY_ELEMENT (TREE_TYPE (current_arg));
+ current_arg = build_pointer_type (build_java_array_type (elt, -1));
+ }
atl = tree_cons (NULL_TREE, current_arg, atl);
}
@@ -14857,12 +14868,8 @@ patch_new_array_init (tree type, tree node)
/* Create a new type. We can't reuse the one we have here by
patching its dimension because it originally is of dimension -1
- hence reused by gcc. This would prevent triangular arrays.
- Note that we don't pass the length here. If we do that then the
- length will end up in the signature of this type, and hence in
- the signature of the anonymous constructor -- but this is not a
- valid java signature. */
- type = build_java_array_type (element_type, -1);
+ hence reused by gcc. This would prevent triangular arrays. */
+ type = build_java_array_type (element_type, length);
TREE_TYPE (init) = TREE_TYPE (TREE_CHAIN (TREE_CHAIN (TYPE_FIELDS (type))));
TREE_TYPE (node) = promote_type (type);
TREE_CONSTANT (init) = all_constant;