Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd/compile: GOSSAFUNC=main open ssa.html: permission denied #33278

Closed
tommyknows opened this issue Jul 25, 2019 · 4 comments
Closed

cmd/compile: GOSSAFUNC=main open ssa.html: permission denied #33278

tommyknows opened this issue Jul 25, 2019 · 4 comments
Milestone

Comments

@tommyknows
Copy link

@tommyknows tommyknows commented Jul 25, 2019

What version of Go are you using (go version)?

$ go version
go version go1.12.5 darwin/amd64
$ go-head version
go version devel +919594830f Tue Jul 23 23:42:43 2019 +0000 darwin/amd64

Does this issue reproduce with the latest release?

It does with both versions reported above.

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/ramon/Library/Caches/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/ramon/Documents/go"
GOPROXY=""
GORACE=""
GOROOT="/usr/local/go"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/dev/null"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/fm/tzdsx49104v20lr4m55_g43w0000gn/T/go-build935976489=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

I saw this blogpost and wanted to try out the SSA HTML thing. I thus wrote the main.go file and ran the command:

$ env GOSSAFUNC=main go build main.go
# runtime
<unknown line number>: internal compiler error: 'main': open ssa.html: permission denied

Please file a bug report including a short program that triggers the error.
https://golang.org/issue/new

NOTE: as i have go modules enabled, I also ran go mod init ssatest.

the permissions in the directory are rwx for all users.
a normal build with go build ., or go build main.go works fine.

And just for demonstration; when changing the file to this:

main.go
package main

import "fmt"

func main() {
fmt.Println(2)
test()
}
func test() {
fmt.Println(3)
}

$ env GOSSAFUNC=test go build main.go
# command-line-arguments
dumped SSA to ./ssa.html

so it seems to only occur when using GOSSAFUNC=main.

For the sake of completion:

output with GOSSAFUNC=main+
$ env GOSSAFUNC=main+ go-head build main.go
# runtime
generating SSA for main
buildssa-enter
buildssa-body
.   DCL l(111)
.   .   NAME-runtime.g a(true) g(1) l(111) x(0) class(PAUTO) tc(1) used PTR-*g

. AS l(111) colas(true) tc(1)
. . NAME-runtime.g a(true) g(1) l(111) x(0) class(PAUTO) tc(1) used PTR-*g
. . END l(111) tc(1) PTR-*g
. . . NAME-runtime.getg a(true) l(18) x(0) class(PFUNC) tc(1) used FUNC-func() *g

. AS l(115) tc(1) hascall
. . DOTPTR l(115) x(304) tc(1) assigned hascall runtime.racectx uintptr
. . . DOTPTR l(115) x(0) tc(1) hascall runtime.g0 PTR-*g
. . . . DOTPTR l(115) x(48) tc(1) hascall runtime.m PTR-*m
. . . . . NAME-runtime.g a(true) g(1) l(111) x(0) class(PAUTO) tc(1) used PTR-*g
. . LITERAL-0 l(115) tc(1) uintptr

. IF l(120) tc(1)
. . LITERAL-true l(120) tc(1) bool
. IF-body
. . AS l(121) tc(1)
. . . NAME-runtime.maxstacksize a(true) l(485) x(0) class(PEXTERN) tc(1) assigned used uintptr
. . . LITERAL-1000000000 l(121) tc(1) uintptr

. AS l(127) tc(1)
. . NAME-runtime.mainStarted a(true) l(101) x(0) class(PEXTERN) tc(1) assigned used bool
. . LITERAL-true tc(1) runtime.true bool

. IF l(129) tc(1)
. . LITERAL-true l(129) tc(1) bool
. IF-body
. . CALLFUNC l(130) tc(1) hascall
. . . NAME-runtime.systemstack a(true) l(54) x(0) class(PFUNC) tc(1) used FUNC-func(func())
. . CALLFUNC-rlist
. . . NAME-runtime.main.func1 a(true) l(130) x(0) class(PFUNC) tc(1) FUNC-func()

. RETJMP l(141) x(2285)

