From e50fafc97143f9c794bcc9f9d1d938344fed6dbf Mon Sep 17 00:00:00 2001 From: Mamy Ratsimbazafy Date: Thu, 9 Jul 2026 15:47:58 +0200 Subject: [PATCH] Fix #25883 tuple sighash collision (#25889) fixes #25886 fixes #25883 See #25883 Tuples only hash leaves so if 2 tuples have the same flattened representation they collide in the C codegen. Fix by hashing the length as well to disambiguate nesting levels. --------- Co-authored-by: ringabout <43030857+ringabout@users.noreply.github.com> --- compiler/sighashes.nim | 1 + .../t25883_tuple_sighash_collision.nim | 45 +++++++++++++++++++ 2 files changed, 46 insertions(+) create mode 100644 tests/ccgbugs2/t25883_tuple_sighash_collision.nim diff --git a/compiler/sighashes.nim b/compiler/sighashes.nim index 08c83ad29e..b9cfcba443 100644 --- a/compiler/sighashes.nim +++ b/compiler/sighashes.nim @@ -274,6 +274,7 @@ proc hashType(c: var MD5Context, t: PType; flags: set[ConsiderFlag]; conf: Confi c.hashTree(t.n, {}, conf) of tyTuple: c &= char(t.kind) + c &= t.len if t.n != nil and CoType notin flags: for i in 0..