PR java/25535: gcj broken on 64-bit big-endian systems

Tom Tromey tromey@redhat.com
Tue Jan 10 21:31:00 GMT 2006


>>>>> "Andrew" == Andrew Haley <aph@redhat.com> writes:

Andrew> BC-compiled code doesn't work on a big-endian 64-bit box
Andrew> because of a silly mistake initializing entries in the
Andrew> constant pool.  In all cases the initializer must appear as
Andrew> the first 32-bit integer of a machine word stored in memory.

Andrew> -	  jword temp = outgoing_cpool->data[i].w;
Andrew> +	  unsigned HOST_WIDE_INT temp = outgoing_cpool->data[i].w;
Andrew> +
Andrew> +	  /* Make sure that on a 64-bit big-endian machine this 32-bit
Andrew> +	     jint appears in the first word.  */
Andrew> +	  if (BYTES_BIG_ENDIAN && BITS_PER_WORD > 32)
Andrew> +	    temp <<= BITS_PER_WORD - 32;
 
This is related to PR 18148 -- internally gcj has the wrong type for
itable and some other fields of Class.  It seems like it would be more
robust (though more painful) to have the proper declarations inside
gcj and to generate a real union constructor here.

For 4.1 I think the current patch would be appropriate.  What do you
think?

Tom



More information about the Gcc-patches mailing list