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  <rguent...@suse.de>

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

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

Reply via email to