summaryrefslogtreecommitdiff
path: root/libgo/misc/cgo/testshared/src/dep3
diff options
context:
space:
mode:
authorMartin Jambor <mjambor@suse.cz>2017-07-31 14:43:24 +0200
committerMartin Jambor <mjambor@suse.cz>2017-07-31 14:43:24 +0200
commitb32f12dece884f1fa0f04c643a77105aff6ce8bc (patch)
treecdab5f10806561fc198f907299b0e55eb5701ef0 /libgo/misc/cgo/testshared/src/dep3
parent166bec868d991fdf71f9a66f994e5977fcab4aa2 (diff)
parenta168a775e93ec31ae743ad282d8e60fa1c116891 (diff)
downloadgcc-b32f12dece884f1fa0f04c643a77105aff6ce8bc.tar.gz
Merge branch 'master' into gcngcn
Diffstat (limited to 'libgo/misc/cgo/testshared/src/dep3')
-rw-r--r--libgo/misc/cgo/testshared/src/dep3/dep3.go22
1 files changed, 22 insertions, 0 deletions
diff --git a/libgo/misc/cgo/testshared/src/dep3/dep3.go b/libgo/misc/cgo/testshared/src/dep3/dep3.go
new file mode 100644
index 00000000000..7b7c9dac1f9
--- /dev/null
+++ b/libgo/misc/cgo/testshared/src/dep3/dep3.go
@@ -0,0 +1,22 @@
+package dep3
+
+// The point of this test file is that it references a type from
+// depBase that is also referenced in dep2, but dep2 is loaded by the
+// linker before depBase (because it is earlier in the import list).
+// There was a bug in the linker where it would not correctly read out
+// the type data in this case and later crash.
+
+import (
+ "dep2"
+ "depBase"
+)
+
+type Dep3 struct {
+ dep depBase.Dep
+ dep2 dep2.Dep2
+}
+
+func D3() int {
+ var x Dep3
+ return x.dep.X + x.dep2.X
+}