This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug target/83660] ICE with vec_extract inside expression statement
- From: "acsawdey at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Fri, 13 Apr 2018 16:57:51 +0000
- Subject: [Bug target/83660] ICE with vec_extract inside expression statement
- Auto-submitted: auto-generated
- References: <bug-83660-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83660
--- Comment #12 from acsawdey at gcc dot gnu.org ---
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.