Overview
| Artifact ID: | 049f5e5503e69b0b984d2057f1d6d72e53105d0754b4918b13476b5f5f5052b8 |
|---|---|
| Ticket: | f7495f63c01ea80069198ac183e1e0cc8873dabe
valgrind reports uninitialized memory access running the test suite |
| User & Date: | apnadkarni on 2026-03-11 02:53:59 |
Changes
- closedate changed to: "2461110.6208301387"
- closer changed to: "apnadkarni"
- icomment:
> Hmmm. You are wrong here. Padding always concerns trailing bytes! Read the standard. There is no such requirement **anywhere**. The only thing the standard mandates is maintaining the order of fields in a struct and alignment of individual fields. The location and length of pad bytes is completely up to the compiler except that the padding cannot be at the beginning of the struct. But, as I said I'm being pedantic and may not matter in practice. > Sorry, wrong again. On a 64-bit platform, which requires 64-bit values to be properly aligned, all mallocs are aligned on 8-byte boundaries. Your reference to malloc indicates you simply did not understand the issue. It has nothing to do with allocation strategy. It's a **compiler** expectation that (ScriptLimitCallbackKey *) will point to a location with sizeof(ScriptLimitCallbackKey) valid bytes, no matter how they were allocated, dynamically via malloc, on the stack, or static storage. What your code is doing is the equivalent of this: ``` char buffer[sizeof(ScriptLimitCallbackKey)-sizeof(int)]; ScriptLimitCallbackKey *key = (ScriptLimitCallbackKey *)buf; ``` And with regards to accessing 32-bits versus 64-bits, cost of memory and registry operations is still the same on 64-bit platforms. And if you think adding one less integer is an "optimization" for Tcl performance, I don't know what to say! In any case, do as you wish. I'm not going to comment further.
- login: "apnadkarni"
- mimetype: "text/x-markdown"