Overview
| Artifact ID: | f70b70c59428bed3dc8ff74d71b1beb7b5fa80f95283fdf58069b0cb85b22ec5 |
|---|---|
| Ticket: | f7495f63c01ea80069198ac183e1e0cc8873dabe
valgrind reports uninitialized memory access running the test suite |
| User & Date: | sebres on 2026-03-12 13:13:23 |
Changes
- closedate changed to: "2461112.0509645604"
- closer changed to: "sebres"
- icomment:
> You think this would be a valid (future) optimization. I think it won't be a valid optimization at all It is not about "think", it is about "know". Because I know this. The compiler is entitled to assume that an object of type struct occupies its full `sizeof(struct)` in memory. That's it. > it would do read access of uninitialized padding bytes Jan, this sentence doesn't make sense at all. Why shall the padding be initialized? And what do you think the padding is for? The alignment (for faster CPU access) is only one purpose (and almost of little importance)...<br/> The more purposes are: - to allow CPUs faster fetch data from memory in fixed-size chunks known as the "word size" (e.g. 8 bytes at a time). - hardware compatibility, since on some architectures accessing unaligned data is completely disallowed and can cause a hardware exception or crash. But in the same way there are architectures where the accessing of blocks smaller than "word size" is impossible. Apropos alignment, who guarantees that the block retrieved by<br/> `(ScriptLimitCallbackKey *)Tcl_GetHashKey(&iPtr->limit.callbacks, hashPtr);`<br/> is properly aligned? If for instance the internal handling of allocation in hash table changes tomorrow and the buckets will be allocated as 10*12, e. g. as a chunk with 10 each 12 bytes blocks, so every 2nd block in such a chunk becomes misaligned. Again, you disagree not with me, but with C-standard. Or rather with the fact that such cast can be considered as an UB. Particularly with this 3 paragraphs in the C-standard: 1. Pointer Conversion and Alignment (6.3.2.3, p7) 2. Accessing Beyond Object Boundaries (6.5.6, p8) 3. Strict Aliasing (6.5, p7) Some UBs may works years till some days they'd stop to work.
- login: "sebres"
- mimetype: "text/x-markdown"