Open bluecorvetteai opened 4 months ago
@llvm/issue-subscribers-clangd
Author: None (bluecorvetteai)
@bluecorvetteai: Does standalone Clang crash?
@EugeneZelenko No, it builds.
Am I reaching too far? Am I just looking for trouble by pulling from
main
or is this valuable feedback for the team?
It's definitely useful to get reports of crashes with trunk.
If you're able to prepare a test case that reproduces the crash, that would be very helpful for further investigation.
I figured an example would be helpful. Kind of under the gun at the moment, but I'll spend some time on it, I would like to help.
The code that prompted this bug report was pretty complicated. However, after commenting it out, I found another that was very simple. A very simple lambda being passed to sort
blew it up. Also the more complicated example, it appears to be either the capture or the parameter list that clangd is choking on.
Coming up with an example doesn't seem as daunting now. Give me a bit to put a project together to see if I can't get some meat to chew on.
@HighCommander4 I keep coming up empty when trying to reproduce this.
It isn't all lambdas that trigger the crash. It can parse a number of them before it finally crashes. The offending lambda appears it has to be part of a very large function with other lambdas before it (this lambda is pretty simple) in order to trigger a crash. I've included statement that is triggering in our regular code below. If I comment out the call to std::sort
with the accompanying lambda, it doesn't crash.
This appears to be the proverbial straw that breaks the camel's back.
If you have any ideas, I'm all ears. Otherwise, I'll keep thinking about this and keep trying.
std::vector<std::pair<int64_t, int64_t>> ids = {{1,2},{3,4},{5,6},{7,8}};
std::vector<std::pair<int64_t, int64_t>> sorted_ids;
sorted_ids.reserve(ids.size());
for( auto& r : ids ){
sorted_ids.emplace_back(r.first, r.second);
}
std::sort(sorted_ids.begin(), sorted_ids.end(),
[](const decltype(sorted_ids)::value_type& a,
const decltype(sorted_ids)::value_type& b) {
return a.second < b.second;
});
The approach I usually take to reduce crashing testcases is to start with the full translation unit, and progressively remove things (statements, declarations, includes) that can be removed while preserving the crashing behaviour.
You might find it convenient to trigger the crash on the command line using clangd --check=filename.cpp
rather than in an editor.
Perfect, I did not know about --check
, that will speed things up, thank you.
I pulled the latest from llvm-project
main
in order to resolve issues fixed in https://github.com/llvm/llvm-project/issues/94614 and https://github.com/llvm/llvm-project/issues/98428.I built clangd, version:
No longer see get a crash in
clang::TemplateArgument::getNonTypeTemplateArgumentType()
, however, I am getting a crash in mangleExpression (or there abouts).Am I reaching too far? Am I just looking for trouble by pulling from
main
or is this valuable feedback for the team?Thanks Kevin