Open llvmbot opened 5 years ago
I haven't looked into the crash in any great detail, just picking on the target feature string.
There is a combination of armv4-t with a -target-feature +vfp3 and -target-feature +neon. This is not a legal ARM Architecture. The target-feature +neon requires armv7-a or armv7-r. I don't believe vfp3 is not supported on armv4-t either but I don't think that is the problem as we have -mfloat-abi=soft.
If I remove the +neon this will compile correctly, as is also the case if we raise the target architecture to armv7a v9a --triple thumbv7a-linux-android (remember to remove or alter --target-cpu to a v7a cpu like cortex-a9. There is still a problem here as we shouldn't get as far as an assertion, but I'd be willing to bet that this something to do with something not supported on v4t being introduced by neon.
As far as I know the earliest Android supported architecture is armv6 for the arm1176. This does not support neon either. I think the latest versions of Android require armv7-a and neon.
A reduction:
$ cat ctypes.cpp char a, c; int b; unsigned int d; int e() { int f; c = a + b; for (; a != c; a++) { d = *a; f++; } return f; }
$ clang -cc1 -triple thumbv4t--linux-android -emit-obj -target-cpu arm7tdmi -target-feature +soft-float-abi -target-feature -fp-only-sp -target-feature -d16 -target-feature +vfp3 -target-feature -fp16 -target-feature -vfp4 -target-feature -fp-armv8 -target-feature +neon -target-feature -crypto -target-feature +strict-align -target-abi aapcs-linux -mfloat-abi soft -O3 -std=gnu++14 -vectorize-loops -vectorize-slp -x c++ -w ctypes.cpp ... clang: /usr/local/google/home/rnk/llvm-project/llvm/include/llvm/CodeGen/TargetLowering.h:627: virtual const llvm::TargetRegisterClass *llvm::TargetLoweringBase::getRegClassFor(llvm::MVT) const: Assertion `RC && "This value type is not natively supported!"' failed. ...
Stack says it's crashing in ARM ISel:
I repro'd and started a reduction.
It would be helpful if you could attach the bitcode file generated by passing '-emit-llvm' to Clang.
I use the command in below URL to generate bitcode.
https://pastebin.com/Qbj93zkS
The bitcode is located in https://drive.google.com/file/d/1OOCxpTcmY_AVIhp8uvkxzaG8iUbMIxJP/view?usp=sharing
Preprocessed source(s) and associated run script(s) are located at: https://drive.google.com/file/d/195yKyGQ6jxJpid2H9Uknd2vwizDWDe71/view?usp=sharing
Looks like the segfault is in the backend (Machine Loop Invariant Code Motion) building for thumbv4t--linux-android. It would be helpful if you could attach the bitcode file generated by passing '-emit-llvm' to Clang.
Also, it looks like you are using clang 6, which is about a year old. Any chance you could try with a more recent build/release? If you could use a build with assertions enabled, that would be helpful too, as the issue might appear earlier.
Extended Description
When I compiler firefox gecko48 with clang, I encounter the clang crash when compiling gecko/js/src/ctypes/CTypes.cpp.
Looks like clang is crashed while compiling this function.
js::ctypes::GetDeflatedUTF8StringLength()
Not quite sure how to debug further or how to find exactly line of code leads to clang crash.