Commit 6f2d959b by Aldy Hernandez Committed by Aldy Hernandez

re PR c++/56419 (transactions in for-loops disappear)

	PR c++/56419
	* semantics.c (begin_transaction_stmt): Set TREE_SIDE_EFFECTS.
	(build_transaction_expr): Same.

From-SVN: r196282
parent f1ad3354
2013-02-25 Aldy Hernandez <aldyh@redhat.com>
PR c++/56419
* semantics.c (begin_transaction_stmt): Set TREE_SIDE_EFFECTS.
(build_transaction_expr): Same.
2013-02-25 Jason Merrill <jason@redhat.com> 2013-02-25 Jason Merrill <jason@redhat.com>
PR c++/56377 PR c++/56377
......
...@@ -5108,6 +5108,7 @@ begin_transaction_stmt (location_t loc, tree *pcompound, int flags) ...@@ -5108,6 +5108,7 @@ begin_transaction_stmt (location_t loc, tree *pcompound, int flags)
"transactional memory support enabled"))); "transactional memory support enabled")));
TRANSACTION_EXPR_BODY (r) = push_stmt_list (); TRANSACTION_EXPR_BODY (r) = push_stmt_list ();
TREE_SIDE_EFFECTS (r) = 1;
return r; return r;
} }
...@@ -5157,6 +5158,7 @@ build_transaction_expr (location_t loc, tree expr, int flags, tree noex) ...@@ -5157,6 +5158,7 @@ build_transaction_expr (location_t loc, tree expr, int flags, tree noex)
ret = build1 (TRANSACTION_EXPR, TREE_TYPE (expr), expr); ret = build1 (TRANSACTION_EXPR, TREE_TYPE (expr), expr);
if (flags & TM_STMT_ATTR_RELAXED) if (flags & TM_STMT_ATTR_RELAXED)
TRANSACTION_EXPR_RELAXED (ret) = 1; TRANSACTION_EXPR_RELAXED (ret) = 1;
TREE_SIDE_EFFECTS (ret) = 1;
SET_EXPR_LOCATION (ret, loc); SET_EXPR_LOCATION (ret, loc);
return ret; return ret;
} }
......
// { dg-do compile }
// { dg-options "-fgnu-tm" }
int x = 0;
int inc_func(int i) {
for (int j = 0; j < i; ++j)
{
__transaction_atomic { x+=1; }
}
return 0;
}
// { dg-final { scan-assembler "ITM_commitTransaction" } }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment