Message ID | CAFiYyc1vz-ZjTdrfuPjS=QU=krNEVQaBVpAzozeBZuYGZXkHAg@mail.gmail.com |
---|---|
State | New |
Headers | show |
On 06/05/2014 09:05 AM, Richard Biener wrote: > + *expr_p = build2 (COMPOUND_EXPR, TREE_TYPE (*expr_p), > + op0, build_fold_addr_expr (op1)); That seems like a fine approach. Jason
Hi, On 06/05/2014 03:12 PM, Jason Merrill wrote: > On 06/05/2014 09:05 AM, Richard Biener wrote: >> + *expr_p = build2 (COMPOUND_EXPR, TREE_TYPE (*expr_p), >> + op0, build_fold_addr_expr (op1)); > > That seems like a fine approach. Thanks a lot guys. Therefore I'm going to regtest it and if everything goes well commit it with a testcase. Thanks again, Paolo.
On Thu, Jun 5, 2014 at 3:12 PM, Paolo Carlini <paolo.carlini@oracle.com> wrote: > Hi, > > > On 06/05/2014 03:12 PM, Jason Merrill wrote: >> >> On 06/05/2014 09:05 AM, Richard Biener wrote: >>> >>> + *expr_p = build2 (COMPOUND_EXPR, TREE_TYPE (*expr_p), >>> + op0, build_fold_addr_expr (op1)); >> >> >> That seems like a fine approach. > > Thanks a lot guys. Therefore I'm going to regtest it and if everything goes > well commit it with a testcase. I think the operands have to be reversed though - the type matches that of op0. Sorry ;) Richard. > Thanks again, > Paolo.
Index: gcc/cp/cp-gimplify.c =================================================================== --- gcc/cp/cp-gimplify.c (revision 211262) +++ gcc/cp/cp-gimplify.c (working copy) @@ -629,18 +629,14 @@ cp_gimplify_expr (tree *expr_p, gimple_s Also drop volatile variables on the RHS to avoid infinite recursion from gimplify_expr trying to load the value. */ - if (!TREE_SIDE_EFFECTS (op1) - || (DECL_P (op1) && TREE_THIS_VOLATILE (op1))) + if (!TREE_SIDE_EFFECTS (op1)) *expr_p = op0; - else if (TREE_CODE (op1) == MEM_REF - && TREE_THIS_VOLATILE (op1)) + else if (TREE_THIS_VOLATILE (op1) + && (REFERENCE_CLASS_P (op1) || DECL_P (op1))) { - /* Similarly for volatile MEM_REFs on the RHS. */ - if (!TREE_SIDE_EFFECTS (TREE_OPERAND (op1, 0))) - *expr_p = op0; - else - *expr_p = build2 (COMPOUND_EXPR, TREE_TYPE (*expr_p), - TREE_OPERAND (op1, 0), op0); + *expr_p = build2 (COMPOUND_EXPR, TREE_TYPE (*expr_p), + op0, build_fold_addr_expr (op1)); + } else *expr_p = build2 (COMPOUND_EXPR, TREE_TYPE (*expr_p),