@@ -561,6 +561,17 @@ build_unary_op (tree_code code, tree type, tree arg)
561
561
care about, storing the value in VALUEP. Callers must ensure that the
562
562
returned expression is evaluated before VALUEP. */
563
563
564
+ tree
565
+ stabilize_expr2 (tree exp)
566
+ {
567
+ if (!TREE_SIDE_EFFECTS (exp) || VOID_TYPE_P (TREE_TYPE (exp)))
568
+ return exp;
569
+
570
+ tree init = force_target_expr (exp);
571
+
572
+ return compound_expr (init, TARGET_EXPR_SLOT (init));
573
+ }
574
+
564
575
tree
565
576
stabilize_expr (tree *valuep)
566
577
{
@@ -1193,6 +1204,7 @@ find_aggregate_field (tree type, tree ident, tree offset)
1193
1204
1194
1205
return NULL_TREE;
1195
1206
}
1207
+
1196
1208
/* Return a constructor that matches the layout of the class expression EXP. */
1197
1209
1198
1210
tree
@@ -1530,7 +1542,7 @@ indirect_ref (tree type, tree exp)
1530
1542
return exp;
1531
1543
1532
1544
/* Maybe rewrite: *(e1, e2) => (e1, *e2) */
1533
- tree init = stabilize_expr (& exp);
1545
+ exp = stabilize_expr2 ( exp);
1534
1546
1535
1547
if (TREE_CODE (TREE_TYPE (exp)) == REFERENCE_TYPE)
1536
1548
exp = fold_build1 (INDIRECT_REF, type, exp);
@@ -1540,7 +1552,7 @@ indirect_ref (tree type, tree exp)
1540
1552
exp = build_deref (exp);
1541
1553
}
1542
1554
1543
- return compound_expr (init, exp) ;
1555
+ return exp;
1544
1556
}
1545
1557
1546
1558
/* Returns indirect reference of EXP, which must be a pointer type. */
0 commit comments