public inbox for java-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [gcjx] Patch: FYI: fix multi-dimensional 'new'
@ 2005-10-11  1:25 Tom Tromey
  0 siblings, 0 replies; only message in thread
From: Tom Tromey @ 2005-10-11  1:25 UTC (permalink / raw)
  To: Java Patch List

I'm checking this in on the gcjx branch.

This fixes 'new' of a multi-dimensional array.  We were missing some
arguments.

Tom

Index: ChangeLog
from  Tom Tromey  <tromey@redhat.com>
	* tree.cc (visit_new_array): Correctly handle multi-dimensional
	case.

Index: tree.cc
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/Attic/tree.cc,v
retrieving revision 1.1.2.59
diff -u -r1.1.2.59 tree.cc
--- tree.cc 11 Oct 2005 00:49:32 -0000 1.1.2.59
+++ tree.cc 11 Oct 2005 01:24:18 -0000
@@ -2271,6 +2271,7 @@
     }
   else if (indices.size () != 0)
     {
+      int num = 0;
       tree args = NULL_TREE;
       for (std::list<ref_expression>::const_iterator i = indices.begin ();
 	   i != indices.end ();
@@ -2278,12 +2279,21 @@
 	{
 	  (*i)->visit (this);
 	  args = tree_cons (NULL_TREE, current, args);
+	  ++num;
 	}
+      // We constructed the dimension arguments in reverse order.
+      args = nreverse (args);
+
+      args = tree_cons (NULL_TREE, build_int (num), args);
+      args = tree_cons (NULL_TREE,
+			build_class_ref (new_elt->type (), new_elt),
+			args);
 
       tree array_type_tree = gcc_builtins->map_type (new_elt->type ());
-      current = build3 (CALL_EXPR, array_type_tree,
-			builtin_Jv_NewMultiArray,
-			nreverse (args), NULL_TREE);
+      current = convert (array_type_tree,
+			 build3 (CALL_EXPR, ptr_type_node,
+				 builtin_Jv_NewMultiArray,
+				 args, NULL_TREE));
       annotate (current, new_elt);
     }
   else

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2005-10-11  1:25 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-10-11  1:25 [gcjx] Patch: FYI: fix multi-dimensional 'new' Tom Tromey

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).