Patchwork RFA: Fix java/46386

login
register
mail settings
Submitter Andrew Haley
Date Nov. 9, 2010, 9:30 a.m.
Message ID <4CD914B3.7010906@redhat.com>
Download mbox | patch
Permalink /patch/70521/
State New
Headers show

Comments

Andrew Haley - Nov. 9, 2010, 9:30 a.m.
On 11/09/2010 08:40 AM, Joern Rennecke wrote:
> Tested build of 'all-gcc' for
> i686-pc-linux-gnu X pdp11-elf
> configureed with --enable-werror-always configuration.
> 
> Bootstrapping on i686-pc-linux-gnu.


I am always opposed to obfuscating code in order to suppress bogus warnings.

Can I suggest

  temp <<= (POINTER_SIZE > 32) ? POINTER_SIZE - 32 : 0;

?

Andrew.

Patch

Index: java/constants.c
===================================================================
--- java/constants.c	(revision 166429)
+++ java/constants.c	(working copy)
@@ -534,14 +534,16 @@  build_constants_constructor (void)
       case CONSTANT_InterfaceMethodref:
 	{
 	  unsigned HOST_WIDE_INT temp = outgoing_cpool->data[i].w;
+	  int big_endian_correction;

 	  /* Make sure that on a big-endian machine with 64-bit
 	     pointers this 32-bit jint appears in the first word.
 	     FIXME: This is a kludge.  The field we're initializing is
 	     not a scalar but a union, and that's how we should
 	     represent it in the compiler.  We should fix this.  */
-	  if (BYTES_BIG_ENDIAN && POINTER_SIZE > 32)
-	    temp <<= POINTER_SIZE - 32;
+	  big_endian_correction = POINTER_SIZE - 32;
+	  if (BYTES_BIG_ENDIAN && big_endian_correction > 0)
+	    temp <<= big_endian_correction;

           CONSTRUCTOR_PREPEND_VALUE (t, get_tag_node (outgoing_cpool->tags[i]));
           CONSTRUCTOR_PREPEND_VALUE (d,