-
Notifications
You must be signed in to change notification settings - Fork 272
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 crash for arm64 target #386
Comments
also repros with the newer clang in r15beta2: clang++: error: unable to execute command: Segmentation fault (core dumped) for, -O1 is broken as well as -O0. -O2/-O3 work. |
I only had a non-debug clang handy (but am building a debug version right now). Here is the quick backtrace for the crash with our latest toolchain:
|
The issue is a type with apparently "zero" size. I'm still digging, but everything is suspect at this point. The AArch64 argument lowering code doesn't handle a zero-sized type properly. It rounds to an 8-byte boundary, but unfortunately, 0 is 8-byte aligned. The function that is breaking is "make_transition_table". (gdb) call Ty.dump() |
Digging a bit deeper here, the size of the record is noted as zero, yet isEmptyRecord() is returning false. In the case of -O2/-O3, the assertion still fires in my build, so the build just gets lucky when it is in a higher optimization mode. I will look more closely at whether isEmptyRecord() is wrong for this kind of type. I will also continue to reduce the testcase, in case I need to get help from others upstream. |
https://bugs.llvm.org//show_bug.cgi?id=33191 is the bug I just filed upstream. I have some ideas how to fix this for AArch64, but want to confirm that there isn't something more terrible to be fixed here for all targets. I should note that I managed to get the test case down to:
Thanks for this very interesting bug. Sorry it has taken me a while to work through some of the crazier stuff here. Hopefully this will be fixed soon and available in the next NDK. |
@stephenhines thanks for looking into this. |
I think that if you were going to see problems as a result of this code, they would show at compile-time, since there is an assertion that fires (in our assertion build), or you should end up with a segfault in other cases, since Clang won't be able to pick a proper size register to hold these data types. Since these zero-byte types aren't escaping as public APIs, the optimizer mostly inlines/removes them as parameters and/or return types. If you do have one of these types remain in a public API, there might be a small chance for a runtime bug, but it seems pretty low (and I doubt that you are exporting APIs that look like the code you originally sent). |
yeah, all those |
@stephenhines: is r16 a reasonable goal for this? |
This was already fixed in upstream LLVM with r302313. It should definitely be in r16, but we don't want to delay things further for r15, so it won't make it there. |
Unfortunately Android hasn't finished with the Clang update yet, and this has been holding r16 up long enough. This is going to have to wait for r17. |
In that case, is there a way to pick that patch up and get my AOSP compiled. clang++.real: error: unable to execute command: Segmentation fault (core dumped) |
The r302313 Clang fix is in r17-beta1. (https://android.googlesource.com/toolchain/clang/+/dc4dea9dda74c9110ccd761847520a075a68b20e), and the test case doesn't segfault anymore. (I was able to reproduce the segfault in r15c and r16b.) |
Description
Clang crashes when using examples for boost-msm library. Happens only for arm64 targets and only in no-optimization mode (e.g. -O0).
Environment Details
Command line that triggers the issue:
Gist for the preprocessed source and run script: https://gist.github.com/ukreator/5849dd9e0c0600eea5e0ef082bc792e4
Host OS: Linux
NDK version: r15 beta1
Build system: any (used direct clang call for this particular reproducing case)
LLVM site says that no new accounts can be created for bug reporting, so I'm reporting here.
The text was updated successfully, but these errors were encountered: