| author | |
| committer | |
| log | 9d66481e3df35b54275373a685e765a4bcebd712 |
| tree | 7265504b2f0cddd12ea07eb68d5b6e8c3d12778a |
| parent | 8dcb4a3dc44fcc90b43543b9a0603456eeb4c348 |
The signature is `getOrCreateSubrange(int64_t Lo, int64_t Count)`, so this updates the bindings to match.
This fixes a crash in `lowerDebugTypeImpl` when analyzing slices that have a length of 2^32 or
larger (up to `2^64 >> 3`, which still crashes, because above that the array size in bits overflows u64).5 files changed, 13 insertions(+), 4 deletions(-)
src/codegen/llvm.zig+1-1| ... | ... | @@ -1719,7 +1719,7 @@ pub const Object = struct { |
| 1719 | 1719 | ty.abiSize(mod) * 8, |
| 1720 | 1720 | ty.abiAlignment(mod) * 8, |
| 1721 | 1721 | try o.lowerDebugType(ty.childType(mod), .full), |
| 1722 | @intCast(c_int, ty.arrayLen(mod)), | |
| 1722 | @intCast(i64, ty.arrayLen(mod)), | |
| 1723 | 1723 | ); |
| 1724 | 1724 | // The recursive call to `lowerDebugType` means we can't use `gop` anymore. |
| 1725 | 1725 | try o.di_type_map.put(gpa, ty.toIntern(), AnnotatedDITypePtr.initFull(array_di_ty)); |
src/codegen/llvm/bindings.zig+1-1| ... | ... | @@ -1681,7 +1681,7 @@ pub const DIBuilder = opaque { |
| 1681 | 1681 | size_in_bits: u64, |
| 1682 | 1682 | align_in_bits: u64, |
| 1683 | 1683 | elem_type: *DIType, |
| 1684 | elem_count: c_int, | |
| 1684 | elem_count: i64, | |
| 1685 | 1685 | ) *DIType; |
| 1686 | 1686 | |
| 1687 | 1687 | pub const createEnumerator = ZigLLVMCreateDebugEnumerator; |
src/zig_llvm.cpp+1-1| ... | ... | @@ -601,7 +601,7 @@ struct ZigLLVMDIType *ZigLLVMDIBuilderCreateVectorType(struct ZigLLVMDIBuilder * |
| 601 | 601 | } |
| 602 | 602 | |
| 603 | 603 | ZigLLVMDIType *ZigLLVMCreateDebugArrayType(ZigLLVMDIBuilder *dibuilder, uint64_t size_in_bits, |
| 604 | uint64_t align_in_bits, ZigLLVMDIType *elem_type, int elem_count) | |
| 604 | uint64_t align_in_bits, ZigLLVMDIType *elem_type, int64_t elem_count) | |
| 605 | 605 | { |
| 606 | 606 | SmallVector<Metadata *, 1> subrange; |
| 607 | 607 | subrange.push_back(reinterpret_cast<DIBuilder*>(dibuilder)->getOrCreateSubrange(0, elem_count)); |
src/zig_llvm.h+1-1| ... | ... | @@ -179,7 +179,7 @@ ZIG_EXTERN_C struct ZigLLVMDIType *ZigLLVMCreateDebugBasicType(struct ZigLLVMDIB |
| 179 | 179 | |
| 180 | 180 | ZIG_EXTERN_C struct ZigLLVMDIType *ZigLLVMCreateDebugArrayType(struct ZigLLVMDIBuilder *dibuilder, |
| 181 | 181 | uint64_t size_in_bits, uint64_t align_in_bits, struct ZigLLVMDIType *elem_type, |
| 182 | int elem_count); | |
| 182 | int64_t elem_count); | |
| 183 | 183 | |
| 184 | 184 | ZIG_EXTERN_C struct ZigLLVMDIEnumerator *ZigLLVMCreateDebugEnumerator(struct ZigLLVMDIBuilder *dibuilder, |
| 185 | 185 | const char *name, uint64_t val, bool isUnsigned); |
test/cases/llvm/large_slices.zig created+9| ... | ... | @@ -0,0 +1,9 @@ |
| 1 | pub fn main() void { | |
| 2 | const large_slice = @ptrFromInt([*]const u8, 1)[0..(0xffffffffffffffff >> 3)]; | |
| 3 | _ = large_slice; | |
| 4 | } | |
| 5 | ||
| 6 | // compile | |
| 7 | // backend=llvm | |
| 8 | // target=x86_64-linux,x86_64-macos | |
| 9 | // |