What version of Go are you using (go version)?
$ go version
go version go1.18beta1 linux/amd64
Does this issue reproduce with the latest release?
Yes, and it's a regression from go1.17.
What operating system and processor architecture are you using (go env)?
go env Output
$ go env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/lizf/.cache/go-build"
GOENV="/home/lizf/.config/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/home/lizf/hny/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/lizf/hny/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/snap/go/current"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/snap/go/current/pkg/tool/linux_amd64"
GOVCS=""
GOVERSION="go1.18beta1"
GCCGO="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-build1152832268=/tmp/go-build -gno-record-gcc-switches"
What did you do?
$ cat badasm.go
package badasm
const _literalsBlockType_name = "literalsBlockRawliteralsBlockRLEliteralsBlockCompressedliteralsBlockTreeless"
$ cat foo_amd64.s
#include "go_asm.h"
$ GO111MODULE=off go build
# _/tmp/repro
go_asm.h:3:39: literal not terminated
./foo_amd64.s:2: missing newline in definition for macro: const__literalsBlockType_name
$ echo $?
2
$ GO111MODULE=off GOROOT=/snap/go/8839 /snap/go/8839/bin/go build
$ echo $?
0
$ go tool compile -asmhdr out.h badasm.go
$ cat out.h
// generated by compile -asmhdr from package badasm
#define const__literalsBlockType_name "literalsBlockRawliteralsBlockRLEliteralsBlockCompressedliteralsBlock...
What did you expect to see?
Successful build, with a properly constructed const__literalsBlockType_name value that is not truncated
What did you see instead?
Failed build, because the string value of const__literalsBlockType_name is never terminated.
What version of Go are you using (
go version)?Does this issue reproduce with the latest release?
Yes, and it's a regression from go1.17.
What operating system and processor architecture are you using (
go env)?go envOutputWhat did you do?
What did you expect to see?
Successful build, with a properly constructed
const__literalsBlockType_namevalue that is not truncatedWhat did you see instead?
Failed build, because the string value of
const__literalsBlockType_nameis never terminated.