]> Cypherpunks.ru repositories - gostls13.git/blob - misc/cgo/testsanitizers/testdata/asan_global1_fail.go
6cfc0b713812ff3a6ca1a8ba860800cb79fd73cf
[gostls13.git] / misc / cgo / testsanitizers / testdata / asan_global1_fail.go
1 // Copyright 2022 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
4
5 package main
6
7 /*
8 #include <stdlib.h>
9 #include <stdio.h>
10
11 int test(int *a) {
12         a[2] = 300;  // BOOM
13         return a[2];
14 }
15 */
16 import "C"
17
18 import "fmt"
19
20 var cIntArray [2]C.int
21
22 func main() {
23         r := C.test(&cIntArray[0])
24         fmt.Println("r value = ", r)
25 }