[Bug target/83660] ICE with vec_extract inside expression statement

jakub at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Fri Apr 13 17:05:00 GMT 2018


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83660

--- Comment #13 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
(In reply to acsawdey from comment #12)
> This function is called from cp/semantics.c maybe_cleanup_point_expr()
> 
> tree
> fold_build_cleanup_point_expr (tree type, tree expr)
> {
>   /* If the expression does not have side effects then we don't have to wrap
>      it with a cleanup point expression.  */
>   if (!TREE_SIDE_EFFECTS (expr))
>     return expr;
> 
> In the vec_extract case it bails out due to no side effects and does not put
> in the cleanup point.
> 
> So in fact a more minimal version of Jakub's patch also works. If you mark
> that this has side effects, then the cleanup point is added for us by the
> existing code:
> 
> Index: config/rs6000/rs6000-c.c
> ===================================================================
> --- config/rs6000/rs6000-c.c    (revision 259353)
> +++ config/rs6000/rs6000-c.c    (working copy)
> @@ -6704,6 +6704,8 @@
>        stmt = convert (innerptrtype, stmt);
>        stmt = build_binary_op (loc, PLUS_EXPR, stmt, arg2, 1);
>        stmt = build_indirect_ref (loc, stmt, RO_NULL);
> +      if (c_dialect_cxx ())
> +       TREE_SIDE_EFFECTS (stmt) = 1;
>  
>        return stmt;
>      }
> 
> Any comments on whether this is the right way to fix this? I think the
> vec_insert case does not need to be changed because the MODIFY_EXPR used
> there will mark that there are side effects for us.

I think this is reasonable, but should have a comment why we do that.


More information about the Gcc-bugs mailing list