aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/compile/testdata
AgeCommit message (Collapse)Author
9 dayscmd/compile/testdata/script/issue77033.txt: make test panicAlex Brainman
The issue77033.txt script is executed by cmd/internal/script/scripttest/run.go program, that uses 60 seconds interrupt timeout. The timeout is implemented by calling os/exec.Cmd.Process.Signal(os.Interrupt) but that call is not implemented on Windows, and we get run.go:259: FAIL: testdata\script\issue77033.txt:2: go test -bench=Foo -pgo=default.pgo: exec: canceling Cmd: not supported by windows useless output when the test fails on Windows. This CL adds -timeout=30s to go test command, that will make test panic. Hopefully panic will provide more details about the failure. For #77485 Change-Id: I69839c59a28f48fea5d504a5038145ffd651aed2 Reviewed-on: https://go-review.googlesource.com/c/go/+/762980 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Keith Randall <khr@golang.org> Auto-Submit: Keith Randall <khr@golang.org> Reviewed-by: Keith Randall <khr@google.com> Reviewed-by: David Chase <drchase@google.com>
2025-12-30cmd/compile: disable inlining for functions using runtime.deferrangefunczuojunwei.1024
The rangefunc rewrite pass implements defer using deferrangefunc and deferproccat. The loop body is rewritten into a closure, it cannot be inlined due to defer call. But the outer function may still be inlined in certain scenarios (e.g., with PGO), leading to the defer executing at the wrong time. Fixes #77033 Change-Id: I4649fad5cd1b65891832523522002d9352711123 Reviewed-on: https://go-review.googlesource.com/c/go/+/732140 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: David Chase <drchase@google.com> Reviewed-by: Cherry Mui <cherryyz@google.com>
2025-09-23cmd/compile: prevent shapifying of pointer shape typeCuong Manh Le
CL 641955 changes the Unified IR reader to not doing shapify when reading reshaping expression, prevent losing of the original type. This is an oversight, as the main problem isn't about shaping during the reshaping process itself, but about the specific case of shaping a pointer shape type. This bug occurs when instantiating a generic function within another generic function with a pointer shape type as type parameter, which will convert `*[]go.shape.T` to `*go.shape.uint8`, resulting in the loss of the original expression's type. This commit changes Unified IR reader to avoid pointer shaping for `*[]go.shape.T`, ensures that the original type is preserved when processing reshaping expressions. Updates #71184 Updates #73947 Fixes #74260 Fixes #75461 Change-Id: Icede6b73247d0d367bb485619f2dafb60ad66806 Reviewed-on: https://go-review.googlesource.com/c/go/+/704095 Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: David Chase <drchase@google.com> Reviewed-by: Junyang Shao <shaojunyang@google.com>
2025-06-09cmd/compile: relax reshaping conditionCuong Manh Le
CL 641955 changes the Unified IR reader to not doing shapify when reading reshaping expression. However, this condition only matters with pointer type shaping, which will lose the original type, causes the reshaping ends up with a completely different type. This CL relaxes the condition, always allow non-pointer types shaping. Updates #71184 Fixes #73947 Change-Id: Ib0bafd8932c52d99266f311b6cbfc75c00383f9b Reviewed-on: https://go-review.googlesource.com/c/go/+/678335 Reviewed-by: Keith Randall <khr@golang.org> Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com> Reviewed-by: Keith Randall <khr@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Carlos Amedee <carlos@golang.org>
2025-04-13cmd: fix DWARF gen bug with packages that use assemblyThan McIntosh
When the compiler builds a Go package with DWARF 5 generation enabled, it emits relocations into various generated DWARF symbols (ex: SDWARFFCN) that use the R_DWTXTADDR_* flavor of relocations. The specific size of this relocation is selected based on the total number of functions in the package -- if the package is tiny (just a couple funcs) we can use R_DWTXTADDR_U1 relocs (which target just a byte); if the package is larger we might need to use the 2-byte or 3-byte flavor of this reloc. Prior to this patch, the strategy used to pick the right relocation size was flawed in that it didn't take into account packages with assembly code. For example, if you have a package P with 200 funcs written in Go source and 200 funcs written in assembly, you can't use the R_DWTXTADDR_U1 reloc flavor for indirect text references since the real function count for the package (asm + go) exceeds 255. The new strategy (with this patch) is to have the compiler look at the "symabis" file to determine the count of assembly functions. For the assembler, rather than create additional plumbing to pass in the Go source func count we just use an dummy (artificially high) function count so as to select a relocation that will be large enough. Fixes #72810. Updates #26379. Change-Id: I98d04f3c6aacca1dafe1f1610c99c77db290d1d8 Reviewed-on: https://go-review.googlesource.com/c/go/+/663235 Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: David Chase <drchase@google.com>
2024-11-05cmd/compile: fix an internal crash in embedRuss Cox
Observed in the telemetry data. Was causing truncated error outputs. Change-Id: I9f0a86e1e6caa855f97a3d6e51328c4c9685c937 Reviewed-on: https://go-review.googlesource.com/c/go/+/623535 Reviewed-by: Cherry Mui <cherryyz@google.com> Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com> Reviewed-by: Robert Griesemer <gri@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Russ Cox <rsc@golang.org>
2024-11-04cmd/compile: fix mis-compilation with labeled fallthroughCuong Manh Le
A fallthrough statement can be a labeled fallthrough per Go spec. However, the hasFallthrough function is not considering this case, causing mis-compilation. Fixing this by un-wrapping (possible nested) labeled fallthrough statements if any. Fixes #70173 Change-Id: Ic93d4fb75ff02703a32dfc63c3e84a8b7f78c261 Reviewed-on: https://go-review.googlesource.com/c/go/+/624717 Reviewed-by: Cherry Mui <cherryyz@google.com> Reviewed-by: Keith Randall <khr@google.com> Reviewed-by: Keith Randall <khr@golang.org> Reviewed-by: Youlin Feng <fengyoulin@live.com> Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-07-31cmd: add README generation for compiler + linker script testsThan McIntosh
Add in automatic README generation and README consistency checking for the cmd/compile and cmd/link script tests. This code is adapted from the similar facility in cmd/go (e.g. scriptreadme_test.go); the README helps folks writing new tests understand the mechanics. Updates #68606. Change-Id: I8ff7ff8e814abd4385bd670440511b2c60a4cef6 Reviewed-on: https://go-review.googlesource.com/c/go/+/601756 Reviewed-by: Cherry Mui <cherryyz@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-07-31cmd/internal/script: new hook for adding in toolchain script conditionsThan McIntosh
Introduce a new function AddToolChainScriptConditions that augments a default "script.Cond" set with a collection of useful conditions, including godebug/goexperiment, cgo, race support, buildmode, asan, msan, and so on. Having these conditions available makes it easier to write script tests that deal with specific build-flavor corner cases. The functions backing the new conditions are helper functions migrated over from the Go command's script test setup. Updates #68606. Change-Id: I14def1115b54dc47529c983abcd2c5ea9326b9de Reviewed-on: https://go-review.googlesource.com/c/go/+/601715 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Cherry Mui <cherryyz@google.com>
2024-07-29cmd/compile: add script testing facility for compiler useThan McIntosh
Add support for running script tests as part of the compiler's suite of tests, hooking in the script test engine packages recently moved from cmd/go to cmd/internal. These script tests will use the test binary itself as the compile tool for Go builds, and can also run the C compiler if needed. New script test cases (*.txt files) should be added to the directory cmd/compile/testdata/script. Updates #68606. Change-Id: I9b056a07024b0a72320a89ad734e4b4a51f1c10c Reviewed-on: https://go-review.googlesource.com/c/go/+/601361 Reviewed-by: Cherry Mui <cherryyz@google.com> Reviewed-by: David Chase <drchase@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>