-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Release build emit assertion `(KnownZero & KnownOne) == 0 && "Bits known to be one AND zero?"' #44899
Comments
I just encountered the same bug using the same library, using rustc: Builds fine in debug mode. |
Can repro on Arch with Rust nightlies from rustup, so not a packaging issue. Only one LLVM bug mentions the message: https://bugs.llvm.org/show_bug.cgi?id=24241 |
I don't know if this is entirely relevant and don't know how to debug
I was surprised to see something entirely different than the error I see without the debug flag, the surprising part to me being
|
Here is a minimum code to reproduce. https://github.com/fulmicoton/bug_known_bits/blob/master/src/lib.rs To reproduce you can clone the repo and run |
Here is the last pass that makes LLVM unhappy.
LLVM's value checker is correct to infer that some of the bits in the second branch are supposed to be both 0 and 1... The conclusion is however wrong : the branch is simply unreachable. |
Same error without any panics! nor any enum.
|
This crashes our LLVM with ; Function Attrs: nounwind
declare void @llvm.assume(i1)
; Function Attrs: nounwind uwtable
define i32 @_ZN3ice16bugging_function17hec6c566c29298c46E(i1 zeroext) unnamed_addr #0 {
start:
%. = select i1 %0, i32 -2, i32 -3
%.off.i = add i32 %., -1
%1 = icmp ult i32 %.off.i, 2
%_0.sroa.0.0.i = zext i1 %1 to i64
%_0.sroa.3.0.insert.ext.i = zext i32 %. to i64
%_0.sroa.3.0.insert.shift.i = shl nuw i64 %_0.sroa.3.0.insert.ext.i, 32
%_0.sroa.0.0.insert.insert.i = or i64 %_0.sroa.0.0.i, %_0.sroa.3.0.insert.shift.i
%abi_cast.sroa.4.0.extract.shift = lshr i64 %_0.sroa.0.0.insert.insert.i, 32
%abi_cast.sroa.4.0.extract.trunc = trunc i64 %abi_cast.sroa.4.0.extract.shift to i32
%2 = and i64 %_0.sroa.0.0.insert.insert.i, 4294967295
%cond = icmp eq i64 %2, 1
br i1 %cond, label %bb6, label %bb9
bb6: ; preds = %start
%3 = icmp ne i32 %abi_cast.sroa.4.0.extract.trunc, 0
call void @llvm.assume(i1 %3)
%4 = icmp ult i32 %abi_cast.sroa.4.0.extract.trunc, 3
call void @llvm.assume(i1 %4)
br label %bb9
bb9: ; preds = %start, %bb6
%_0.0 = phi i32 [ %abi_cast.sroa.4.0.extract.trunc, %bb6 ], [ 0, %start ]
ret i32 %_0.0
} |
Minified: ; Function Attrs: nounwind
declare void @llvm.assume(i1)
; Function Attrs: nounwind uwtable
define i64 @icey(i1 zeroext) {
start:
%. = select i1 %0, i64 -1, i64 -2
%_4 = icmp eq i64 %., 0
call void @llvm.assume(i1 %_4)
ret i64 %.
} |
Looks like https://bugs.llvm.org/show_bug.cgi?id=31809 - there's a fix in upstream LLVM, which we can backport. |
I believe this can be closed, as the fix landed upstream and our LLVM has since been updated. Also can't repro with #44899 (comment) anymore. |
I confirm that this seems fixed. |
Thanks @fulmicoton , I am closing this now. |
I'm a user of the rust-zookeeper, and I found it build failed in release mode.
using the command:
cargo build --release --verbose
log:https://gist.github.com/kamyuentse/1bf0c8d65fd40a17060f5cca515e720c
It seems an upstream bug related the LLVM? There is any workaround to fix this bug?
bonifaido/rust-zookeeper#37
Environment:
rustc:
rustc 1.22.0-nightly (0e6f4cf51 2017-09-27)
OS:
CentOS Linux release 7.4.1708
Kernel:
Linux 4.13.3-1.el7.elrepo.x86_64
The text was updated successfully, but these errors were encountered: