-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
LLVM bug with StaticArray#sort_by! on aarch64-linux-musl
and aarch64-darwin
#11358
Comments
aarch64-linux-musl
and aarch64-darwin
aarch64-linux-musl
and aarch64-darwin
Did you mean with a debug LLVM? |
No, a compiler build with debug info. Just a local |
If you compile LLVM with debug mode on (assertions on) you'll find out the issue. How would a compiler build with debug info help in this case? LLVM is dying when generating an obj file. |
Without debug info, the stacktrace is just this:
So you wouldn't even know it's caused by LLVM. |
Oh, I missed that it's already using a compiler with debug info on. That said, to understand the problem I suggest using an LLVM debug build. |
This does not reproduce with LLVM 13. So I'd assume it's a legitimate LLVM bug that has been fixed by now. I didn't check with 12 (original compiler was built with patched 11.1 from homebrew locally and 10.0 in CI). Maybe it's even a different face of one of the bugs we've already known about. Anyways, I'm not sure we need to do much about this. Upcoming Crystal releases will presumablty be built with LLVM 13. When we release For the record, somewhen in between I also saw this: |
Since this is now handled by the compiler, I think we can close it. WDYT @straight-shoota ? |
Sorry, what is handled by the compiler? The workaround from #11359 is still in place: crystal/spec/std/static_array_spec.cr Lines 288 to 291 in 9c08cb4
|
This is also reproducible for AArch64 Android, by the way: https://github.com/crystal-lang/crystal/actions/runs/4331137915/jobs/7562790343 |
For the record, everything here is fixed by llvm/llvm-project@e4ecd83. You get the p StaticArray[{1.0, true}] The same code gives p StaticArray[1, 'a'] gives This is such a fundamental issue that I suggested in #14844 (comment) to simply disable targetting AArch64 if Crystal was built with LLVM 12 or below. |
I suppose disabling aarch64 targets with LLVM <= 12 is fine. However, this won't affect existing compiler builds. So I think it's even more important to document this properly. |
Two of our aarch64 CI jobs consistently fail with an invalid memory access while building
std_spec
since #10889.Latest master runs:
musl-test-stdlib
: https://github.com/crystal-lang/crystal/runs/3977186749?check_suite_focus=trueaarch64-darwin
: https://github.com/crystal-lang/crystal/runs/3975877315?check_suite_focus=trueThe invalid memory access comes from LLVM. With a debug compiler we get more info. The backtrace is identical for both targets:
I've been able to reduce the code to this:
The generic argument type must be a reference type. Inlining
sort!
asto_slice.sort!
makes the error go away.The backtrace is a little bit different from the one from
static_array_spec
, though:The text was updated successfully, but these errors were encountered: