Skip to content

Clang static analyzer falsely reports "1 uninitialized field at the end of the constructor call" #54533

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
jimis opened this issue Mar 24, 2022 · 7 comments
Assignees

Comments

@jimis
Copy link

jimis commented Mar 24, 2022

In general we get plenty of false positives, but here the logic looks simple enough for the analyzer to be able to track it. Details follow:

Detected with CodeChecker 6.18.2
Clang version: 13.0.1
Checker name: optin.cplusplus.UninitializedObject
Checker message: 1 uninitialized field at the end of the constructor call

Attaching the issue as a screenshot from CodeChecker as it is easier to follow the logic.
screenshot from CodeChecker

The code is at: https://github.com/qt/qtbase/blob/dfb4697e4a/src/corelib/text/qstring.h#L1602-L1647

@llvmbot
Copy link
Member

llvmbot commented Mar 24, 2022

@llvm/issue-subscribers-clang-static-analyzer

@haoNoQ
Copy link
Collaborator

haoNoQ commented Mar 24, 2022

@Szelethus do you think this is a checker bug or something more fishy is going on, like binding not showing up in RegionStore, or even if it does we're unable to load it?

@Szelethus
Copy link
Contributor

At first glace, I'd say its the latter. The checker only emits reports if it finds an UndefinedVal.

@steakhal
Copy link
Contributor

steakhal commented Nov 2, 2023

Likely fixed by 39743580aff515ba47cb7f9ffb2b5c538cff91da
I can't prove that it's really fixed due to the lacking reproducer, but I'm highly confident that this was also affected by it by looking at the curlyies in the init-list expression.

@jimis
Copy link
Author

jimis commented Nov 2, 2023

Thank you! Which clang version is the fix expected to be in?

@steakhal
Copy link
Contributor

steakhal commented Nov 2, 2023

Thank you! Which clang version is the fix expected to be in?

In clang-18 around February, unless you take this commit and cherry-pick it to a clang-17, release and build it yourself.

Snape3058 added a commit to Snape3058/llvm-patch-revision that referenced this issue Nov 3, 2023
Snape3058 added a commit that referenced this issue Nov 3, 2023
@Snape3058
Copy link
Member

A test case has been added covering this issue in #71073

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants