mirror of
https://gcc.gnu.org/git/gcc.git
synced 2025-01-09 20:44:07 +08:00
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
This commit is contained in:
parent
f1ad33546d
commit
6f2d959b9e
@ -1,3 +1,9 @@
|
||||
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>
|
||||
|
||||
PR c++/56377
|
||||
|
@ -5108,6 +5108,7 @@ begin_transaction_stmt (location_t loc, tree *pcompound, int flags)
|
||||
"transactional memory support enabled")));
|
||||
|
||||
TRANSACTION_EXPR_BODY (r) = push_stmt_list ();
|
||||
TREE_SIDE_EFFECTS (r) = 1;
|
||||
return r;
|
||||
}
|
||||
|
||||
@ -5157,6 +5158,7 @@ build_transaction_expr (location_t loc, tree expr, int flags, tree noex)
|
||||
ret = build1 (TRANSACTION_EXPR, TREE_TYPE (expr), expr);
|
||||
if (flags & TM_STMT_ATTR_RELAXED)
|
||||
TRANSACTION_EXPR_RELAXED (ret) = 1;
|
||||
TREE_SIDE_EFFECTS (ret) = 1;
|
||||
SET_EXPR_LOCATION (ret, loc);
|
||||
return ret;
|
||||
}
|
||||
|
13
gcc/testsuite/g++.dg/tm/pr56419.C
Normal file
13
gcc/testsuite/g++.dg/tm/pr56419.C
Normal file
@ -0,0 +1,13 @@
|
||||
// { 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" } }
|
Loading…
Reference in New Issue
Block a user