. AS-init
. . AS l(3541) tc(1)
. . . NAME-runtime..autotmp_15 a(true) l(3541) x(0) class(PAUTO) esc(N) tc(1) assigned used PTR-*g
. . . END l(3541) tc(1) PTR-*g
. . . . NAME-runtime.getg a(true) l(18) x(0) class(PFUNC) tc(1) used FUNC-func() *g
. AS l(3541) tc(1) implicit(true) hascall uint32
. . DOTPTR l(3541) x(628) tc(1) assigned hascall runtime.lockedInt uint32
. . . DOTPTR l(3541) x(48) tc(1) hascall runtime.m PTR-*m
. . . . NAME-runtime..autotmp_15 a(true) l(3541) x(0) class(PAUTO) esc(N) tc(1) assigned used PTR-*g
. . ADD l(3541) tc(1) hascall uint32
. . . DOTPTR l(3541) x(628) tc(1) assigned hascall runtime.lockedInt uint32
. . . . DOTPTR l(3541) x(48) tc(1) hascall runtime.m PTR-*m
. . . . . NAME-runtime..autotmp_15 a(true) l(3541) x(0) class(PAUTO) esc(N) tc(1) assigned used PTR-*g
. . . LITERAL-1 l(3541) tc(1) uint32

. RETJMP l(3542) x(2286)

. IF l(3499) tc(1)
. . LITERAL-false l(3499) tc(1) bool

. DCL l(3502)
. . NAME-runtime.g a(true) l(3502) x(0) class(PAUTO) tc(1) used PTR-*g

. AS l(3502) colas(true) tc(1)
. . NAME-runtime.g a(true) l(3502) x(0) class(PAUTO) tc(1) used PTR-*g
. . END l(3502) tc(1) PTR-*g
. . . NAME-runtime.getg a(true) l(18) x(0) class(PFUNC) tc(1) used FUNC-func() *g

. DCL l(3503)
. . NAME-runtime.gp a(true) l(206) x(0) class(PAUTO) tc(1) assigned used PTR-*guintptr

. DCL l(3503)
. . NAME-runtime.g a(true) l(206) x(0) class(PAUTO) tc(1) assigned used PTR-*g

. AS l(3503) tc(1) hascall
. . NAME-runtime.gp a(true) l(206) x(0) class(PAUTO) tc(1) assigned used PTR-*guintptr
. . ADDR l(3503) esc(no) tc(1) implicit(true) hascall PTR-*guintptr
. . . DOTPTR l(3503) x(360) tc(1) addrtaken hascall runtime.lockedg runtime.guintptr
. . . . DOTPTR l(3503) x(48) tc(1) hascall runtime.m PTR-*m
. . . . . NAME-runtime.g a(true) l(3502) x(0) class(PAUTO) tc(1) used PTR-*g

. BLOCK l(3503)
. BLOCK-list
. . AS l(3503) tc(1)
. . . NAME-runtime.g a(true) l(206) x(0) class(PAUTO) tc(1) assigned used PTR-*g
. . . NAME-runtime.g a(true) l(3502) x(0) class(PAUTO) tc(1) used PTR-*g

. RETJMP l(3503) x(2287)

. AS l(206) tc(1) hascall
. . DEREF l(206) tc(1) assigned hascall runtime.guintptr
. . . NAME-runtime.gp a(true) l(206) x(0) class(PAUTO) tc(1) assigned used PTR-*guintptr
. . CONVNOP l(206) tc(1) runtime.guintptr
. . . CONVNOP l(206) tc(1) UNSAFEPTR-unsafe.Pointer
. . . . NAME-runtime.g a(true) l(206) x(0) class(PAUTO) tc(1) assigned used PTR-*g

. LABEL l(3503) tc(1) runtime..i2

. DCL l(3504)
. . NAME-runtime.mp a(true) l(244) x(0) class(PAUTO) tc(1) assigned used PTR-*muintptr

. DCL l(3504)
. . NAME-runtime.m a(true) l(244) x(0) class(PAUTO) tc(1) assigned used PTR-*m

. AS l(3504) tc(1) hascall
. . NAME-runtime.mp a(true) l(244) x(0) class(PAUTO) tc(1) assigned used PTR-*muintptr
. . ADDR l(3504) esc(no) tc(1) implicit(true) hascall PTR-*muintptr
. . . DOTPTR l(3504) x(216) tc(1) addrtaken hascall runtime.lockedm runtime.muintptr
. . . . NAME-runtime.g a(true) l(3502) x(0) class(PAUTO) tc(1) used PTR-*g

