After checking the GCC compiler with the help of PVS-Studio analyzer, a number of readers have noticed that the quality of the GCC code and its diagnosis aren’t really great, while Clang compiler is up to date, of high quality and fresh. Therefore, PVS-Studio team decided to check the LLVM system to see whether this is the case.

LLVM (Low Level Virtual Machine) - a universal system of analysis, transformation and optimization of program, implementing a virtual machine with RISC-based instructions. Within the scope of LLVM project, the developers made the Clang front-end for C,C++ and Objective-C, translating the source code into bytecode LLVM and allowing to use LLVM as a full-fledged compiler.

The code was checked with a PVS-Studio version, working under Linux. During the check we detected suspicious code fragments, non bit fields, single-time loops, returning references to a local object, operator confusion, typos and other issues; you may read more details about that in this article.

And here I will notice that specialized tools of static analysis, such as PVS-Studio will always outpace the compilers in diagnostic capabilities and configuration flexibility working with false positives.