diff mbox

Backport PR61750 fix

Message ID alpine.LSU.2.11.1411210916520.374@zhemvz.fhfr.qr
State New
Headers show

Commit Message

Richard Biener Nov. 21, 2014, 8:18 a.m. UTC
The following backports a fix I applied to match.pd whilst merging
from match-and-simplify to the original tree-ssa-forwprop.c code
on the 4.9 branch.

Bootstrapped and tested on x86_64-unknown-linux-gnu, applied.

Richard.

2014-11-21  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/61750
	* tree-ssa-forwprop.c (simplify_vce): Verify type sizes
	match for the resulting VIEW_CONVERT_EXPR.
diff mbox

Patch

Index: gcc/tree-ssa-forwprop.c
===================================================================
--- gcc/tree-ssa-forwprop.c	(revision 217764)
+++ gcc/tree-ssa-forwprop.c	(working copy)
@@ -3178,7 +3178,9 @@  simplify_vce (gimple_stmt_iterator *gsi)
 	  && (INTEGRAL_TYPE_P (TREE_TYPE (def_op))
 	      || POINTER_TYPE_P (TREE_TYPE (def_op)))
 	  && (TYPE_PRECISION (TREE_TYPE (op))
-	      == TYPE_PRECISION (TREE_TYPE (def_op))))
+	      == TYPE_PRECISION (TREE_TYPE (def_op)))
+	  && (TYPE_SIZE (TREE_TYPE (op))
+	      == TYPE_SIZE (TREE_TYPE (def_op))))
 	{
 	  TREE_OPERAND (gimple_assign_rhs1 (stmt), 0) = def_op;
 	  update_stmt (stmt);