. BLOCK l(3504)
. BLOCK-list
. . AS l(3504) tc(1) hascall
. . . NAME-runtime.m a(true) l(244) x(0) class(PAUTO) tc(1) assigned used PTR-*m
. . . DOTPTR l(3504) x(48) tc(1) hascall runtime.m PTR-*m
. . . . NAME-runtime.g a(true) l(3502) x(0) class(PAUTO) tc(1) used PTR-*g

. RETJMP l(3504) x(2288)

. AS l(244) tc(1) hascall
. . DEREF l(244) tc(1) assigned hascall runtime.muintptr
. . . NAME-runtime.mp a(true) l(244) x(0) class(PAUTO) tc(1) assigned used PTR-*muintptr
. . CONVNOP l(244) tc(1) runtime.muintptr
. . . CONVNOP l(244) tc(1) UNSAFEPTR-unsafe.Pointer
. . . . NAME-runtime.m a(true) l(244) x(0) class(PAUTO) tc(1) assigned used PTR-*m

. LABEL l(3504) tc(1) runtime..i3

. LABEL l(3542) tc(1) runtime..i1

. LABEL l(141) tc(1) runtime..i0

. IF l(143) tc(1)
. . NE l(143) tc(1) hascall bool
. . . DOTPTR l(143) x(48) tc(1) hascall runtime.m PTR-*m
. . . . NAME-runtime.g a(true) g(1) l(111) x(0) class(PAUTO) tc(1) used PTR-*g
. . . ADDR l(143) esc(no) tc(1) PTR-*m
. . . . NAME-runtime.m0 a(true) l(80) x(0) class(PEXTERN) tc(1) addrtaken used runtime.m
. IF-body
. . CALLFUNC l(144) tc(1) hascall
. . . NAME-runtime.throw a(true) l(607) x(0) class(PFUNC) tc(1) used FUNC-func(string)
. . CALLFUNC-rlist
. . . LITERAL-"runtime.main not on m0" l(144) tc(1) string

. CALLFUNC l(147) tc(1) hascall
. . NAME-runtime.runtime_init a(true) l(86) x(0) class(PFUNC) tc(1) used FUNC-func()

. IF-init
. . AS l(148) tc(1) hascall
. . . NAME-runtime..autotmp_12 a(true) l(148) x(0) class(PAUTO) esc(N) tc(1) assigned used int64
. . . CALLFUNC l(148) tc(1) hascall int64
. . . . NAME-runtime.nanotime a(true) l(226) x(0) class(PFUNC) tc(1) used FUNC-func() int64
. IF l(148) tc(1)
. . EQ l(148) tc(1) bool
. . . NAME-runtime..autotmp_12 a(true) l(148) x(0) class(PAUTO) esc(N) tc(1) assigned used int64
. . . LITERAL-0 l(148) tc(1) int64
. IF-rlist
. . VARKILL l(148) tc(1)
. . . NAME-runtime..autotmp_12 a(true) l(148) x(0) class(PAUTO) esc(N) tc(1) assigned used int64
. IF-body
. . VARKILL l(148) tc(1)
. . . NAME-runtime..autotmp_12 a(true) l(148) x(0) class(PAUTO) esc(N) tc(1) assigned used int64

. . CALLFUNC l(149) tc(1) hascall
. . . NAME-runtime.throw a(true) l(607) x(0) class(PFUNC) tc(1) used FUNC-func(string)
. . CALLFUNC-rlist
. . . LITERAL-"nanotime returning zero" l(149) tc(1) string

. DCL l(153)
. . NAME-runtime.needUnlock a(true) g(1) l(153) x(0) class(PAUTO) tc(1) addrtaken assigned used bool

. AS l(153) colas(true) tc(1)
. . NAME-runtime.needUnlock a(true) g(1) l(153) x(0) class(PAUTO) tc(1) addrtaken assigned used bool
. . LITERAL-true tc(1) runtime.true bool

. DEFER l(154) tc(1)
. . CALLFUNC l(158) tc(1) hascall STRUCT-()
. . . NAME-runtime.main.func2 a(true) l(154) x(0) class(PFUNC) tc(1) FUNC-func(*bool)
. . CALLFUNC-rlist
. . . ADDR l(154) tc(1) PTR-*bool
. . . . NAME-runtime.needUnlock a(true) g(1) l(153) x(0) class(PAUTO) tc(1) addrtaken assigned used bool

