[PATCH] D58030: [bindings/go] Fix building on 32-bit systems (ARM etc.)

Ayke via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 11 01:57:04 PST 2019


aykevl created this revision.
aykevl added reviewers: whitequark, pcc.
Herald added subscribers: llvm-commits, kristof.beyls, javed.absar.
Herald added a project: LLVM.

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


Repository:
  rL LLVM

https://reviews.llvm.org/D58030

Files:
  bindings/go/llvm/ir.go


Index: bindings/go/llvm/ir.go
===================================================================
--- bindings/go/llvm/ir.go
+++ bindings/go/llvm/ir.go
@@ -1262,7 +1262,7 @@
 	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])


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D58030.186199.patch
Type: text/x-patch
Size: 565 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190211/1d3f4122/attachment.bin>


More information about the llvm-commits mailing list