Patchwork [4.7] Backport fix to [un]signed_type_for

login
register
mail settings
Submitter William J. Schmidt
Date May 10, 2012, 5:20 p.m.
Message ID <1336670437.11473.38.camel@gnopaine>
Download mbox | patch
Permalink /patch/158349/
State New
Headers show

Comments

William J. Schmidt - May 10, 2012, 5:20 p.m.
On Thu, 2012-05-10 at 18:49 +0200, Jakub Jelinek wrote:
> On Thu, May 10, 2012 at 11:44:27AM -0500, William J. Schmidt wrote:
> > Backporting this patch to 4.7 fixes a problem building Fedora 17.
> > Bootstrapped and regression tested on powerpc64-unknown-linux-gnu.  Is
> > the backport OK?
> 
> For 4.7 I'd very much prefer a less intrusive change (i.e. change
> the java langhook) instead, but I'll defer to Richard if he prefers
> this over that.

OK.  If that's desired, this is the possible change to the langhook:

which also fixed the problem and bootstraps without regressions.
Whichever you guys prefer is fine with me.

Thanks,
Bill
> 
> > 2012-05-10  Bill Schmidt  <wschmidt@vnet.linux.ibm.com>
> > 
> > 	Backport from trunk:
> > 	2012-03-12  Richard Guenther  <rguenther@suse.de>
> > 
> > 	* tree.c (signed_or_unsigned_type_for): Use
> > 	build_nonstandard_integer_type.
> > 	(signed_type_for): Adjust documentation.
> > 	(unsigned_type_for): Likewise.
> > 	* tree-pretty-print.c (dump_generic_node): Use standard names
> > 	for non-standard integer types if available.
> 
> 	Jakub
>
Richard Guenther - May 11, 2012, 8:06 a.m.
On Thu, 10 May 2012, William J. Schmidt wrote:

> On Thu, 2012-05-10 at 18:49 +0200, Jakub Jelinek wrote:
> > On Thu, May 10, 2012 at 11:44:27AM -0500, William J. Schmidt wrote:
> > > Backporting this patch to 4.7 fixes a problem building Fedora 17.
> > > Bootstrapped and regression tested on powerpc64-unknown-linux-gnu.  Is
> > > the backport OK?
> > 
> > For 4.7 I'd very much prefer a less intrusive change (i.e. change
> > the java langhook) instead, but I'll defer to Richard if he prefers
> > this over that.
> 
> OK.  If that's desired, this is the possible change to the langhook:
> 
> Index: gcc/java/typeck.c
> ===================================================================
> --- gcc/java/typeck.c	(revision 187158)
> +++ gcc/java/typeck.c	(working copy)
> @@ -189,6 +189,12 @@ java_type_for_size (unsigned bits, int unsignedp)
>      return unsignedp ? unsigned_int_type_node : int_type_node;
>    if (bits <= TYPE_PRECISION (long_type_node))
>      return unsignedp ? unsigned_long_type_node : long_type_node;
> +  /* A 64-bit target with TImode requires 128-bit type definitions
> +     for bitsizetype.  */
> +  if (int128_integer_type_node
> +      && bits == TYPE_PRECISION (int128_integer_type_node))
> +    return (unsignedp ? int128_unsigned_type_node
> +	    : int128_integer_type_node);
>    return 0;
>  }
> 
> which also fixed the problem and bootstraps without regressions.
> Whichever you guys prefer is fine with me.

I prefer the java variant, too.

Thanks,
Richard.

Patch

Index: gcc/java/typeck.c
===================================================================
--- gcc/java/typeck.c	(revision 187158)
+++ gcc/java/typeck.c	(working copy)
@@ -189,6 +189,12 @@  java_type_for_size (unsigned bits, int unsignedp)
     return unsignedp ? unsigned_int_type_node : int_type_node;
   if (bits <= TYPE_PRECISION (long_type_node))
     return unsignedp ? unsigned_long_type_node : long_type_node;
+  /* A 64-bit target with TImode requires 128-bit type definitions
+     for bitsizetype.  */
+  if (int128_integer_type_node
+      && bits == TYPE_PRECISION (int128_integer_type_node))
+    return (unsignedp ? int128_unsigned_type_node
+	    : int128_integer_type_node);
   return 0;
 }