mirror of
https://github.com/ziglang/zig.git
synced 2026-02-21 16:54:52 +00:00
LLVM backend: call constPtrToInt instead of constBitCast
when appropriate. Avoids tripping an LLVM assertion.
This commit is contained in:
parent
335c680cde
commit
d72f832b1e
@ -1858,7 +1858,11 @@ pub const DeclGen = struct {
|
||||
try self.resolveGlobalDecl(decl);
|
||||
|
||||
const llvm_type = try self.llvmType(tv.ty);
|
||||
return llvm_val.constBitCast(llvm_type);
|
||||
if (tv.ty.zigTypeTag() == .Int) {
|
||||
return llvm_val.constPtrToInt(llvm_type);
|
||||
} else {
|
||||
return llvm_val.constBitCast(llvm_type);
|
||||
}
|
||||
}
|
||||
|
||||
fn lowerPtrToVoid(dg: *DeclGen, ptr_ty: Type) !*const llvm.Value {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user