Examples of errors that PVS-Studio found in LLVM 15.0
Compilers are evolving: they issue more and more warnings. Do developers still need to use static code analyzers like PVS-Studio? Yes, because analyzers are evolving too. In this article you’ll see how PVS-Studio can find bugs even in a compiler.
Examples of errors that PVS-Studio found in LLVM 15.0
by Andrey Karpov
From the article:
It’s a cool bug, although it’s not scary. There is no semicolon after the return statement. As a result, the code does not work as it looks.
- void FunctionLoweringInfo::ComputePHILiveOutRegInfo(const PHINode *PN) {
- ....
- Register DestReg = It->second;
- if (DestReg == 0)
- return
- assert(Register::isVirtualRegister(DestReg) &&
- "Expected a virtual reg");
- LiveOutRegInfo.grow(DestReg);
- ....
- }