This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
RFA: Fix java/46386
- From: Joern Rennecke <amylaar at spamcop dot net>
- To: gcc-patches at gcc dot gnu dot org
- Cc: Per Bothner <per at bothner dot com>, Andrew Haley <aph at redhat dot com>, Tom Tromey <tromey at redhat dot com>, Paul Koning <ni1d at arrl dot net>
- Date: Tue, 09 Nov 2010 03:40:27 -0500
- Subject: RFA: Fix java/46386
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
gcc/java:
* constants.c (build_constants_constructor): Avoid negative shift.
gcc:
* config/pdp11/t-pdp11 (java/constants.o-warn): Remove.
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,
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