Skip to content

Commit c6085ca

Browse files
committed
tree-object-size: Deterministic SSA generation [PR123351]
The order of evaluation of function arguments is unspecified in C++. The function object_sizes_set_temp called object_sizes_set with two calls to make_ssa_name() as arguments. Since make_ssa_name() has the side effect of incrementing the global SSA version counter, different architectures of the same compiler evaluated these calls in different orders. This resulted in non-deterministic SSA version numbering between x86_64 and aarch64 hosts during cross-compilation, leading to divergent object files. Sequencing the calls into separate statements ensures deterministic evaluation order. 2026-01-06 Jakub Jelinek <[email protected]> Marco Falke <[email protected]> PR tree-optimization/123351 * tree-object-size.cc (object_sizes_set_temp): Separate calls to make_ssa_name to ensure deterministic execution order.
1 parent e32c3fb commit c6085ca

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

gcc/tree-object-size.cc

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -322,9 +322,11 @@ object_sizes_set_temp (struct object_size_info *osi, unsigned varno)
322322
tree val = object_sizes_get (osi, varno);
323323

324324
if (size_initval_p (val, osi->object_size_type))
325-
object_sizes_set (osi, varno,
326-
make_ssa_name (sizetype),
327-
make_ssa_name (sizetype));
325+
{
326+
val = make_ssa_name (sizetype);
327+
tree wholeval = make_ssa_name (sizetype);
328+
object_sizes_set (osi, varno, val, wholeval);
329+
}
328330
}
329331

330332
/* Initialize OFFSET_LIMIT variable. */

0 commit comments

Comments
 (0)