>From df19d15330a4a75a7cbc0f6f28bf0bf2e42cc386 Mon Sep 17 00:00:00 2001
From: MarcoFalke <[email protected]>
Date: Mon, 5 Jan 2026 09:51:27 +0000
Subject: [PATCH] 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.

        PR tree-optimization/123351

gcc/ChangeLog:

    * tree-object-size.cc (object_sizes_set_temp): Separate calls to
    make_ssa_name to ensure deterministic execution order.
---
 gcc/tree-object-size.cc | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/gcc/tree-object-size.cc b/gcc/tree-object-size.cc
index 65bcdd57325..66bb8a87aba 100644
--- a/gcc/tree-object-size.cc
+++ b/gcc/tree-object-size.cc
@@ -322,9 +322,11 @@ object_sizes_set_temp (struct object_size_info
*osi, unsigned varno)
   tree val = object_sizes_get (osi, varno);

   if (size_initval_p (val, osi->object_size_type))
-    object_sizes_set (osi, varno,
-              make_ssa_name (sizetype),
-              make_ssa_name (sizetype));
+    {
+      tree s = make_ssa_name (sizetype);
+      tree w = make_ssa_name (sizetype);
+      object_sizes_set (osi, varno, s, w);
+    }
 }

 /* Initialize OFFSET_LIMIT variable.  */
-- 
2.51.0
From df19d15330a4a75a7cbc0f6f28bf0bf2e42cc386 Mon Sep 17 00:00:00 2001
From: MarcoFalke <[email protected]>
Date: Mon, 5 Jan 2026 09:51:27 +0000
Subject: [PATCH] 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.

        PR tree-optimization/123351

gcc/ChangeLog:

	* tree-object-size.cc (object_sizes_set_temp): Separate calls to
	make_ssa_name to ensure deterministic execution order.
---
 gcc/tree-object-size.cc | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/gcc/tree-object-size.cc b/gcc/tree-object-size.cc
index 65bcdd57325..66bb8a87aba 100644
--- a/gcc/tree-object-size.cc
+++ b/gcc/tree-object-size.cc
@@ -322,9 +322,11 @@ object_sizes_set_temp (struct object_size_info *osi, unsigned varno)
   tree val = object_sizes_get (osi, varno);
 
   if (size_initval_p (val, osi->object_size_type))
-    object_sizes_set (osi, varno,
-		      make_ssa_name (sizetype),
-		      make_ssa_name (sizetype));
+    {
+      tree s = make_ssa_name (sizetype);
+      tree w = make_ssa_name (sizetype);
+      object_sizes_set (osi, varno, s, w);
+    }
 }
 
 /* Initialize OFFSET_LIMIT variable.  */
-- 
2.51.0

Reply via email to