-
Notifications
You must be signed in to change notification settings - Fork 262
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
[Bug]: Clang Optimizer SEGFAULT while attempting to compile under certain conditions #1677
Comments
The attached preprocessed TestFmt-aa59b0.cpp file appears truncated (last line is |
Apologies, I should've double checked the provided information. Thank you for looking into it, here's the updated information: Hopefully this is sufficient for diagnosing though if more information is required I'll be happy to provide. |
Those work! Thank you for getting back to me quickly. It seems to happen even with our latest toolchains, so I'm going to have to resolve this with upstream LLVM first. |
To give a sense of what that means for a timeline to a fix: that makes it very unlikely that it'll be in r23c (which I'm hoping to ship soon, but I've been saying that for quite a while and haven't had the time). If upstream fixes this soon we can probably get it into r25 though (and if not, hopefully one of the r25 minor releases). It won't be in r24 since that's already done and just waiting for the release process to finish, and unless upstream moves very fast this probably won't make it into an r24 minor release before r25 replaces it. |
Alright thanks for looking into it! Very amazed to see the fast and helpful response. I'll be looking forward to r25 or the release that ends up incorporating the fix. Good luck! |
Reduced test cpp file (using cvise): struct basic_string_view {
char data_;
long size_;
constexpr basic_string_view(const char *) : data_(), size_() {}
};
struct basic_format_string {
basic_string_view str_;
template <typename S> consteval basic_format_string(S s) : str_(s) {}
};
struct source_location {};
using sl = source_location;
struct BasicFmtStrSrcLoc : basic_format_string {
using ParentType = basic_format_string;
sl sourceLocation;
template <typename S> consteval BasicFmtStrSrcLoc(S s) : ParentType(s) {}
};
template <typename...> using FmtStrSrcLoc = BasicFmtStrSrcLoc;
enum LogLevel { INF };
struct Logger {
template <LogLevel> static void fmtLogTest4(FmtStrSrcLoc<>);
};
void t() { Logger::fmtLogTest4<INF>(""); } Somewhat reduced command line (but I am sure I can do better here too):
Let me poke around a bit more, because this likely needs to be an LLVM IR reproducer (crash is during code generation), but this at least is a good point to have reached so far. |
The bug reproduces with clang-13 but clang-14 had the fix. Using the same test case that @stephenhines mentioned. $clang-13.0.1 -std=c++20 -Os -fstack-protector-strong -target aarch64-none-linux-android24 -ffunction-sections -fdata-sections -fcxx-exceptions -fexceptions -fvectorize
clang-14 works fine. |
Great, thanks for confirming. With that I think all the LLVM issues triaged to r26 (aside from the lldb thing, which is another matter entirely) are fixed in the next toolchain and we're just waiting for prebuilts 👍 |
Description
Under the circumstances explained in this test file, clang's optimizer segfaults. I can't tell with certainty what causes this SEGFAULT but hopefully this small test case is sufficient. If
-O0
is provided as a compile flag, the SEGFAULT no longer occurs.As the crash suggests, here are the diagnostic files: https://gist.github.com/Fernthedev/8e10c49fcf775b4a34bb51ed3e586eda
Building the project to reproduce the crash
The branch
test-case
of the repository is designed to work out of the box with no configuration outside of Ninja, CMake and NDK.ndkpath.txt
file pointing to your ndk installationpwsh .\build.ps1
or manually invoke CMake if you preferAppreciate any guidance and fixes, good day.
Upstream bug
No response
Commit to cherry-pick
No response
Affected versions
r23, r24
Canary version
No response
Host OS
Windows
Host OS version
Windows 10 21H2 (19044.1526)
Affected ABIs
arm64-v8a
The text was updated successfully, but these errors were encountered: