Sean Kelly wrote: > Stefan Rohe wrote: >> Hi, >> >> has anybody experience with the usage of valgrind and D? >> We are here using DMD (dmd 1.033/tango 0.997 but also some older >> versions) >> and got problems using valgrind on this. >> It seems that the _d_newarrayT routine or something under it jumps or >> moves >> on unitialized value(s). > > The last time I looked into this, Valgrind was wrong about these > cases--initialization is actually logically guaranteed. You can check > for yourself though. See lib/compiler/dmd/lifetime.d.
I spent a good looking at similar reports a few years ago. The cause, at the time, was that the gc code walks the stack(s) during collections and has to examine every stack slot since it has no way of knowing anything about which slots are valid and which aren't. Valgrind, on the other hand, does know what stack slots have been assigned values and which haven't so can accurately report that the program has looked at memory that hasn't been initialized yet. One 'fix' might be to pre-initialize the stack with 0's upon function entry. I'm not even terribly convinced that'd work. Later, Brad