Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 18d0f8c023042763e3623baec06291007dd977605d7ff9c7135b1f0f88a58f6f
Ticket: f7495f63c01ea80069198ac183e1e0cc8873dabe
valgrind reports uninitialized memory access running the test suite
User & Date: apnadkarni on 2026-03-10 17:41:04
Changes

  1. closedate changed to: "2461110.2368603009"
  2. closer changed to: "apnadkarni"
  3. icomment:
    Sorry, I did not see your response earlier. It appears I am not getting mail notifications from bugs any more and I'm currently only sporadically tracking the tickets.
    
    Yep, I know Windows also had the problem. But it was visible on Unix thanks to valgrind. I think if there were tests that forced collisions in the hash table, it might have shown up on both platforms.
    
    I am uncomfortable with your solution for two reasons. 
    
    First, the C standard does not guarantee the 4 pad bytes appear as trailing bytes. They could appear *before* the type field (and no trailing pad) while still maintaining the alignment and field ordering guarantees made by the standard. And in that case your code would break.
    
    Having said that, perhaps I'm being pedantic and no compiler does that in the real world. 
    
    Second, and more important, consider that with your code, the `AllocArrayEntry` in the hash module allocates 12 bytes for the key. However, the line
    
    ```
    keyPtr = (ScriptLimitCallbackKey *)
    		Tcl_GetHashKey(&iPtr->limit.callbacks, hashPtr);
    ```
    
    casts the 12 byte allocation to a pointer to a 16 byte struct! I really do not like this kind of violation of compiler contracts no matter whether there is any practical effect.
    
    So I would still prefer the fix I had proposed particularly as I don't see any particular advantage of your solution.
    
  4. login: "apnadkarni"
  5. mimetype: "text/x-markdown"