summaryrefslogtreecommitdiff
path: root/libgo/misc/cgo/test/gcc68255
diff options
context:
space:
mode:
Diffstat (limited to 'libgo/misc/cgo/test/gcc68255')
-rw-r--r--libgo/misc/cgo/test/gcc68255/a.go17
-rw-r--r--libgo/misc/cgo/test/gcc68255/c.c8
-rw-r--r--libgo/misc/cgo/test/gcc68255/c.h5
3 files changed, 30 insertions, 0 deletions
diff --git a/libgo/misc/cgo/test/gcc68255/a.go b/libgo/misc/cgo/test/gcc68255/a.go
new file mode 100644
index 00000000000..e106dee3ec0
--- /dev/null
+++ b/libgo/misc/cgo/test/gcc68255/a.go
@@ -0,0 +1,17 @@
+// Copyright 2015 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 it's OK to have C code that does nothing other than
+// initialize a global variable. This used to fail with gccgo.
+
+package gcc68255
+
+/*
+#include "c.h"
+*/
+import "C"
+
+func F() bool {
+ return C.v != nil
+}
diff --git a/libgo/misc/cgo/test/gcc68255/c.c b/libgo/misc/cgo/test/gcc68255/c.c
new file mode 100644
index 00000000000..a4fe193825b
--- /dev/null
+++ b/libgo/misc/cgo/test/gcc68255/c.c
@@ -0,0 +1,8 @@
+// Copyright 2015 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.
+
+static void f(void) {
+}
+
+void (*v)(void) = f;
diff --git a/libgo/misc/cgo/test/gcc68255/c.h b/libgo/misc/cgo/test/gcc68255/c.h
new file mode 100644
index 00000000000..05ecd8187c7
--- /dev/null
+++ b/libgo/misc/cgo/test/gcc68255/c.h
@@ -0,0 +1,5 @@
+// Copyright 2015 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.
+
+extern void (*v)(void);