facebook / facebook/infer

UNITIALIZED_VALUE possible false positive

Open
#1,298 0 comments 0 reactions 0 assignees View on GitHub
false-positive
Dominant language
OCaml
Stars
15.7k
Forks
2.1k
Avg merge
19h 36m
Merged PRs (30d)
13

Description

Please make sure your issue is not addressed in the [FAQ](https://fbinfer.com/docs/support#troubleshooting).

Please include the following information:
- [x] Infer version v0.17.0
- [x] Operating system CentOS Linux 7 (Core)
- [x] Which command you ran: `infer -- g++ test.cc`
- [x] [The full output in a paste](https://gist.github.com/diego200052/48d5c7c805d20fd2da762b769b87ba00).
- [x] If possible, a minimal example to reproduce your problem (for instance, some code where
infer reports incorrectly, together with the way you run infer to reproduce the incorrect
report).

```cc
#include

using namespace std;

void printNumber() {
int number1 __attribute__((unused)) = 1;
int number2 __attribute__((unused));
cout<<"Number: " << number1;
}

int main() {
cout<<"\nHello World!\n";
printNumber();
return 0;
}
```

It prints (probably wrongly) this error:
```
test.cc:8: error: UNINITIALIZED_VALUE
The value read from number1 was never initialized.
6. int number1 __attribute__((unused)) = 1;
7. int number2 __attribute__((unused));
8. > cout<<"Number: " << number1;
9. }
10.
```

Contributor guide

Open the contributing guide

Research direction

Start by running `infer -- g++ test.cc` with the minimal C++ example from the issue and compare the reported trace with the initialized `number1` declaration. Trace the analysis responsible for the `UNINITIALIZED_VALUE` report, then verify that the command no longer flags this initialized read while preserving relevant uninitialized-value detection.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.