// Code generated by cmd/cgo; DO NOT EDIT.

//line /home/evie/packages/go/go-1.18-0/go/misc/cgo/errors/testdata/malloc.go:1:1
// 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 _ "unsafe"

import (
	"fmt"
	"runtime"
)

func main() {
	var size  /*line :18:11*/_Ctype_size_t /*line :18:19*/
	size--

	// The Dragonfly libc succeeds when asked to allocate
	// 0xffffffffffffffff bytes, so pass a different value that
	// causes it to fail.
	if runtime.GOOS == "dragonfly" {
		size =  /*line :25:10*/_Ctype_size_t /*line :25:18*/(0x7fffffff << (32 * (^uintptr(0) >> 63)))
	}

	p := ( /*line :28:7*/_Cfunc__CMalloc /*line :28:14*/)(size)
	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.
	}
}