. AS l(161) tc(1) hascall
. . NAME-runtime.runtimeInitTime a(true) l(104) x(0) class(PEXTERN) tc(1) assigned used int64
. . CALLFUNC l(161) tc(1) hascall int64
. . . NAME-runtime.nanotime a(true) l(226) x(0) class(PFUNC) tc(1) used FUNC-func() int64

. CALLFUNC l(163) tc(1) hascall
. . NAME-runtime.gcenable a(true) l(206) x(0) class(PFUNC) tc(1) used FUNC-func()

. AS l(165) tc(1) hascall
. . NAME-runtime.main_init_done a(true) l(95) x(0) class(PEXTERN) tc(1) assigned used CHAN-chan bool
. . CALLFUNC l(165) tc(1) hascall CHAN-chan bool
. . . NAME-runtime.makechan a(true) x(0) class(PFUNC) tc(1) used FUNC-func(*byte, int) chan bool
. . CALLFUNC-rlist
. . . ADDR a(true) l(165) tc(1) PTR-*uint8
. . . . NAME-type.chan bool a(true) x(0) class(PEXTERN) tc(1) uint8

. . . LITERAL-0 l(165) tc(1) int

. IF l(166) tc(1)
. . NAME-runtime.iscgo a(true) l(32) x(0) class(PEXTERN) tc(1) used bool
. IF-body
. . IF l(167) tc(1)
. . . EQ l(167) tc(1) bool
. . . . NAME-runtime._cgo_thread_start a(true) l(23) x(0) class(PEXTERN) tc(1) used UNSAFEPTR-unsafe.Pointer
. . . . LITERAL-0 tc(1) .nil UNSAFEPTR-unsafe.Pointer
. . IF-body
. . . CALLFUNC l(168) tc(1) hascall
. . . . NAME-runtime.throw a(true) l(607) x(0) class(PFUNC) tc(1) used FUNC-func(string)
. . . CALLFUNC-rlist
. . . . LITERAL-"_cgo_thread_start missing" l(168) tc(1) string

. . IF l(170) tc(1)
. . . LITERAL-true l(170) tc(1) bool
. . IF-body
. . . IF l(171) tc(1)
. . . . EQ l(171) tc(1) bool
. . . . . NAME-runtime._cgo_setenv a(true) l(47) x(0) class(PEXTERN) tc(1) used UNSAFEPTR-unsafe.Pointer
. . . . . LITERAL-0 tc(1) .nil UNSAFEPTR-unsafe.Pointer
. . . IF-body
. . . . CALLFUNC l(172) tc(1) hascall
. . . . . NAME-runtime.throw a(true) l(607) x(0) class(PFUNC) tc(1) used FUNC-func(string)
. . . . CALLFUNC-rlist
. . . . . LITERAL-"_cgo_setenv missing" l(172) tc(1) string

. . . IF l(174) tc(1)
. . . . EQ l(174) tc(1) bool
. . . . . NAME-runtime._cgo_unsetenv a(true) l(48) x(0) class(PEXTERN) tc(1) used UNSAFEPTR-unsafe.Pointer
. . . . . LITERAL-0 tc(1) .nil UNSAFEPTR-unsafe.Pointer
. . . IF-body
. . . . CALLFUNC l(175) tc(1) hascall
. . . . . NAME-runtime.throw a(true) l(607) x(0) class(PFUNC) tc(1) used FUNC-func(string)
. . . . CALLFUNC-rlist
. . . . . LITERAL-"_cgo_unsetenv missing" l(175) tc(1) string

. . IF l(178) tc(1)
. . . EQ l(178) tc(1) bool
. . . . NAME-runtime._cgo_notify_runtime_init_done a(true) l(25) x(0) class(PEXTERN) tc(1) used UNSAFEPTR-unsafe.Pointer
. . . . LITERAL-0 tc(1) .nil UNSAFEPTR-unsafe.Pointer
. . IF-body
. . . CALLFUNC l(179) tc(1) hascall
. . . . NAME-runtime.throw a(true) l(607) x(0) class(PFUNC) tc(1) used FUNC-func(string)
. . . CALLFUNC-rlist
. . . . LITERAL-"_cgo_notify_runtime_init_done missing" l(179) tc(1) string

. . RETJMP l(183) x(2289)

. . IF l(1870) tc(1)
. . . LITERAL-false l(1870) tc(1) bool

