Skip to content

cmd/compile: SEGV in go 1.8 compiler (gc.typecheck1) with go build #19323

@bstarynk

Description

@bstarynk

Please answer these questions before submitting your issue. Thanks!

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

go version go1.8 linux/amd64

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

Linux/x86-64
Debian/Sid/x86-64

GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/ssdhome/basile/mygoworkspace:/ssdhome/basile/monimelt"
GORACE=""
GOROOT="/usr/local/go"
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GCCGO="/usr/bin/gccgo"
CC="gcc"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build617532280=/tmp/go-build -gno-record-gcc-switches"
CXX="g++"
CGO_ENABLED="1"
PKG_CONFIG="pkg-config"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"

What did you do?

If possible, provide a recipe for reproducing the error.

For some reason, I am not able to upload the faulty tarball via this interface.
Uploading monimelt-go-segv.tar.gz…

But I have installed that gzipped tar archive on http://gcc-melt.org/monimelt-go-segv.tar.gz

Its md5sum is c1036d5473fa30a3b23dbb72e6f6389f
It is a small file of 19234 bytes (less than twenty kilobytes)
and it is exactly the commit bstarynk/monimelt@507be38

Extract it into some directory monimelt-go-segv
then the three commands
export GOPATH=$PWD/monimelt-go-segv
cd monimelt-go-segv
go build src/monimelt.go
gives (in a reproducible fashion)

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x58 pc=0x998773]

goroutine 1 [running]:
cmd/compile/internal/gc.typecheck1(0xc42050d320, 0x1, 0xc42050cab0)
/usr/local/go/src/cmd/compile/internal/gc/typecheck.go:1122 +0xa2c3
cmd/compile/internal/gc.typecheck(0xc42050d320, 0x1, 0xc42050cab0)
/usr/local/go/src/cmd/compile/internal/gc/typecheck.go:188 +0x608
cmd/compile/internal/gc.typecheckslice(0xc4200aef80, 0xd, 0x10, 0x1)
/usr/local/go/src/cmd/compile/internal/gc/typecheck.go:49 +0x4e
cmd/compile/internal/gc.Main()
/usr/local/go/src/cmd/compile/internal/gc/main.go:374 +0x1938
main.main()
/usr/local/go/src/cmd/compile/main.go:50 +0xfe

A complete runnable program is good.
A link on play.golang.org is best.

What did you expect to see?

I am a newbie, perhaps making newbie mistakes. I am expecting compiler error messages, not SEGV

What did you see instead?

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x58 pc=0x998773]
and the shown backtrace is indeed inside the Go compiler & runtime.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions