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

Ayke via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 14 00:09:31 PST 2019


aykevl marked an inline comment as done.
aykevl added a comment.

Can you (or someone else) merge this change? I do not have commit access. That would allow a request for inclusion in LLVM 8 (I hope).



================
Comment at: bindings/go/llvm/ir.go:1265
 	// 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)
----------------
whitequark wrote:
> Looks like the Go documentation link above recommends using `1 << 28`. Seems like a really awkward pattern, but I'm not a Go expert...
That's a modification done by me, because the original code with `1 << 30` led to this bug. The exact number doesn't really matter, as long as it is "big enough".

Yeah this is rather dirty Go, but it's as elegant as things get in CGo land. There may be better ways, and if someone knows one they should probably change this. For now, this fixes a rather important bug (FTBFS).


Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D58030/new/

https://reviews.llvm.org/D58030





More information about the llvm-commits mailing list