Skip to content

gccgo: no panic on nil pointer dereference #53012

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

Closed
ddaa2000 opened this issue May 20, 2022 · 4 comments
Closed

gccgo: no panic on nil pointer dereference #53012

ddaa2000 opened this issue May 20, 2022 · 4 comments
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@ddaa2000
Copy link

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

$ gccgo -v
Using built-in specs.
COLLECT_GCC=/usr/local/gcc-12.1.0/bin/gccgo
COLLECT_LTO_WRAPPER=/usr/local/gcc-12.1.0/libexec/gcc/x86_64-pc-linux-gnu/12.1.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-12.1.0/configure --prefix=/usr/local/gcc-12.1.0 --enable-languages=c,c++,go --with-arch-32=i586
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 12.1.0 (GCC) 

Does this issue reproduce with the latest release?

Yes.

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

go env Output
$ go env
GO111MODULE="on"
GOARCH="amd64"
GOBIN=""
GOCACHE="/root/.cache/go-build"
GOENV="/root/.config/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/root/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/root/go"
GOPRIVATE=""
GOPROXY="https://mirrors.aliyun.com/goproxy/"
GOROOT="/usr/local/go1.18.1"
GOSUMDB="off"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go1.18.1/pkg/tool/linux_amd64"
GOVCS=""
GOVERSION="go1.18.1"
GCCGO="/usr/local/gcc-12.1.0/bin/gccgo"
GOAMD64="v1"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/dev/null"
GOWORK=""
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-build847055300=/tmp/go-build -gno-record-gcc-switches"

What did you do?

https://go.dev/play/p/x2C91_hk5IP?v=gotip

What did you expect to see?

Program throws a panic.

What did you see instead?

Program throws no panic in gccgo-12.1.0.

@gopherbot gopherbot added this to the Gccgo milestone May 20, 2022
@seankhliao seankhliao added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label May 20, 2022
@seankhliao
Copy link
Member

cc @ianlancetaylor
did z get optimized away?

@ddaa2000
Copy link
Author

The default or -O0 flag will not trigger this bug, the -O1 and above will trigger it

@ianlancetaylor
Copy link
Contributor

This is a bug in the GCC middle-end. I've sent https://gcc.gnu.org/pipermail/gcc-patches/2022-July/597678.html to fix it.

@ianlancetaylor
Copy link
Contributor

The patch is committed to mainline GCC.

@golang golang locked and limited conversation to collaborators Jul 3, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

No branches or pull requests

4 participants