. . IF-init
. . . AS l(1873) tc(1) hascall
. . . . NAME-runtime..autotmp_13 a(true) l(1873) x(0) class(PAUTO) esc(N) tc(1) assigned used bool
. . . . CALLFUNC l(1873) tc(1) hascall bool
. . . . . NAME-atomic.Cas a(true) l(12) x(0) class(PFUNC) tc(1) used FUNC-func(*uint32, uint32, uint32) bool
. . . . CALLFUNC-rlist
. . . . . ADDR l(1873) esc(no) tc(1) PTR-*uint32
. . . . . . DOT l(1873) x(32) tc(1) addrtaken runtime.haveTemplateThread uint32
. . . . . . . NAME-runtime.newmHandoff a(true) l(1789) x(0) class(PEXTERN) tc(1) addrtaken assigned used STRUCT-struct { lock mutex; newm muintptr; waiting bool; wake note; haveTemplateThread uint32 }

. . . . . LITERAL-0 l(1873) tc(1) uint32

. . . . . LITERAL-1 l(1873) tc(1) uint32
. . IF l(1873) tc(1)
. . . NOT l(1873) tc(1) bool
. . . . NAME-runtime..autotmp_13 a(true) l(1873) x(0) class(PAUTO) esc(N) tc(1) assigned used bool
. . IF-rlist
. . . VARKILL l(1873) tc(1)
. . . . NAME-runtime..autotmp_13 a(true) l(1873) x(0) class(PAUTO) esc(N) tc(1) assigned used bool
. . IF-body
. . . VARKILL l(1873) tc(1)
. . . . NAME-runtime..autotmp_13 a(true) l(1873) x(0) class(PAUTO) esc(N) tc(1) assigned used bool

. . . GOTO l(183) tc(1) runtime..i4

. . CALLFUNC l(1876) tc(1) hascall
. . . NAME-runtime.newm a(true) l(1811) x(0) class(PFUNC) tc(1) used FUNC-func(func(), *p)
. . CALLFUNC-rlist
. . . NAME-runtime.templateThread a(true) l(1891) x(0) class(PFUNC) tc(1) used FUNC-func()

. . . LITERAL-0 tc(1) .nil PTR-*p

. . LABEL l(183) tc(1) runtime..i4

. . CALLFUNC l(184) tc(1) hascall int32
. . . NAME-runtime.cgocall a(true) l(94) x(0) class(PFUNC) tc(1) used FUNC-func(unsafe.Pointer, unsafe.Pointer) int32
. . CALLFUNC-rlist
. . . NAME-runtime._cgo_notify_runtime_init_done a(true) l(25) x(0) class(PEXTERN) tc(1) used UNSAFEPTR-unsafe.Pointer

. . . LITERAL-0 tc(1) .nil UNSAFEPTR-unsafe.Pointer

. DCL l(187)
. . NAME-runtime.fn a(true) g(1) l(187) x(0) class(PAUTO) tc(1) assigned used FUNC-func()

. AS l(187) colas(true) tc(1)
. . NAME-runtime.fn a(true) g(1) l(187) x(0) class(PAUTO) tc(1) assigned used FUNC-func()
. . NAME-runtime.main_init a(true) l(89) x(0) class(PFUNC) tc(1) used FUNC-func()

. CALLFUNC l(188) tc(1) hascall
. . NAME-runtime.fn a(true) g(1) l(187) x(0) class(PAUTO) tc(1) assigned used FUNC-func()

. CALLFUNC l(189) tc(1) hascall
. . NAME-runtime.closechan a(true) x(0) class(PFUNC) tc(1) used FUNC-func(chan bool)
. CALLFUNC-rlist
. . NAME-runtime.main_init_done a(true) l(95) x(0) class(PEXTERN) tc(1) assigned used CHAN-chan bool

. AS l(191) tc(1)
. . NAME-runtime.needUnlock a(true) g(1) l(153) x(0) class(PAUTO) tc(1) addrtaken assigned used bool
. . LITERAL-false tc(1) runtime.false bool

. CALLFUNC l(192) tc(1) hascall
. . NAME-runtime.unlockOSThread a(true) l(3585) x(0) class(PFUNC) tc(1) used FUNC-func()

. IF-init
. . AS l(194) tc(1)
. . . NAME-runtime..autotmp_13 a(true) l(1873) x(0) class(PAUTO) esc(N) tc(1) assigned used bool
. . . NAME-runtime.isarchive a(true) l(879) x(0) class(PEXTERN) tc(1) used bool

