]> Cypherpunks repositories - gostls13.git/commitdiff
gc: skip undefined symbols in import .
authorEoghan Sherry <ejsherry@gmail.com>
Tue, 7 Dec 2010 21:16:01 +0000 (16:16 -0500)
committerRuss Cox <rsc@golang.org>
Tue, 7 Dec 2010 21:16:01 +0000 (16:16 -0500)
Fixes #1284.

R=ken3, rsc
CC=golang-dev
https://golang.org/cl/3210041

src/cmd/gc/subr.c
test/fixedbugs/bug313.dir/a.go [new file with mode: 0644]
test/fixedbugs/bug313.dir/b.go [new file with mode: 0644]
test/fixedbugs/bug313.go [new file with mode: 0644]

index 2ebacba6eb50b95fc1485203350686e0bc025f78..8acf1cdfec39ff4814fa057f389758864b2f67e9 100644 (file)
@@ -363,6 +363,8 @@ importdot(Pkg *opkg, Node *pack)
                for(s = hash[h]; s != S; s = s->link) {
                        if(s->pkg != opkg)
                                continue;
+                       if(s->def == N)
+                               continue;
                        if(!exportname(s->name) || utfrune(s->name, 0xb7))      // 0xb7 = center dot
                                continue;
                        s1 = lookup(s->name);
diff --git a/test/fixedbugs/bug313.dir/a.go b/test/fixedbugs/bug313.dir/a.go
new file mode 100644 (file)
index 0000000..cb4ca72
--- /dev/null
@@ -0,0 +1,11 @@
+// Copyright 2010 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.
+
+package main
+
+import "fmt"
+
+func a() {
+       fmt.DoesNotExist() // ERROR "undefined"
+}
diff --git a/test/fixedbugs/bug313.dir/b.go b/test/fixedbugs/bug313.dir/b.go
new file mode 100644 (file)
index 0000000..7eda72b
--- /dev/null
@@ -0,0 +1,11 @@
+// Copyright 2010 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.
+
+package main
+
+import . "fmt"
+
+func b() {
+       Println()
+}
diff --git a/test/fixedbugs/bug313.go b/test/fixedbugs/bug313.go
new file mode 100644 (file)
index 0000000..eb2a022
--- /dev/null
@@ -0,0 +1,19 @@
+// errchk $G -e $D/$F.dir/[ab].go
+
+// Copyright 2010 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.
+
+// Issue 1284
+
+package bug313
+
+/*
+6g bug313.dir/[ab].go
+
+Before:
+bug313.dir/b.go:7: internal compiler error: fault
+
+Now:
+bug313.dir/a.go:10: undefined: fmt.DoesNotExist
+*/