Skip to content

cmd/compile: miscompilation in star-tex.org/x/cmd/star-tex #59432

@sbinet

Description

@sbinet

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

$ go version
go version devel go1.21-f62c9701b4 Tue Apr 4 07:17:19 2023 +0000 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="/home/binet/.cache/go-build"
GOENV="/home/binet/.config/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/home/binet/dev/go/gocode/pkg/mod"
GONOPROXY="gitlab.cern.ch/tile-in-one/tio-go,gitlab.cern.ch/tile-in-one/tio-0021/*"
GONOSUMDB="gitlab.cern.ch/tile-in-one/tio-go,gitlab.cern.ch/tile-in-one/tio-0021/*"
GOOS="linux"
GOPATH="/home/binet/dev/go/gocode"
GOPRIVATE="gitlab.cern.ch/tile-in-one/tio-go"
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/home/binet/sdk/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/home/binet/sdk/go/pkg/tool/linux_amd64"
GOVCS=""
GOVERSION="devel go1.21-f62c9701b4 Tue Apr 4 07:17:19 2023 +0000"
GCCGO="gccgo"
GOAMD64="v1"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/dev/null"
GOWORK=""
CGO_CFLAGS="-O2 -g"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-O2 -g"
CGO_FFLAGS="-O2 -g"
CGO_LDFLAGS="-O2 -g"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/go-build2001148705=/tmp/go-build -gno-record-gcc-switches"

What did you do?

since 1c783f7, star-tex test is failing:

$> cd star-tex.org/x/tex/cmd/star-tex
$> go test
--- FAIL: TestProcess (0.00s)
    --- FAIL: TestProcess/hello.tex (0.00s)
        main_test.go:43: could not process TeX document: xtex.pasError(-2)
FAIL
exit status 1

ie: it was working with Go-1.18.x, but not anymore starting with Go-1.19.x.

What did you expect to see?

a sucessfully working test.

What did you see instead?

a failing test.

bisecting Go, I've found out the first revision of go test that triggered the failing test.

star-tex is relying on web2go to automatically transpile Donald Knuth's WEB tex.web file to Go.
the result is under x/tex/internal/xtex.
it's machine generated so, not super easy on the eye:

the failure is actually coming from:

looking at 1c783f7 CL, a possible hint at the root cause generating this issue might be in how some of the C-trickeries performed in tex.web are translated into Go, meaning "unsafe":

(perhaps the interplay of unsafe.Pointer and uintptr at L145 and L149 ?)

Metadata

Metadata

Assignees

Labels

FrozenDueToAgeNeedsFixThe path to resolution is known, but the work has not been done.compiler/runtimeIssues related to the Go compiler and/or runtime.

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions