[gcjx] Patch: FYI: fix handling of 'long'

Tom Tromey tromey@redhat.com
Mon Oct 10 20:04:00 GMT 2005


I'm checking this in on the gcjx branch.

This fixes how literals of type 'long' are turned into trees.

Tom

Index: ChangeLog
from  Tom Tromey  <tromey@redhat.com>
	* tree.cc (build_long): Rewrote.

Index: tree.cc
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/Attic/tree.cc,v
retrieving revision 1.1.2.55
diff -u -r1.1.2.55 tree.cc
--- tree.cc 10 Oct 2005 19:54:11 -0000 1.1.2.55
+++ tree.cc 10 Oct 2005 20:03:46 -0000
@@ -2414,8 +2414,15 @@
 tree
 tree_generator::build_long (jlong val)
 {
-  // FIXME: what if HOST_WIDE_INT is smaller than jlong?
-  return build_int_cst (type_jlong, val);
+  unsigned HOST_WIDE_INT low;
+  HOST_WIDE_INT high;
+  unsigned HOST_WIDE_INT v2;
+
+  v2 = (unsigned HOST_WIDE_INT) ((val >> 32) & 0xffffffffLL);
+  lshift_double (v2, 0, 32, 64, &low, &high, 0);
+  add_double (low, high, (unsigned HOST_WIDE_INT) (val & 0xffffffffLL),
+	      0, &low, &high);
+  tree value = build_int_cst_wide (type_jlong, low, high);
 }
 
 tree



More information about the Java-patches mailing list