Consider the following C code. When it is compiled using clang with ‘ –O’, the assert fires. Gcc seems to do the opposite.
unsigned a; // uninitialized!
unsigned b = a;
assert(b == a); // shouldn’t this be always true?
Would you consider this a LLVM bug? I think GVN is responsible for this. I don’t know if it falls within the realm of “undefined” or “implementation specific” behavior but there are probably examples of code where one can “correctly” skip initialization. The Briggs-Torczon sparse set data structure comes to mind (where you are not comparing two uninitialized variables but an uninitialized variable with an initialized variable—LLVM seems to do the right thing in that case, though).