mirror of
https://github.com/golang/go.git
synced 2025-05-07 00:23:03 +00:00
Change-Id: If7740ac7b6c4190db5a1ab4100d12cf16dc79c84 Reviewed-on: https://go-review.googlesource.com/31768 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Russ Cox <rsc@golang.org>
24 lines
507 B
Go
24 lines
507 B
Go
// Copyright 2016 The Go Authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style
|
|
// license that can be found in the LICENSE file.
|
|
|
|
// Test that C.malloc does not return nil.
|
|
|
|
package main
|
|
|
|
// #include <stdlib.h>
|
|
import "C"
|
|
|
|
import (
|
|
"fmt"
|
|
)
|
|
|
|
func main() {
|
|
p := C.malloc(C.size_t(^uintptr(0)))
|
|
if p == nil {
|
|
fmt.Println("malloc: C.malloc returned nil")
|
|
// Just exit normally--the test script expects this
|
|
// program to crash, so exiting normally indicates failure.
|
|
}
|
|
}
|