--- Comment #12 from acsawdey at gcc dot ---
This function is called from cp/semantics.c maybe_cleanup_point_expr()

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

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.

Reply via email to