Patchwork RFA: Fix java/46386

login
register
mail settings
Submitter Joern Rennecke
Date Nov. 9, 2010, 10:25 a.m.
Message ID <20101109052530.4n6wwwhu4o40wkw8-nzlynne@webmail.spamcop.net>
Download mbox | patch
Permalink /patch/70523/
State New
Headers show

Comments

Joern Rennecke - Nov. 9, 2010, 10:25 a.m.
Quoting Andrew Haley <aph@redhat.com>:

> I am always opposed to obfuscating code in order to suppress bogus warnings.
>
> Can I suggest
>
>   temp <<= (POINTER_SIZE > 32) ? POINTER_SIZE - 32 : 0;

Yes, that also works fine for the pdp11 build.

Currently bootstrapping on i686-pc-linux-gnu.
2010-11-09  Joern Rennecke  <amylaar@spamcop.net>
	    Andrew Haley  <aph@redhat.com>

	PR java/46386
gcc/java:
	* constants.c (build_constants_constructor): Avoid negative shift.
gcc:
	* config/pdp11/t-pdp11 (java/constants.o-warn): Remove.
Paul Koning - Nov. 9, 2010, 3:26 p.m.
PDP11 part is ok.  Thanks!

	paul

On Nov 9, 2010, at 5:25 AM, Joern Rennecke wrote:

> Quoting Andrew Haley <aph@redhat.com>:
> 
>> I am always opposed to obfuscating code in order to suppress bogus warnings.
>> 
>> Can I suggest
>> 
>>  temp <<= (POINTER_SIZE > 32) ? POINTER_SIZE - 32 : 0;
> 
> Yes, that also works fine for the pdp11 build.
> 
> Currently bootstrapping on i686-pc-linux-gnu.
> 2010-11-09  Joern Rennecke  <amylaar@spamcop.net>
> 	    Andrew Haley  <aph@redhat.com>
> 
> 	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)
> @@ -540,8 +540,8 @@ build_constants_constructor (void)
> 	     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;
> +	  if (BYTES_BIG_ENDIAN)
> +	    temp <<= ((POINTER_SIZE > 32) ? POINTER_SIZE - 32 : 0);
> 
>           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
Joern Rennecke - Nov. 16, 2010, 9:03 p.m.
Regarding:
http://gcc.gnu.org/ml/gcc-patches/2010-11/msg00872.html

Quoting Paul Koning <paul_koning@dell.com>:

> PDP11 part is ok.  Thanks!

I still need approval of the java part.
FWIW that also affects avr.
Tom Tromey - Nov. 16, 2010, 9:31 p.m.
>>>>> "Joern" == Joern Rennecke <amylaar@spamcop.net> writes:

Joern> http://gcc.gnu.org/ml/gcc-patches/2010-11/msg00872.html

Joern> Quoting Paul Koning <paul_koning@dell.com>:

>> PDP11 part is ok.  Thanks!

Joern> I still need approval of the java part.
Joern> FWIW that also affects avr.

It is ok.  Thanks.

Tom

Patch

Index: java/constants.c
===================================================================
--- java/constants.c	(revision 166429)
+++ java/constants.c	(working copy)
@@ -540,8 +540,8 @@  build_constants_constructor (void)
 	     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;
+	  if (BYTES_BIG_ENDIAN)
+	    temp <<= ((POINTER_SIZE > 32) ? POINTER_SIZE - 32 : 0);
 
           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