OSDN Git Service

* verify-impl.c (get_short): Sign extend.
authortromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 17 Jan 2005 19:29:04 +0000 (19:29 +0000)
committertromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 17 Jan 2005 19:29:04 +0000 (19:29 +0000)
(get_int): Likewise.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@93772 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/java/ChangeLog
gcc/java/verify-impl.c

index 4e593ff..23ebb80 100644 (file)
@@ -1,3 +1,8 @@
+2005-01-17  Tom Tromey  <tromey@redhat.com>
+
+       * verify-impl.c (get_short): Sign extend.
+       (get_int): Likewise.
+
 2005-01-12  Ranjit Mathew  <rmathew@hotmail.com>
 
        * expr.c (build_jni_stub): Replace mistaken use of TYPE_SIZE_UNIT
index f487978..ee8f426 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 2001, 2002, 2003, 2004  Free Software Foundation
+/* Copyright (C) 2001, 2002, 2003, 2004, 2005  Free Software Foundation
 
    This file is part of libgcj.
 
@@ -1439,7 +1439,7 @@ get_ushort (void)
 static jint
 get_short (void)
 {
-  jint b1 = get_byte ();
+  signed char b1 = (signed char) get_byte ();
   jint b2 = get_byte ();
   jshort s = (b1 << 8) | b2;
   return (jint) s;
@@ -1452,7 +1452,10 @@ get_int (void)
   jint b2 = get_byte ();
   jint b3 = get_byte ();
   jint b4 = get_byte ();
-  return (b1 << 24) | (b2 << 16) | (b3 << 8) | b4;
+  jword result = (b1 << 24) | (b2 << 16) | (b3 << 8) | b4;
+  /* In the compiler, 'jint' might have more than 32 bits, so we must
+     sign extend.  */
+  return WORD_TO_INT (result);
 }
 
 static int