|
|
|
|
|
by deschutes
1514 days ago
|
|
My complaint is that it is too easy to create an object with uninitialized members by accident. On account of the syntax being identical. I guess its too late to add affordances there. I suppose a definition of valid that prohibited uninitialized members would preclude lots of useful stuff like container and buffer types. From the msan documentation [1], the flaw with my earlier example is that `printf` isn't instrumented. And to address your other question, I don't know if msan can instrument a function implemented in assembly. It definitely can't deal with something it didn't compile as the instrumentation is added during compilation. It seems that on godbolt the platform library also isn't instrumented because the equivalent iostream code is msan clean [2]. I suppose that makes sense as it's allowing you to pass arbitrary options to the compiler. In summary, msan can detect these uninitialized reads but it requires quite a lot of fiddling. [1]: https://clang.llvm.org/docs/MemorySanitizer.html#handling-ex...
[2]: https://godbolt.org/z/Gsxsfn9GT |
|
shows nothing on godbolt, but when run on my local machine yields the expected