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

runtime: Segmentation Fault when initializing slice: type []string #39875

Closed
udishamir opened this issue Jun 26, 2020 · 2 comments
Closed

runtime: Segmentation Fault when initializing slice: type []string #39875

udishamir opened this issue Jun 26, 2020 · 2 comments

Comments

@udishamir
Copy link

@udishamir udishamir commented Jun 26, 2020

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

$ go version go1.10.4 linux/amd64

Does this issue reproduce with the latest release?

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

go env Output
$ go env
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/user/.cache/go-build"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/user/go"
GORACE=""
GOROOT="/usr/lib/go-1.10"
GOTMPDIR=""
GOTOOLDIR="/usr/lib/go-1.10/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
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 -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build512368729=/tmp/go-build -gno-record-gcc-switches"

What did you do?

initialized slice:
var myslice []string = []string{"abcdefg", " ABCDEFG"} <<-- pay attention to the space in the second element

What did you expect to see?

warning, not crash

What did you see instead?

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

@randall77
Copy link
Contributor

@randall77 randall77 commented Jun 26, 2020

Please provide a full program that crashes, with reproduction instructions.
That line definitely shouldn't segfault, space or not.

@ALTree ALTree changed the title Segmantation Fault when initializing slice: type []string and initializing one memnber with space in the begining runtime: Segmentation Fault when initializing slice: type []string Jun 26, 2020
@udishamir
Copy link
Author

@udishamir udishamir commented Jun 26, 2020

Ok, ill check whats up on my side again,

@udishamir udishamir closed this Jun 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.