. . IF l(194)
. . . NAME-runtime..autotmp_13 a(true) l(1873) x(0) class(PAUTO) esc(N) tc(1) assigned used bool
. . IF-rlist
. . . AS l(194) tc(1)
. . . . NAME-runtime..autotmp_13 a(true) l(1873) x(0) class(PAUTO) esc(N) tc(1) assigned used bool
. . . . NAME-runtime.islibrary a(true) l(878) x(0) class(PEXTERN) tc(1) used bool
. IF l(194) tc(1)
. . CONVNOP l(194) tc(1) bool
. . . NAME-runtime..autotmp_13 a(true) l(1873) x(0) class(PAUTO) esc(N) tc(1) assigned used bool
. IF-rlist
. . VARKILL l(194) tc(1)
. . . NAME-runtime..autotmp_13 a(true) l(1873) x(0) class(PAUTO) esc(N) tc(1) assigned used bool
. IF-body
. . VARKILL l(194) tc(1)
. . . NAME-runtime..autotmp_13 a(true) l(1873) x(0) class(PAUTO) esc(N) tc(1) assigned used bool

. . RETURN l(197) tc(1)

. AS l(199) tc(1)
. . NAME-runtime.fn a(true) g(1) l(187) x(0) class(PAUTO) tc(1) assigned used FUNC-func()
. . NAME-runtime.main_main a(true) l(98) x(0) class(PFUNC) tc(1) used FUNC-func()

. CALLFUNC l(200) tc(1) hascall
. . NAME-runtime.fn a(true) g(1) l(187) x(0) class(PAUTO) tc(1) assigned used FUNC-func()

. IF l(201) tc(1)
. . LITERAL-false a(true) l(15) x(0) class(PEXTERN) tc(1) runtime.raceenabled bool

. IF-init
. . AS l(209) tc(1) hascall
. . . NAME-runtime..autotmp_14 a(true) l(209) x(0) class(PAUTO) esc(N) tc(1) assigned used uint32
. . . CALLFUNC l(209) tc(1) hascall uint32
. . . . NAME-atomic.Load a(true) l(13) x(0) class(PFUNC) tc(1) used FUNC-func(*uint32) uint32
. . . CALLFUNC-rlist
. . . . ADDR l(209) esc(no) tc(1) PTR-*uint32
. . . . . NAME-runtime.runningPanicDefers a(true) l(624) x(0) class(PEXTERN) tc(1) addrtaken used uint32
. IF l(209) tc(1)
. . NE l(209) tc(1) bool
. . . NAME-runtime..autotmp_14 a(true) l(209) x(0) class(PAUTO) esc(N) tc(1) assigned used uint32
. . . LITERAL-0 l(209) tc(1) uint32
. IF-rlist
. . VARKILL l(209) tc(1)
. . . NAME-runtime..autotmp_14 a(true) l(209) x(0) class(PAUTO) esc(N) tc(1) assigned used uint32
. IF-body
. . VARKILL l(209) tc(1)
. . . NAME-runtime..autotmp_14 a(true) l(209) x(0) class(PAUTO) esc(N) tc(1) assigned used uint32

. . DCL l(211)
. . . NAME-runtime.c a(true) g(2) l(211) x(0) class(PAUTO) tc(1) assigned used int

. . AS l(211) colas(true) tc(1)
. . . NAME-runtime.c a(true) g(2) l(211) x(0) class(PAUTO) tc(1) assigned used int
. . . LITERAL-0 l(211) tc(1) int

. . FOR l(211) tc(1)
. . . LT l(211) tc(1) bool
. . . . NAME-runtime.c a(true) g(2) l(211) x(0) class(PAUTO) tc(1) assigned used int
. . . . LITERAL-1000 l(211) tc(1) int
. . . BLOCK l(211)
. . . BLOCK-list
. . . . AS l(211) tc(1) implicit(true) int
. . . . . NAME-runtime.c a(true) g(2) l(211) x(0) class(PAUTO) tc(1) assigned used int
. . . . . ADD l(211) tc(1) int
. . . . . . NAME-runtime.c a(true) g(2) l(211) x(0) class(PAUTO) tc(1) assigned used int
. . . . . . LITERAL-1 l(211) tc(1) int
. . FOR-body
. . . IF-init
. . . . AS l(212) tc(1) hascall
. . . . . NAME-runtime..autotmp_14 a(true) l(209) x(0) class(PAUTO) esc(N) tc(1) assigned used uint32
. . . . . CALLFUNC l(212) tc(1) hascall uint32
. . . . . . NAME-atomic.Load a(true) l(13) x(0) class(PFUNC) tc(1) used FUNC-func(*uint32) uint32
. . . . . CALLFUNC-rlist
. . . . . . ADDR l(212) esc(no) tc(1) PTR-*uint32
. . . . . . . NAME-runtime.runningPanicDefers a(true) l(624) x(0) class(PEXTERN) tc(1) addrtaken used uint32
. . . IF l(212) tc(1)
. . . . EQ l(212) tc(1) bool
. . . . . NAME-runtime..autotmp_14 a(true) l(209) x(0) class(PAUTO) esc(N) tc(1) assigned used uint32
. . . . . LITERAL-0 l(212) tc(1) uint32
. . . IF-rlist
. . . . VARKILL l(212) tc(1)
. . . . . NAME-runtime..autotmp_14 a(true) l(209) x(0) class(PAUTO) esc(N) tc(1) assigned used uint32
. . . IF-body
. . . . VARKILL l(212) tc(1)
. . . . . NAME-runtime..autotmp_14 a(true) l(209) x(0) class(PAUTO) esc(N) tc(1) assigned used uint32

. . . . BREAK l(213) tc(1)

. . . RETJMP l(215) x(2290)

. . . RETJMP l(265) x(2291)

. . . LABEL l(265) tc(1) runtime..i6

. . . CALLFUNC l(266) tc(1) hascall
. . . . NAME-runtime.mcall a(true) l(34) x(0) class(PFUNC) tc(1) used FUNC-func(func(*g))
. . . CALLFUNC-rlist
. . . . NAME-runtime.gosched_m a(true) l(2624) x(0) class(PFUNC) tc(1) used FUNC-func(*g)

. . . LABEL l(215) tc(1) runtime..i5

. IF-init
. . AS l(218) tc(1) hascall
. . . NAME-runtime..autotmp_14 a(true) l(209) x(0) class(PAUTO) esc(N) tc(1) assigned used uint32
. . . CALLFUNC l(218) tc(1) hascall uint32
. . . . NAME-atomic.Load a(true) l(13) x(0) class(PFUNC) tc(1) used FUNC-func(*uint32) uint32
. . . CALLFUNC-rlist
. . . . ADDR l(218) esc(no) tc(1) PTR-*uint32
. . . . . NAME-runtime.panicking a(true) l(628) x(0) class(PEXTERN) tc(1) addrtaken used uint32
. IF l(218) tc(1)
. . NE l(218) tc(1) bool
. . . NAME-runtime..autotmp_14 a(true) l(209) x(0) class(PAUTO) esc(N) tc(1) assigned used uint32
. . . LITERAL-0 l(218) tc(1) uint32
. IF-rlist
. . VARKILL l(218) tc(1)
. . . NAME-runtime..autotmp_14 a(true) l(209) x(0) class(PAUTO) esc(N) tc(1) assigned used uint32
. IF-body
. . VARKILL l(218) tc(1)
. . . NAME-runtime..autotmp_14 a(true) l(209) x(0) class(PAUTO) esc(N) tc(1) assigned used uint32

. . CALLFUNC l(219) tc(1) hascall
. . . NAME-runtime.gopark a(true) l(284) x(0) class(PFUNC) tc(1) used FUNC-func(func(*g, unsafe.Pointer) bool, unsafe.Pointer, waitReason, byte, int)
. . CALLFUNC-rlist
. . . LITERAL-nil tc(1) .nil FUNC-func(*g, unsafe.Pointer) bool

. . . LITERAL-0 tc(1) .nil UNSAFEPTR-unsafe.Pointer

. . . LITERAL-8 a(true) l(801) x(8) class(PEXTERN) tc(1) runtime.waitReasonPanicWait runtime.waitReason

. . . LITERAL-16 a(true) l(38) x(16) class(PEXTERN) tc(1) runtime.traceEvGoStop byte

. . . LITERAL-1 l(219) tc(1) int

. CALLFUNC l(222) tc(1) hascall
. . NAME-runtime.exit a(true) l(198) x(0) class(PFUNC) tc(1) used FUNC-func(int32)
. CALLFUNC-rlist
. . LITERAL-0 l(222) tc(1) int32

. FOR l(223) tc(1)
. . BLOCK l(223)
. FOR-body
. . DCL l(224) tc(1)
. . . NAME-runtime.x a(true) g(3) l(224) x(0) class(PAUTO) tc(1) assigned used PTR-*int32

. . AS l(224) tc(1)
. . . NAME-runtime.x a(true) g(3) l(224) x(0) class(PAUTO) tc(1) assigned used PTR-*int32

. . AS l(225) tc(1) hascall
. . . DEREF l(225) tc(1) assigned hascall int32
. . . . NAME-runtime.x a(true) g(3) l(224) x(0) class(PAUTO) tc(1) assigned used PTR-*int32
. . . LITERAL-0 l(225) tc(1) int32
buildssa-exit
: internal compiler error: 'main': open ssa.html: permission denied

Please file a bug report including a short program that triggers the error.
https://golang.org/issue/new

I'm a complete newbie in this topic, so maybe it's just me doing something wrong 🙂

@cherrymui

This comment has been minimized.

Copy link
Contributor

@cherrymui cherrymui commented Jul 26, 2019

It seems to me that this is because GOSSAFUNC=main triggers not only main.main but also runtime.main. For the latter, it wants to emit ssa.html to the source directory of the runtime package, which is $GOROOT/src/runtime. In your case, that directory is probably not writable, thus the error.

@tommyknows

This comment has been minimized.

Copy link
Author

@tommyknows tommyknows commented Jul 26, 2019

Can confirm this suspicion. Making $GOROOT/src/runtime readable results in:

# runtime
dumped SSA to /usr/local/go/src/runtime/ssa.html
# command-line-arguments
dumped SSA to ./ssa.html

However, I guess this is not what I was hoping for - I just want to have main.main.
(Yes, the ssa.html in my working directory contains only that, but I don't want to make my runtime folder readable just to drop an ssa.html into my current directory 🙂 )

Weirdly enough, now I have the following situation:
I changed the permissions of the $GOROOT/src/runtime back to how it was before (755) and cleaned up both ssa.html files.
When running the same command again, I get:

$ env GOSSAFUNC=main go build ./main.go 
# runtime
dumped SSA to /usr/local/go/src/runtime/ssa.html
# command-line-arguments
dumped SSA to ./ssa.html

so no complaints (although the runtime-directory is not writeable by this user anymore). But there are no ssa.html files in both my working directory and the runtime-directory.

Also. executing with GOSSAFUNC=main.main does not change this behaviour.
And even after changing back the permissions to rwx for all users, go build does not output an ssa.html file:

$ ls
go.mod  main.go
$ env GOSSAFUNC=main go build .
# runtime
dumped SSA to /usr/local/go/src/runtime/ssa.html
# ssatest
dumped SSA to ./ssa.html
$ ls
go.mod  main.go ssatest

UPDATE: it seems to "randomly" write the ssa.html. For example, I removed the go.mod file and ran the same env GOSSAFUNC=main go build ./main.go command again, and it wrote the file. Deleted the ssa.html, ran the command again, and there was no ssa.html...

@ALTree ALTree added this to the Go1.14 milestone Jul 26, 2019
@ALTree ALTree changed the title cmd/compile GOSSAFUNC=main open ssa.html: permission denied cmd/compile: GOSSAFUNC=main open ssa.html: permission denied Jul 26, 2019
@agnivade

This comment has been minimized.

Copy link
Contributor

@agnivade agnivade commented Jul 26, 2019

Also. executing with GOSSAFUNC=main.main does not change this behaviour.
And even after changing back the permissions to rwx for all users, go build does not output an ssa.html file:

Yes, this is a common stumbling block. If your code hasn't changed, it will not regenerate the ssa.html file. Either change the code, or rename your function to something else. If your function is main, you need to change the code unfortunately.

Btw, you can work around the issue if you just use go tool compile instead of go build. That fixes the $GOROOT/src/runtime issue and the regeneration issue.

@tommyknows

This comment has been minimized.

Copy link
Author

@tommyknows tommyknows commented Jul 26, 2019

Ah yes. Changed a line in the code and the ssa.html appeared. I guess that's why it is also not complaining about the ssa.html in the $GOROOT/src/runtime folder - it says it wrote it but it actually never tried, so it never failed either.

Definitely a stumbling block.

Thanks for the tip with go tool compile, this seems to work perfectly!

@tommyknows tommyknows closed this Jul 26, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.