GoPatina

GoPatina correctness: differential tests against Go

A program compiled through Rust is only useful if it does exactly what the Go program does. GoPatina checks that by differential testing: the same program is built with Go's reference build (go build -gcflags=all=-N -l, optimization and inlining off) and with gopatina build -patina, and both must print the same standard output, the same first line of standard error, and exit with the same status.

The Six Sigma bar

The bar is at most 3.4 defects per million tests, the Six Sigma rate, shown at 6σ confidence: 0 defects in at least 6,099,050 generated tests. On the way there, 0 defects in 881,098 tests show the same rate at 95% confidence, a milestone. Both runs are pending on the test server. The hypotheses and formulas are in the evidence.

How programs are checked

Defects found so far

FoundDefectFixed
2026-11-21, by handmake with a negative length known only at run time panicked with Rust's message instead of Go'swith five golden programs
2026-11-22, by the generated tests on the test serveran expression such as a*b << 27 whose left side ended in a conversion did not compile as Rustwith a golden program and a generator case
2026-11-22, by new generator cases, before they were mergeda shift by a constant at least the operand's width (x << 70, or b >> 8 for a byte) gave Rust's result instead of Go's 0 or −1with a golden program and generator cases
2026-11-22, by hand, while planning RFC 0008a float-to-integer conversion gave Rust's saturated result where Go's compiler gives another: NaN and out-of-range values, and uint8(-2.5), which is 254 in Gowith a golden program and generator cases
2026-11-22, by those generator cases, before they were mergeda float whose shortest digits have two equally close candidates printed the upper one (1.2848823997124483e+15) where Go prints the even one (...482e+15)with a golden program
2026-11-22, by hand, while adding fmt flagsa width on a slice (%6v of []int) padded the whole slice, where Go pads each element ([ 1 -20])with a golden program and generator cases
2026-11-22, by hand, while adding RFC 0008's typesa slice literal printed or measured without a type from its context (fmt.Println([]int{1 << 40})) did not compile: Rust took its constants as 32-bitwith a golden program

When Go itself is wrong

On 2026-11-22 the generated tests reported two programs where GoPatina's output differed from go build's. Both times GoPatina was right: the optimized gc build on amd64 (one program from Go 1.22.0, the other from Go 1.26.0, both up to 1.27.1, the newest tested) printed a result that contradicts the language specification and a hand calculation, while gc with optimization and inlining off agreed with GoPatina. A test whose oracle can be wrong measures the oracle too, so the oracle is now Go's reference build, go build -gcflags=all=-N -l. Every batch is still built optimized as well, and a program whose two Go builds disagree is recorded and kept for review as a Go compiler disagreement, never counted as a GoPatina defect and never silently passed. Both programs, reduced, are golden tests. A third disagreement, found the same day, led to the cause of all three: one rule in gc's amd64 back end folds x + 2^31 + 2^31 into x + 0, wrong in every release tested from Go 1.21.0 to 1.27.1. A gc built with that rule fixed gets all three programs right. It is reported upstream as golang/go#83292.

A defect found is a defect the bar's run would also have counted, so the long run starts again from the beginning with each fixed compiler. Development smoke runs (1,318 generated tests on a laptop, 0 defects) are far below the bar and are not evidence for it.

See the benchmarks for speed, and the feature matrix for what the subset covers.