]> granicus.if.org Git - llvm/commitdiff
[bindings/go] Fix building on 32-bit systems (ARM etc.)
authorwhitequark <whitequark@whitequark.org>
Sat, 16 Feb 2019 22:33:10 +0000 (22:33 +0000)
committerwhitequark <whitequark@whitequark.org>
Sat, 16 Feb 2019 22:33:10 +0000 (22:33 +0000)
Summary:
The patch in https://reviews.llvm.org/D53883 (by me) fails to build on 32-bit systems like ARM. Fix the array size to be less ridiculously large. 2<<20 should still be enough for all practical purposes.

Bug: https://bugs.llvm.org/show_bug.cgi?id=40426

Reviewers: whitequark, pcc

Reviewed By: whitequark

Subscribers: javed.absar, kristof.beyls, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D58030

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@354207 91177308-0d34-0410-b5e6-96231b3b80d8

bindings/go/llvm/ir.go

index c07a1b4ee5c112d128b64bc1af9b406a2d1c257c..4682cf35ddbfc9446b62268fec144742d81ce2db 100644 (file)
@@ -1262,7 +1262,7 @@ func (v Value) Indices() []uint32 {
        num := C.LLVMGetNumIndices(v.C)
        indicesPtr := C.LLVMGetIndices(v.C)
        // https://github.com/golang/go/wiki/cgo#turning-c-arrays-into-go-slices
-       rawIndices := (*[1 << 30]C.uint)(unsafe.Pointer(indicesPtr))[:num:num]
+       rawIndices := (*[1 << 20]C.uint)(unsafe.Pointer(indicesPtr))[:num:num]
        indices := make([]uint32, num)
        for i := range indices {
                indices[i] = uint32(rawIndices[i])