Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 5128228f8ef3960fbc4aad6b1fa1a8481eb5b6e120277a03bfc69a5bce6b0c87
Ticket: f7495f63c01ea80069198ac183e1e0cc8873dabe
valgrind reports uninitialized memory access running the test suite
User & Date: jan.nijtmans on 2026-03-12 07:57:42
Changes

  1. closedate changed to: "2461111.8317438541"
  2. closer changed to: "jan.nijtmans"
  3. icomment:
    Well, just for the fun, I checked the assembler generated (both with gcc and clang on ARM64, maximum optimization -O3). It looked like:
    <pre>
            mov     x1, x0
            ldr     x0, [x0]
            ldr     w1, [x1, 8]
            b       Tcl_LimitRemoveHandler(void*, int)
    </pre>
    Conclusion: the optimization you suggest, which I don't think is valid, isn't done by either gcc or clang. If - for the fun - the type of "type" is changed to ptrdiff, I get:
    <pre>
            ldp     x0, x1, [x0]
            b       Tcl_LimitRemoveHandler(void*, long)
    </pre>
    so the compiler knows the ldp instruction.
    
    I did another experiment, forcing 64-bit access in this exact place. The result was a crash in testcase interp-34.7. So whenever a compiler does this (in my view) invalid optimization, we have a testcase for it, which triggers consistently. I'm sure that, whenever a compiler introduces this optimization, Tcl will not be the only project broken. (It would not be the first time this happens)
    
  4. login: "jan.nijtmans"
  5. mimetype: "text/x-fossil-wiki"