Skip to content

File tree

2 files changed

+50
-1
lines changed

2 files changed

+50
-1
lines changed

contrib/guix/manifest.scm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ desirable for building Bitcoin Core release binaries."
123123

124124
(define (gcc-libgcc-patches gcc)
125125
(package-with-extra-patches gcc
126-
(search-our-patches "gcc-remap-guix-store.patch")))
126+
(search-our-patches "gcc-remap-guix-store.patch" "gcc-ssa-generation.patch")))
127127

128128
(define (binutils-mingw-patches binutils)
129129
(package-with-extra-patches binutils
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
commit b46614ebfc57ccca8a050668ad0e8ba5968c5943
2+
Author: Jakub Jelinek <[email protected]>
3+
Date: Tue Jan 6 08:36:20 2026 +0100
4+
5+
tree-object-size: Deterministic SSA generation [PR123351]
6+
7+
The order of evaluation of function arguments is unspecified in C++.
8+
The function object_sizes_set_temp called object_sizes_set with two
9+
calls to make_ssa_name() as arguments. Since make_ssa_name() has the
10+
side effect of incrementing the global SSA version counter, different
11+
architectures of the same compiler evaluated these calls in different
12+
orders.
13+
14+
This resulted in non-deterministic SSA version numbering between
15+
x86_64 and aarch64 hosts during cross-compilation, leading to
16+
divergent object files.
17+
18+
Sequencing the calls into separate statements ensures deterministic
19+
evaluation order.
20+
21+
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=123351
22+
https://gcc.gnu.org/pipermail/gcc-patches/2026-January/704817.html
23+
24+
2026-01-06 Jakub Jelinek <[email protected]>
25+
Marco Falke <[email protected]>
26+
27+
PR tree-optimization/123351
28+
* tree-object-size.cc (object_sizes_set_temp): Separate calls to
29+
make_ssa_name to ensure deterministic execution order.
30+
31+
diff --git a/gcc/tree-object-size.cc b/gcc/tree-object-size.cc
32+
index 018fbc30cbb..24e7d710371 100644
33+
--- a/gcc/tree-object-size.cc
34+
+++ b/gcc/tree-object-size.cc
35+
@@ -319,9 +319,11 @@ object_sizes_set_temp (struct object_size_info *osi, unsigned varno)
36+
tree val = object_sizes_get (osi, varno);
37+
38+
if (size_initval_p (val, osi->object_size_type))
39+
- object_sizes_set (osi, varno,
40+
- make_ssa_name (sizetype),
41+
- make_ssa_name (sizetype));
42+
+ {
43+
+ val = make_ssa_name (sizetype);
44+
+ tree wholeval = make_ssa_name (sizetype);
45+
+ object_sizes_set (osi, varno, val, wholeval);
46+
+ }
47+
}
48+
49+
/* Initialize OFFSET_LIMIT variable. */

0 commit comments

Comments
 (0)