From: Nicholas N. <nj...@ca...> - 2003-06-10 14:58:54
|
On Tue, 10 Jun 2003, Leonard mckinley wrote: > Just a curious question. What is valgrind's test for "dealing" > with uninitialized data? It appears reading it moving it around > is OK, but using it to perform "a computation" is an error? But > what is "a computation" in this context? validity is checked when a value is: 1. used in a condition (affects control flow) 2. used by a syscall (ie. argument) (affects side effects seen by outside world) That's it. It might not seem like much, but it's enough, if you think about it - that catches all cases where an invalid value can affect the behaviour of your program, as viewed by the outside world. Note especially that structs can have "holes" in them (due to padding inserted by the compiler to improve field alignments) so copying has to be ok. > This guess seems consistent with the fact that valgrind doesn't flag > passing uninitialized data to a function so long as the parameter isn't > used. But I'd like to know the full story. N |