]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: fix build, divide by constant 0 is a compile-time error
authorKeith Randall <khr@golang.org>
Wed, 25 Feb 2015 21:38:42 +0000 (13:38 -0800)
committerKeith Randall <khr@golang.org>
Wed, 25 Feb 2015 21:39:54 +0000 (21:39 +0000)
Change-Id: Iee319c9f5375c172fb599da77234c10ccb0fd314
Reviewed-on: https://go-review.googlesource.com/6020
Reviewed-by: Keith Randall <khr@golang.org>
src/runtime/mem_linux.go

index 74de11caea29d247fcfa5c220a2d7ace65483717..a78a03ee5c1ad08ce9c623a89d022e5c6d3ccc4b 100644 (file)
@@ -67,7 +67,8 @@ func sysAlloc(n uintptr, stat *uint64) unsafe.Pointer {
 }
 
 func sysUnused(v unsafe.Pointer, n uintptr) {
-       if hugePageSize != 0 && (uintptr(v)%hugePageSize != 0 || n%hugePageSize != 0) {
+       var s uintptr = hugePageSize // division by constant 0 is a compile-time error :(
+       if s != 0 && (uintptr(v)%s != 0 || n%s != 0) {
                // See issue 8832
                // Linux kernel bug: https://bugzilla.kernel.org/show_bug.cgi?id=93111
                // Mark the region as NOHUGEPAGE so the kernel's khugepaged