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
Bit operations causes compiler to hang #1932
Comments
Nice find. I'm actually able to reproduce this using clang-7 and clang-8 and the LLVM IR file that Zig produces from this source. So it's pretty clearly an LLVM bug. I'm making a bug report now. |
Upstream bug report: https://bugs.llvm.org/show_bug.cgi?id=40676 |
It's unlikely this will be fixed in the upcoming llvm 8.0.0 release, since it's already at Release Candidate 2. However I will make it a goal to submit an upstream bug fix before they make the llvm 9 branch. |
I don't know if this is useful or not, but the example file you posted doesn't hang for me on macOS:
|
This is fixed in llvm trunk but not llvm 8.0.rc2. I don't plan to do the bisect necessary to find which commit fixed it, so unless someone else wants to do that before 8 is released, this will remain an open issue until LLVM 9, which corresponds to Zig 0.5.0. |
The following example hangs the compiler when compiling with
zig build-exe test.zig
:If you change
p
toconst p = (x >> 1) & 1
(i.e remove the explicit cast tou48
) it compiles immediately. If you change the cast tou32
oru64
it compiles. All numbers I tried between 32 and 64 also caused the hang. It seems very specific to these operators: I've tried replacing<<
and&
with various combinations but only this one causes the error. If you inline the function call, it also compiles.Versions:
macOS Mojave 10.14.3
The text was updated successfully, but these errors were encountered: