[PATCH] D19970: [scan-build] fix warnings emitted on LLVM MachineCode code base

Apelete Seketeli via llvm-commits llvm-commits at lists.llvm.org
Thu May 5 08:16:01 PDT 2016


apelete added a comment.

In http://reviews.llvm.org/D19970#422371, @rafael wrote:

> But is the static analyzer correct?
>
> Cheers,
> Rafael


Let's see:

659. MCSection *Sec = getStreamer().getCurrentSection().first;

Here the analyzer seems to be complaining about the fact that the pointer to MCSection type (which is the first element of MCSectionSubPair type that is returned by getStreamer().getCurrentSection().first) might be nullptr.
Digging into the declaration of MCTargetStreamer class which AsmParser class indirectly derives from, it appears that MCSectionSubPair is not initialized by its constructor.

I understand that there is a code path that takes care of such an initialization, but from static analysis point of view that particular code path might not have been taken at this point.


http://reviews.llvm.org/D19970





More information about the llvm-commits mailing list