Bug 79122 - go test -race reports import cycles with gccgo
Summary: go test -race reports import cycles with gccgo
Status: UNCONFIRMED
Alias: None
Product: gcc
Classification: Unclassified
Component: go (show other bugs)
Version: 6.3.1
: P3 normal
Target Milestone: ---
Assignee: Ian Lance Taylor
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-01-17 23:12 UTC by Alan
Modified: 2017-01-18 14:55 UTC (History)
0 users

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Alan 2017-01-17 23:12:42 UTC
### What version of Go are you using (`go version`)?
go version go1.6.1 gccgo (GCC) 6.3.1 20161221 (Red Hat 6.3.1-1) linux/amd64

### What operating system and processor architecture are you using (`go env`)?
GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/aconway/go:/home/aconway/proton/proton-c/bindings/go"
GORACE=""
GOROOT="/usr/lib/golang"
GOTOOLDIR="/usr/libexec/gcc/x86_64-redhat-linux/6.3.1"
GO15VENDOREXPERIMENT="1"
CC="/usr/bin/gcc"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0"
CXX="/usr/bin/g++"
CGO_ENABLED="1"

### What did you do?
Create a package "tmp" containing a single "tmp.go" source file with one line: `package tmp`
go test -race tmp

### What did you expect to see?
go test -race tmp
?   	tmp	[no test files]

### What did you see instead?
go test -race tmp
import cycle not allowed
package tmp
	imports runtime
	imports runtime/internal/atomic
	imports runtime/race
	imports syscall
	imports internal/race
	imports runtime/race

I do not have this  problem if I use golang's go compiler, only with gccgo. I can see the problem on a real codebase, but the above reproducer shows it doesn't require any actual code to exhibit the problem, in particular you don't need `import "runtime"`. 

I have been seeing this problem since Go 1.4. I'm not sure whether it is a gcc problem or a go tools problem, I am reporting on both sites.
Comment 2 Ian Lance Taylor 2017-01-18 03:25:46 UTC
Note that the race detector doesn't work at all with gccgo.  So while this is a pretty bad error message, the only fix for this bug is going to be to produce a better error message.
Comment 3 Alan 2017-01-18 14:55:29 UTC
I thought that might be the case but couldn't find a clear statement after a fair bit of googling. Is there a 'limitations of gccgo' doc somewhere that lists the unsupported features?

You can close this from my perspective, unless you want to keep it to track the error message/documentation issues.