In fact, I'd rather have a flag that clobbers values with random data, to make sure that uses of uninitialized values are caught as soon as possible.
This is absolutely the best option. That said,
> I'd rather have a flag that clobbers values with random data.
That's roughly what happens in practice as is, doesn't it? Barring the first option I'd rather have an option that fails predictably and reproducibly. An arbitrary but deterministic garbage number maybe? Like --set-uninitialized=0xdeadbeef. That might be getting too elaborate, haha.
Initializing values just because seems wasteful. That's why global and static variables are already initialized in this way.
For me it would yet make sense that Gcc allows it even if it's not a very good practice it may have its uses.
Great work btw. I've found a few actual bugs with ASan and MSan already. Not once a false positive.
[edit] ipad auto correct
It also adds a data-dependency (zeroing out a stack buffer depends on the length of the buffer) which is insecure.
That by itself would be enough to make me choose clang over a compiler that didn't have that option. Gcc deliberately doesn't support that, right?