]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
parse.y (patch_new_array_init): Don't set length on array.
authorTom Tromey <tromey@redhat.com>
Tue, 6 Dec 2005 02:30:11 +0000 (02:30 +0000)
committerTom Tromey <tromey@gcc.gnu.org>
Tue, 6 Dec 2005 02:30:11 +0000 (02:30 +0000)
gcc/java:
* parse.y (patch_new_array_init): Don't set length on array.
libjava:
* testsuite/libjava.compile/rh174912.java: New file.

From-SVN: r108099

gcc/java/ChangeLog
gcc/java/parse.y
libjava/ChangeLog
libjava/testsuite/libjava.compile/rh174912.java [new file with mode: 0644]

index d7b9c977604bfd40b3ed23f45236f31ddd7edc16..22b1387cf8ecbcdde2ff4de835ad0fe272462f6f 100644 (file)
@@ -1,3 +1,7 @@
+2005-12-05  Tom Tromey  <tromey@redhat.com>
+
+       * parse.y (patch_new_array_init): Don't set length on array.
+
 2005-12-02  Richard Guenther  <rguenther@suse.de>
 
        * java-gimplify.c (java_gimplify_labeled_block_expr): Use
index 555541c4bd4e6d52717c6c17c2bf2f17fff1a404..0a1d8e27f13fc3622266627e43fcfa718b3004e2 100644 (file)
@@ -14857,8 +14857,12 @@ 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. */
-  type = build_java_array_type (element_type, length);
+     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);
   TREE_TYPE (init) = TREE_TYPE (TREE_CHAIN (TREE_CHAIN (TYPE_FIELDS (type))));
   TREE_TYPE (node) = promote_type (type);
   TREE_CONSTANT (init) = all_constant;
index 24eed17c47e233f23f4676c9c3b4f096bb66e76f..c920ffe595d8204dfd609819968d0eb2af9b13cd 100644 (file)
@@ -1,3 +1,7 @@
+2005-12-05  Tom Tromey  <tromey@redhat.com>
+
+       * testsuite/libjava.compile/rh174912.java: New file.
+
 2005-12-01  Geoffrey Keating  <geoffk@apple.com>
 
        * testsuite/lib/libjava.exp (test_libjava_from_javac): Support
diff --git a/libjava/testsuite/libjava.compile/rh174912.java b/libjava/testsuite/libjava.compile/rh174912.java
new file mode 100644 (file)
index 0000000..65c1bf5
--- /dev/null
@@ -0,0 +1,17 @@
+// Derived from Red Hat bugzilla 174912
+// https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=174912
+// The bug is that the anonymous class constructor here will end up
+// with a bogus '[3C' in its signature.
+
+public class rh174912 {
+  public rh174912(char[][] args) { }
+
+  public Object m() {
+    return new rh174912(new char[][] { "hi".toCharArray(),
+                                      "bob".toCharArray(),
+                                      "and joe".toCharArray() }) {
+      };
+  }
+
+  public static void main(String[] args) { }
+}