facebook / facebook/infer

Infer on glog library

Open
#1,908 9 comments 0 reactions 1 assignee Claimed by @davidpichardie View on GitHub
pulse
Dominant language
OCaml
Stars
15.7k
Forks
2.1k
Avg merge
19h 36m
Merged PRs (30d)
13

Description

Hello everybody,

I am playing with Infer (commit May 14th 2025 #5e8c9) running on Ubuntu 20.04 and analyzing a medium/big size cpp project.

I am running the pulse checker, and inspecting all the null pointer violations.

I noticed many false positive caused by the use in my code of the **glog logging** library.

Below I isolated a tiny cpp program triggering a **null reference** false positive alarm when printing with std::cout.

-- Is it possible to instruct the analyzer about the behavior of the glog library?

I tried _pulse-model-return-nonnull-list_ and _pulse-model-abort_ but I suspect the problem is more complex than that.

Please any advice is very appreciated. Thank you.

```
#include
#include
int infer(int c) {
int a = 10;
int* p = nullptr;
if (c > 0) {
p = &a;
}
CHECK(p!=NULL);
std::cout << *p << std::endl;
return 0;
}
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.