-
Notifications
You must be signed in to change notification settings - Fork 257
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 crash (segmentation fault) with neon intrinsics #1303
Comments
Do you know if this crashed on r20? |
(I'll check if you don't know, but lmk if you do) |
It seem to compile successfully on r20 (tested with 20.0.5594570). |
Thanks, triaging for r21d then. |
This is a crash on invalid code actually. If I run with a more recent clang, I get the following diagnostic:
We can backport the fix for this, but the actual code as written uses an invalid index. I'll continue to track that down, but I wanted to post this in case you feel blocked on writing your own code with the current NDK. |
Oh thanks, thats really nice to know. |
Reduced and filed https://bugs.llvm.org/show_bug.cgi?id=46615 upstream with the ARM maintainers. |
This needs more than a prebuilt update, @DanAlbert . I do need to cherry-pick this for r21e if we're going to take it there. This is only in our toolchain-testing branch (and r22) right now. |
Actually, it's in r22. It's only missing from r21e. |
https://android-review.googlesource.com/q/topic:%22fix_1303%22+(status:open%20OR%20status:merged) cherry-picks the fix. We then need to check-in prebuilts so that you can get them for the LTS NDK. |
For posterity, this bug was fixed in r22's r399163b clang, in https://android-review.googlesource.com/c/toolchain/llvm_android/+/1440863. |
Was a dup of #1248. |
5f1cad4d29 [ARM] Skip combining base updates for vld1x NEON intrinsics Bug: http://b/155835175 Bug: android/ndk#1248 Bug: android/ndk#1303 Test: ./build.py Change-Id: Id1e025241c062e8db2ea179ae141ae1ba572e85c
Description
I encountered a bug in the optimizer of clang++ which leads to a segmentation fault when working with neon intrinsic. This only happens when I run a release build in android studio. I played a bit with the clang++ command and found out that this happens due to the optimization level (-Oz) of the release build.
I provided a small test case that shows the issue:
https://github.com/SimonSuckut/ndk_clang-_bug
with build_debug.sh (contains the clang++ command of the debug build) the compilation works perfectly fine, with build.sh (contains the clang++ command of the release build) the compile process ends with an segmentation fault:
1. <eof> parser at end of file 2. Code generation 3. Running pass 'Function Pass Manager' on module '/home/simon/AndroidStudioProjects/llvm_bug/llvm_bug.cpp'. 4. Running pass 'ARM Instruction Selection' on function '@_GLOBAL__sub_I_llvm_bug.cpp' #0 0x0000000002e6e2b5 llvm::sys::PrintStackTrace(llvm::raw_ostream&) (/home/simon/Dokumente/Android/Sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin/clang+++0x2e6e2b5) #1 0x0000000002e6e63e llvm::sys::RunSignalHandlers() (/home/simon/Dokumente/Android/Sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin/clang+++0x2e6e63e) #2 0x0000000002e6e4e8 (/home/simon/Dokumente/Android/Sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin/clang+++0x2e6e4e8) #3 0x00007f5b9b5453c0 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x153c0) #4 0x000000000266a480 llvm::TargetLowering::DAGCombinerInfo::CombineTo(llvm::SDNode*, llvm::ArrayRef<llvm::SDValue>, bool) (/home/simon/Dokumente/Android/Sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin/clang+++0x266a480) #5 0x0000000004bc6968 clang++: error: unable to execute command: Segmentation fault (core dumped) clang++: error: clang frontend command failed due to signal (use -v to see invocation) Android (5900059 based on r365631c) clang version 9.0.8 (https://android.googlesource.com/toolchain/llvm-project 207d7abc1a2abf3ef8d4301736d6a7ebc224a290) (based on LLVM 9.0.8svn) Target: armv7-none-linux-android19 Thread model: posix
Environment Details
The text was updated successfully, but these errors were encountered: