Skip to content

runtime/cgo: cannot build with UndefinedBehaviorSanitizer #48121

Closed
@elagergren-spideroak

Description

@elagergren-spideroak

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

$ go version
go version go1.17 linux/amd64

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=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/root/.cache/go-build"
GOENV="/root/.config/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GOVCS=""
GOVERSION="go1.17"
GCCGO="gccgo"
AR="llvm-ar-12"
CC="clang-12"
CXX="clang++-12"
CGO_ENABLED="1"
GOMOD="/build/go.mod"
CGO_CFLAGS="-Wall -Wextra -Werror -fsanitize=undefined,address,integer -fno-sanitize-recover -Wno-unused-parameter"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-Wall -Wextra -Werror -fsanitize=undefined,address,integer -fno-sanitize-recover"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build802210746=/tmp/go-build -gno-record-gcc-switches"

What did you do?

https://play.golang.org/p/gs7sWBhKvCF

What did you expect to see?

It run successfully.

What did you see instead?

gcc_sigaction.c:55:33: runtime error: implicit conversion from type 'int' of value -67108865 (32-bit, signed) to type 'unsigned long' changed the value to 18446744073642442751 (64-bit, unsigned)
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior gcc_sigaction.c:55:33 in

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeNeedsFixThe path to resolution is known, but the work has not been done.

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions