The pattern (and the fold_unary code it was derived from) stripping
inner conversions from VIEW_CONVERT_EXPRs is bogus as in that it
doesn't make sure the the size of the types match.  This triggers
a IL verification for gfortran.fortran-torture/compile/forall-1.f90
otherwise.

Committed to the branch.

Richard.

2014-09-03  Richard Biener  <rguent...@suse.de>

        * match-conversions.pd
        ((view_convert (convert @0)) -> (view_convert @0)): Restrict to
        conversions that do not change size.

Index: gcc/match-conversions.pd
===================================================================
--- gcc/match-conversions.pd    (revision 214864)
+++ gcc/match-conversions.pd    (working copy)
@@ -77,12 +77,13 @@
        && TYPE_PRECISION (type) == TYPE_PRECISION (TREE_TYPE (@0)))
    (convert @0)))
 
-/* Strip inner integral conversions that do not change the precision.  */
+/* Strip inner integral conversions that do not change precision or size.  */
 (simplify
   (view_convert (convert@0 @1))
   (if ((INTEGRAL_TYPE_P (TREE_TYPE (@0)) || POINTER_TYPE_P (TREE_TYPE (@0)))
        && (INTEGRAL_TYPE_P (TREE_TYPE (@1)) || POINTER_TYPE_P (TREE_TYPE (@1)))
-       && (TYPE_PRECISION (TREE_TYPE (@0)) == TYPE_PRECISION (TREE_TYPE (@1))))
+       && (TYPE_PRECISION (TREE_TYPE (@0)) == TYPE_PRECISION (TREE_TYPE (@1)))
+       && (TYPE_SIZE (TREE_TYPE (@0)) == TYPE_SIZE (TREE_TYPE (@1))))
    (view_convert @1)))
 
 

Reply via email to