summaryrefslogtreecommitdiffstats
path: root/llgo/test/execution/unsafe/offsetof.go
diff options
context:
space:
mode:
authorPeter Collingbourne <peter@pcc.me.uk>2014-11-27 00:06:42 +0000
committerPeter Collingbourne <peter@pcc.me.uk>2014-11-27 00:06:42 +0000
commitad9841e8ac74bfcb1814b728a143408e87dd00a7 (patch)
treea36b962fece0b5b9676f26c1af90b43388069284 /llgo/test/execution/unsafe/offsetof.go
parent5468e86469f716eb40b1b39dfd9fd92e4f35df9e (diff)
downloadbcm5719-llvm-ad9841e8ac74bfcb1814b728a143408e87dd00a7.tar.gz
bcm5719-llvm-ad9841e8ac74bfcb1814b728a143408e87dd00a7.zip
Initial commit of llgo.
llvm-svn: 222857
Diffstat (limited to 'llgo/test/execution/unsafe/offsetof.go')
-rw-r--r--llgo/test/execution/unsafe/offsetof.go26
1 files changed, 26 insertions, 0 deletions
diff --git a/llgo/test/execution/unsafe/offsetof.go b/llgo/test/execution/unsafe/offsetof.go
new file mode 100644
index 00000000000..88b313ab5e1
--- /dev/null
+++ b/llgo/test/execution/unsafe/offsetof.go
@@ -0,0 +1,26 @@
+// RUN: llgo -o %t %s
+// RUN: %t 2>&1 | FileCheck %s
+
+// CHECK: 0
+// CHECK-NEXT: 4
+// CHECK-NEXT: 8
+// CHECK-NEXT: 16
+
+package main
+
+import "unsafe"
+
+type S struct {
+ a int16
+ b int32
+ c int8
+ d int64
+}
+
+func main() {
+ var s S
+ println(unsafe.Offsetof(s.a))
+ println(unsafe.Offsetof(s.b))
+ println(unsafe.Offsetof(s.c))
+ println(unsafe.Offsetof(s.d))
+}
OpenPOWER on IntegriCloud