[PATCH] FIX PR 36431 The C++ front-end produces some NOP_EXPR for vector types

Richard Guenther richard.guenther@gmail.com
Sun Sep 28 22:53:00 GMT 2008


On Sun, Sep 28, 2008 at 2:07 PM, Eric Botcazou <ebotcazou@adacore.com> wrote:
>> * tree.c (build1_stat): Assert that we don't have NOP_EXPR with a vector
>> type.
>
> Minor stylistic nit:
>
> +  /* Convert expressions should not be used with vector types.  */
> +  if (CONVERT_EXPR_CODE_P (code))
> +    gcc_assert (TREE_CODE (type) != VECTOR_TYPE);
>
> I think
>
>  /* Convert expressions should not be used with vector types.  */
>  gcc_assert (!(CONVERT_EXPR_CODE_P (code)
>                && TREE_CODE (type) == VECTOR_TYPE));
>
> is better.

I agree.  But at the same time I don't understand.  You
seem to for

   if (TYPE_MAIN_VARIANT (type) == TYPE_MAIN_VARIANT (orig))
-    return fold_build1 (NOP_EXPR, type, arg);
+    {
+      if (TREE_CODE (type) == VECTOR_TYPE)
+	return fold_build1 (VIEW_CONVERT_EXPR, type, arg);
+      else
+	return fold_build1 (NOP_EXPR, type, arg);
+    }

change CV qualification changes to use V_C_E.  I don't
see why this is necessary - instead this conversion is
stripped away by the gimplifier anyway.

Thus, I'd like to avoid gcc_asserting on CV qualification
changes via a NOP.  Ideally only non-useless type-conversions
need to use V_C_E.

Richard.

>
> --
> Eric Botcazou
>



More information about the Gcc-patches mailing list