diff mbox

Fix ICE with __builtin_*_overflow_p on bitfields (PR rtl-optimization/71673)

Message ID 20160627181829.GR7387@tucnak.redhat.com
State New
Headers show

Commit Message

Jakub Jelinek June 27, 2016, 6:18 p.m. UTC
Hi!

On targets which don't support sub-word operations trying OPTAB_DIRECT
AND on e.g. QImode or HImode leads to NULL being returned, so we ICE on
builtin-arith-overflow-p-19.c e.g. on arm, aarch64 or sparc*.

Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux, tested
with cross-compiler on the testcase, ok for trunk?

2016-06-27  Jakub Jelinek  <jakub@redhat.com>

	PR rtl-optimization/71673
	* internal-fn.c (expand_arith_overflow_result_store): Use
	OPTAB_LIB_WIDEN instead of OPTAB_DIRECT as last argument to
	expand_simple_binop.


	Jakub

Comments

Richard Biener June 28, 2016, 7:15 a.m. UTC | #1
On Mon, 27 Jun 2016, Jakub Jelinek wrote:

> Hi!
> 
> On targets which don't support sub-word operations trying OPTAB_DIRECT
> AND on e.g. QImode or HImode leads to NULL being returned, so we ICE on
> builtin-arith-overflow-p-19.c e.g. on arm, aarch64 or sparc*.
> 
> Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux, tested
> with cross-compiler on the testcase, ok for trunk?

Ok.

Richard.

> 2016-06-27  Jakub Jelinek  <jakub@redhat.com>
> 
> 	PR rtl-optimization/71673
> 	* internal-fn.c (expand_arith_overflow_result_store): Use
> 	OPTAB_LIB_WIDEN instead of OPTAB_DIRECT as last argument to
> 	expand_simple_binop.
> 
> --- gcc/internal-fn.c.jj	2016-06-24 13:01:58.000000000 +0200
> +++ gcc/internal-fn.c	2016-06-27 13:38:25.753237581 +0200
> @@ -454,7 +454,7 @@ expand_arith_overflow_result_store (tree
>  	    = immed_wide_int_const (wi::shifted_mask (0, prec, false, tgtprec),
>  				    tgtmode);
>  	  lres = expand_simple_binop (tgtmode, AND, res, mask, NULL_RTX,
> -				      true, OPTAB_DIRECT);
> +				      true, OPTAB_LIB_WIDEN);
>  	}
>        else
>  	{
> 
> 	Jakub
> 
>
diff mbox

Patch

--- gcc/internal-fn.c.jj	2016-06-24 13:01:58.000000000 +0200
+++ gcc/internal-fn.c	2016-06-27 13:38:25.753237581 +0200
@@ -454,7 +454,7 @@  expand_arith_overflow_result_store (tree
 	    = immed_wide_int_const (wi::shifted_mask (0, prec, false, tgtprec),
 				    tgtmode);
 	  lres = expand_simple_binop (tgtmode, AND, res, mask, NULL_RTX,
-				      true, OPTAB_DIRECT);
+				      true, OPTAB_LIB_WIDEN);
 	}
       else
 	{