RFA: Fix java/46386
diff mbox

Message ID 20101109034027.gjiu9m88ow0cwcwk-nzlynne@webmail.spamcop.net
State New
Headers show

Commit Message

Joern Rennecke Nov. 9, 2010, 8:40 a.m. UTC
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.
Currently, we can't compile java/constants.c with -Werror for any target
with 16 bit pointers - such as h8300, m32c, m68hc11, pdp11 or stormy16 -
because of a negative shift in build_constants_constructor.

If we compute the shift count first, to use both in the test if the shift is
to be performed, and the shift itself, the shift count will be constant
propagated for the targets where it might be executed, and dead-code-eliminated
on the targets where it would be negative, and there is no warning for a
negative shift count.

2010-11-09  Joern Rennecke  <amylaar@spamcop.net>

	PR java/46386
	* constants.c (build_constants_constructor): Avoid negative shift.
	* config/pdp11/t-pdp11 (java/constants.o-warn): Remove.

diff mbox

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.  */
-	    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]));
Index: config/pdp11/t-pdp11
--- config/pdp11/t-pdp11	(revision 166429)
+++ config/pdp11/t-pdp11	(working copy)
@@ -42,7 +42,3 @@  MULTILIB_OPTIONS = msoft-float
 # We could say "-Werror -Wno-error=type-limits", alas, not all supported
 # gcc bootstrap compilers support the latter option.
 dwarf2out.o-warn = -Wno-error
-# Likewise, java/constants.c:build_constants_constructor has a negative shift
-# count (in never-executed code) due to the small POINTER_SIZE.
-java/constants.o-warn = -Wno-error