llvm 15

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.

  1. void FunctionLoweringInfo::ComputePHILiveOutRegInfo(const PHINode *PN) {
  2. ....
  3. Register DestReg = It->second;
  4. if (DestReg == 0)
  5. return
  6. assert(Register::isVirtualRegister(DestReg) &&
  7. "Expected a virtual reg");
  8. LiveOutRegInfo.grow(DestReg);
  9. ....
  10. }