@@ -587,6 +587,16 @@ stabilize_expr2 (tree *valuep)
587
587
|| VOID_TYPE_P (TREE_TYPE (expr)))
588
588
return NULL_TREE;
589
589
590
+ /* Stabilize only the right hand side of compound expressions. */
591
+ if (TREE_CODE (expr) == COMPOUND_EXPR)
592
+ {
593
+ tree lhs = TREE_OPERAND (expr, 0 );
594
+ tree rhs = TREE_OPERAND (expr, 1 );
595
+ lhs = compound_expr (lhs, stabilize_expr2 (&rhs));
596
+ *valuep = rhs;
597
+ return lhs;
598
+ }
599
+
590
600
tree init = force_target_expr (expr);
591
601
*valuep = TARGET_EXPR_SLOT (init);
592
602
@@ -929,13 +939,10 @@ build_struct_comparison (tree_code code, StructDeclaration *sd,
929
939
return build_boolop (code, integer_zero_node, integer_zero_node);
930
940
931
941
/* Make temporaries to prevent multiple evaluations. */
932
- tree t1init = stabilize_expr (&t1);
933
- tree t2init = stabilize_expr (&t2);
942
+ tree t1init = stabilize_expr2 (&t1);
943
+ tree t2init = stabilize_expr2 (&t2);
934
944
tree result;
935
945
936
- t1 = d_save_expr (t1);
937
- t2 = d_save_expr (t2);
938
-
939
946
/* Bitwise comparison of structs not returned in memory may not work
940
947
due to data holes loosing its zero padding upon return.
941
948
As a heuristic, small structs are not compared using memcmp either. */
@@ -1337,6 +1344,12 @@ component_ref (tree object, tree field)
1337
1344
if (error_operand_p (object) || error_operand_p (field))
1338
1345
return error_mark_node;
1339
1346
1347
+ if (TREE_CODE (object) == COMPOUND_EXPR)
1348
+ {
1349
+ tree result = component_ref (TREE_OPERAND (object, 1 ), field);
1350
+ return compound_expr (TREE_OPERAND (object, 0 ), result);
1351
+ }
1352
+
1340
1353
gcc_assert (TREE_CODE (field) == FIELD_DECL);
1341
1354
1342
1355
/* If the FIELD is from an anonymous aggregate, generate a reference
0 commit comments