We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 85de4ef commit fb9060aCopy full SHA for fb9060a
src/librustc_codegen_llvm/mir/constant.rs
@@ -70,8 +70,11 @@ pub fn scalar_to_llvm(cx: &CodegenCx,
70
&C_usize(cx, ptr.offset.bytes()),
71
1,
72
) };
73
- let llval = unsafe { llvm::LLVMConstPtrToInt(llval, llty.to_ref()) };
74
- consts::bitcast(llval, llty)
+ if layout.value != layout::Pointer {
+ unsafe { llvm::LLVMConstPtrToInt(llval, llty.to_ref()) }
75
+ } else {
76
+ consts::bitcast(llval, llty)
77
+ }
78
}
79
80
0 commit comments