-
Notifications
You must be signed in to change notification settings - Fork 10.9k
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
[clang-tidy] bugprone-unchecked-optional-access
stuck at 100% sometimes
#59492
Comments
I meant issue #55530 |
@llvm/issue-subscribers-clang-tidy |
I can reproduce this in an open source project, and I have it isolated to a handful of lines. For me it seems to hang every time, and only occurs when bugprone-unchecked-optional-access is enabled. |
I am running
|
I can also reproduce the hang on ubuntu kinetic. Again, commenting out the lines indicated above allows clang-tidy to complete in a timely manner.
The clang-tidy version info is
|
This also happens on kinetic with 15.0.6 from this repo |
workaround for llvm/llvm-project#59492 Fixes #4821.
workaround for llvm/llvm-project#59492 Fixes #4821.
Sorry for the "me too," but we just hit this in our project after a PR which added a few more uses of std::optional to a fairly large file. There was also a false positive involving a ternary check, but I suppose it is unrelated to this issue. It would be very nice if this was solved because the check is invaluable to us.
|
Same problem visible on LLVM 17 with Cataclysm-DDA project on files: src/ui_manager.cpp, src/npcmove.cpp, src/monstergenerator.cpp. Currently this check is simply unusable, due to instability, simple bugs, and when checking github for this check looks like 87 projects decided simply to disable it. |
I've been hit by same problem lately. While working on repro, by chance I came up with code which is either processed under 1s, around 1 minute or stuck at least 1h [*] with single line change. Checked on the latest LLVM release 17.0.2, with C++20, I will check on the Probably not relevant, but reproduces on all #include <cstdlib>
#include <optional>
#include <vector>
std::optional<int> create(int);
void foo(std::vector<int> data)
{
std::optional<int> opt;
for(const auto &x: data) {
opt = create(x);
if(!opt.has_value()) {
opt = create(x);
}
// ~60s processing by default
if(rand() == 3) { continue; } // Comment for instant processing
// bool y = *opt > 10; // Uncomment for "infinite" processing
for(const auto &result: std::vector<int> {}) {} // Comment for instant processing
}
}
[*] Timings on i7-770K Intel CPU. I will leave it running overnight. |
Yay, good news, seems it is does no longer reproduce on Upcoming LLVM 18 should have it fixed (?) |
Given @R2RT 's comments and the extensive performance improvements we've made to the framework and the entire rewriting of the core of the optional checker, I'm going to close this. If anyone else on this thread is still seeing reproducable behavior in recent releases, please reopen. |
I can confirm my testcase hangs on Ubuntu noble with clang-tidy 17.0.6, but completes with clang-tidy 18.1.0. However, it seems to flag a false positive:
|
Hi,
This doesn't happen at every run, but very often clang-tidy will get stuck when analyzing my project (not open source so I can't share it here, and didn't manage yet to narrow it down to a small example which reproduces the issue).
This happens more often (but not only) when
bugprone-unchecked-optional-access
is activated.Tried both clang-tidy-15 and latest clang-tidy built from git (commit bbcffb0) and had the issue.
Stack trace:
Unfortunately, I don't have debug symbols as I didn't managed to build with debug symbols (build error because of relocation: I suspect with debug symbols object are too big for my system).
This issue looks similar to #55530.
The text was updated successfully, but these errors were encountered: