diff options
author | jason <jason@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-07-09 03:33:54 +0000 |
---|---|---|
committer | jason <jason@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-07-09 03:33:54 +0000 |
commit | 3115bda06f241a032e3e5dca50556203a98767a0 (patch) | |
tree | 2933e4a1c40cd6d7cb203f1eec34d632fcacf4b8 /gcc/c-family | |
parent | dabebf7ecc90b59b0603d2428cf465fe1f0d642b (diff) | |
download | gcc-3115bda06f241a032e3e5dca50556203a98767a0.tar.gz |
PR c++/45437
gcc/
* gimplify.c (goa_stabilize_expr): Handle RHS preevaluation in
compound assignment.
gcc/c-family/
* c-omp.c (check_omp_for_incr_expr): Handle preevaluation.
gcc/cp/
* typeck.c (cp_build_modify_expr): Preevaluate RHS.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@176072 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/c-family')
-rw-r--r-- | gcc/c-family/ChangeLog | 3 | ||||
-rw-r--r-- | gcc/c-family/c-omp.c | 21 |
2 files changed, 24 insertions, 0 deletions
diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog index 72a118a942f..87930c21fcf 100644 --- a/gcc/c-family/ChangeLog +++ b/gcc/c-family/ChangeLog @@ -1,5 +1,8 @@ 2011-07-08 Jason Merrill <jason@redhat.com> + PR c++/45437 + * c-omp.c (check_omp_for_incr_expr): Handle preevaluation. + PR c++/49673 * c-common.c (c_apply_type_quals_to_decl): Don't check TYPE_NEEDS_CONSTRUCTING. diff --git a/gcc/c-family/c-omp.c b/gcc/c-family/c-omp.c index 1ee0bf0f8d5..d2256ffd376 100644 --- a/gcc/c-family/c-omp.c +++ b/gcc/c-family/c-omp.c @@ -213,6 +213,27 @@ check_omp_for_incr_expr (location_t loc, tree exp, tree decl) return fold_build2_loc (loc, PLUS_EXPR, TREE_TYPE (exp), TREE_OPERAND (exp, 0), t); break; + case COMPOUND_EXPR: + { + /* cp_build_modify_expr forces preevaluation of the RHS to make + sure that it is evaluated before the lvalue-rvalue conversion + is applied to the LHS. Reconstruct the original expression. */ + tree op0 = TREE_OPERAND (exp, 0); + if (TREE_CODE (op0) == TARGET_EXPR + && !VOID_TYPE_P (TREE_TYPE (op0))) + { + tree op1 = TREE_OPERAND (exp, 1); + tree temp = TARGET_EXPR_SLOT (op0); + if (TREE_CODE_CLASS (TREE_CODE (op1)) == tcc_binary + && TREE_OPERAND (op1, 1) == temp) + { + op1 = copy_node (op1); + TREE_OPERAND (op1, 1) = TARGET_EXPR_INITIAL (op0); + return check_omp_for_incr_expr (loc, op1, decl); + } + } + break; + } default: break; } |