This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


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.

--- 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]