I’ve been chasing some bugs in templight (template instantiation profiler) by generating traces for some template-heavy code, and in the process, I’ve been printing out some debug information including the total number of template instantiations that clang does when compiling the source code. From multiple runs in succession (with same clang binary and same source file), there is always a small fluctuation in the number of instantiations done, by roughly 1% - 2% (for example, one of my source files yields total instantiation counts that fluctuate between 203,000 and 208,000).
So, Clang is non-deterministic (at least, at semantic analysis). I’m just curious as to why that is? Is it some special technique being used? Or is it the consequence of some UB bugs?