open-source-parsers / open-source-parsers/jsoncpp
GCC 12.2.0 build warning for uninitialized variable
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 8.9k
- Forks
- 2.7k
- Avg merge
- 31m
- Merged PRs (30d)
- 1
Description
Describe the bug
The GCC 12.2.0 compiler warns that a variable may be uninitialized when building JSONCPP, specifically here (v):
case tokenNull:
{
Value v;
currentValue().swapPayload(v);
currentValue().setOffsetStart(token.start_ - begin_);
currentValue().setOffsetLimit(token.end_ - begin_);
}
break;
in jsoncpp.cpp
To Reproduce
Just building jsoncpp.cpp in a project.
Expected behavior
No warning.
I even expect that :
Value v();
We resolve the issue.
Desktop (please complete the following information):
- vanilla Arch Linux, GCC 12.2.0
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the tokenNull case and the Value v declaration in jsoncpp.cpp. Reproduce the build with GCC 12.2.0 on the reported Arch Linux setup, then verify the warning is eliminated without changing the intended behavior. Done means jsoncpp.cpp builds without the uninitialized-variable warning.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100