Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign up[Nightly] LLVM Assertion: SrcTy must be larger than DestTy for Trunc #41744
Comments
This comment has been minimized.
This comment has been minimized.
|
The error comes from the |
This comment has been minimized.
This comment has been minimized.
|
That was fast. Just to add a bit of context:
The difference between pub trait ToColumnData {
fn to_column_data(&self) -> ColumnData;
}
pub trait ToSql : ToColumnData {
fn to_sql(&self) -> &'static str;
}
Interestingly enough it's not enough for reproduction to just define (And FromColumnData is used for the .get assert) Therefore I'm not quite sure about what's actually causing this. |
This comment has been minimized.
This comment has been minimized.
|
Reduced test case: trait Tc {}
impl Tc for bool {}
fn main() {
let _: &[&Tc] = &[&true];
}( |
This comment has been minimized.
This comment has been minimized.
LLDB Stack trace
Triggered from this line: if projected_ty.is_bool() {
unsafe {
val = llvm::LLVMConstTrunc(val, Type::i1(self.ccx).to_ref());
}
}Constant *ConstantExpr::getTrunc(Constant *C, Type *Ty, bool OnlyIfReduced) {
...
assert(C->getType()->getScalarSizeInBits() > Ty->getScalarSizeInBits()&&
"SrcTy must be larger than DestTy for Trunc!"); |
This comment has been minimized.
This comment has been minimized.
|
|
TimNN
added
A-LLVM
I-crash
labels
May 4, 2017
This comment has been minimized.
This comment has been minimized.
|
Still fails on master for me, did you build with LLVM Assertions, @kennytm? |
TimNN
added
regression-from-stable-to-nightly
T-compiler
labels
May 4, 2017
This comment has been minimized.
This comment has been minimized.
|
@TimNN Ah |
brson
added
the
P-high
label
May 4, 2017
brson
assigned
TimNN
May 4, 2017
This comment has been minimized.
This comment has been minimized.
|
Introduced in the rollup #41717 which leads me to highly suspect #41625 (cc @nikomatsakis). |
This comment has been minimized.
This comment has been minimized.
|
The problem appears to be that in https://github.com/rust-lang/rust/blob/master/src/librustc_trans/mir/constant.rs#L419 I don't know enough about that part of the compiler / LLVM to decide what the fix here should be. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
Here is the diff of |
This comment has been minimized.
This comment has been minimized.
|
Ah, so with |
This comment has been minimized.
This comment has been minimized.
|
With |
This comment has been minimized.
This comment has been minimized.
arielb1
assigned
eddyb
and unassigned
TimNN
May 11, 2017
This comment has been minimized.
This comment has been minimized.
|
Seems like the right fix is just to skip the call to truncate if the thing is already boolean. @eddyb will take it. |
steffengy commentedMay 4, 2017
•
edited
Last good version:
rustc 1.19.0-nightly (6a5fc9eec 2017-05-02)(previous nightly)Version:
rustc 1.19.0-nightly (2d4ed8e0c 2017-05-03)Unfortunately I can't provide a small testcase for reproduction,
but the following works reliably:
Reproduction
EDIT: For readability the reduced example from below:
OLD:
Output: