This is the mail archive of the java-patches@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: FYI: PR 15713 - interpret.cc aliasing


Bryce McKinley wrote:

>        PR libgcj/15713
>        * include/jvm.h (_Jv_value): New union type.
>        * gcj/field.h (_Jv_Field): Add new _addr union field variants 
>        * interperet.cc (run): Use _Jv_value union type and *_addr _Jv_Field 
>        union members.

This breaks s390(x) and presumably all other big-endian platforms, 
because this:

>-                 jbyte value = (*(jint*)&rvalue) & 0xff;
>-                 PUSHI (value);

is not at all the same as this:

>+               PUSHI (rvalue.byte_value);

except by chance on little-endian platforms.

The patch below fixes this (and two other similiarly wrong changes).
Tested on s390-ibm-linux and s390x-ibm-linux, fixes a bunch of gij failures.

OK?

Bye,
Ulrich


ChangeLog:

	* interpret.cc (run): Fix bug introduced by last change.

Index: libjava/interpret.cc
===================================================================
RCS file: /cvs/gcc/gcc/libjava/interpret.cc,v
retrieving revision 1.43
diff -c -p -r1.43 interpret.cc
*** libjava/interpret.cc	13 Jul 2004 01:04:46 -0000	1.43
--- libjava/interpret.cc	13 Jul 2004 20:00:11 -0000
*************** _Jv_InterpMethod::run (void *retp, ffi_r
*** 1187,1201 ****
  	    switch (rtype)
  	      {
  	      case FFI_TYPE_SINT8:
! 		PUSHI (rvalue.byte_value);
  		break;
  
  	      case FFI_TYPE_SINT16:
! 		PUSHI (rvalue.short_value);
  		break;
  
  	      case FFI_TYPE_UINT16:
! 		PUSHI (rvalue.char_value);
  		break;
  
  	      case FFI_TYPE_FLOAT:
--- 1187,1201 ----
  	    switch (rtype)
  	      {
  	      case FFI_TYPE_SINT8:
! 		PUSHI ((jbyte)(rvalue.int_value & 0xff));
  		break;
  
  	      case FFI_TYPE_SINT16:
! 		PUSHI ((jshort)(rvalue.int_value & 0xffff));
  		break;
  
  	      case FFI_TYPE_UINT16:
! 		PUSHI (rvalue.int_value & 0xffff);
  		break;
  
  	      case FFI_TYPE_FLOAT:
-- 
  Dr. Ulrich Weigand
  weigand@informatik.uni-erlangen.de


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]