For #46279
For #51713
Change-Id: I444f309999bf5576449a46a9808b23cf6537e7dd
Reviewed-on: https://go-review.googlesource.com/c/go/+/394094
Trust: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Joel Sing <joel@sing.id.au>
Same information is provided from the fields of the embedded
goobj.Reader, and are accessed through it. Delete the flags field.
Change-Id: I7a4f5dca054e567443d719b2931fceff231d6efc
Reviewed-on: https://go-review.googlesource.com/c/go/+/394216
Trust: Cherry Mui <cherryyz@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
Also change the relevant test to be tested on the linux-arm64 platform
as well.
Fixes#49789
Change-Id: Id2eac7a45279f037957442862f8ed63838b8e929
Reviewed-on: https://go-review.googlesource.com/c/go/+/366855
Trust: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Trust: Than McIntosh <thanm@google.com>
Run-TryBot: Than McIntosh <thanm@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Now that the go/types and types2 test files end in .go we must
avoid trying to format them as that won't work in general.
Change-Id: I05fdd95a0d26cbe746f6d618b22b48dc1f1ea749
Reviewed-on: https://go-review.googlesource.com/c/go/+/394295
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
First law of cmd/compile frontend development: thou shalt not rely on
types.Sym.
This CL replaces Type.OrigSym with Type.OrigType, which semantically
matches what all of the uses within the frontend actually care about,
and avoids using types.Sym, which invariably leads to mistakes because
symbol scoping in the frontend doesn't work how anyone intuitively
expects it to.
Fixes#51765.
Change-Id: I4affe6ee0718103ce5006ab68aa7e1bb0cac6881
Reviewed-on: https://go-review.googlesource.com/c/go/+/394274
Trust: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
The type checker implements additional built-in functions (assert
and trace) that are useful for debugging. Only permit them in
manual tests (go test -run Manual), not for other tests where they
are not needed.
Change-Id: Idc7723d9e3f6b2c27769b34743561e9d0339565c
Reviewed-on: https://go-review.googlesource.com/c/go/+/393659
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
Also, manually renamed some irregularly numbered files to
make their file names more regular.
With this rename, all test files now end uniformly in .go.
go fmt doesn't descend into testdata directories, so this
is fine and makes all test files behave like regular .go
files in editors with Go language support.
Change-Id: I3abde32c35c494b94b17787788cd3d7e35662296
Reviewed-on: https://go-review.googlesource.com/c/go/+/393658
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
We don't need the distinction anymore.
Also, made corresponding adjustments to check_test.go.
Change-Id: I3c9a768c16a251d76bc6b3ebabd37822773e4ef5
Reviewed-on: https://go-review.googlesource.com/c/go/+/393657
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
Use it so set the language version. Adjust relevant tests.
Fixes#49074.
Change-Id: Ida6d0002bdba65b5add6e8728a1700305de18351
Reviewed-on: https://go-review.googlesource.com/c/go/+/393514
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
The unified build will become the norm and the excluded tests run now.
Change-Id: I0f0873eb73483a4f04736d167d2eb796ee8a857b
Reviewed-on: https://go-review.googlesource.com/c/go/+/393438
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
This change fine-tunes tracing output and adds additional
descriptions for delayed actions that were missing tracing.
Change-Id: Ib5e70e8f40ef564194cdb0e8d12c38e15388b987
Reviewed-on: https://go-review.googlesource.com/c/go/+/387919
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
This addresses a situation where Named.fromRHS is nil which
is causing validType to panic when the debug flag is set.
Change-Id: Ie1af3f4d412efc2ce2ee7707af5375ed130a1f2a
Reviewed-on: https://go-review.googlesource.com/c/go/+/393436
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
With all the unification/type-inference fixes in place now, we
should not see stack overflows anymore. Re-enable the panic if
we do overflow, so we can address those issues should they arise.
Fixes#51377.
Change-Id: Ied64435ea5936811504cb30bda1126c7d85980f8
Reviewed-on: https://go-review.googlesource.com/c/go/+/392755
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
These fields were used for tracking the last scope/position that an
identifier was declared, so that we could report redeclaration
errors. However, redeclaration errors are now diagnosed by types2 (and
typecheck.Redeclared was removed in CL 388537), so these fields can be
safely pruned.
Updates #51691.
Change-Id: Ifd5ea3f6795fadb420913298d59287c95e4669a1
Reviewed-on: https://go-review.googlesource.com/c/go/+/394276
Trust: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
While building Go from source, workspace mode should be disabled,
even if the external environment tries to configure it otherwise.
Fixes#51558.
Change-Id: Icd7577860271f59a8f94406214b111280e4b65b5
Reviewed-on: https://go-review.googlesource.com/c/go/+/393879
Trust: Dmitri Shuralyov <dmitshur@golang.org>
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
The ELF compression header(Chdr) has Addralign field that is set to the
alignment of the uncompressed section which makes section able to have
a different alignment than the decompressed section. However `file` and
other tools require both Chdr.Addralign and Addralign to be equal.
Ref https://sourceware.org/bugzilla/show_bug.cgi?id=23919
Related #42136Fixes#51769
Change-Id: I3cf99dbd2359932576420a3c0d342c7e91b99227
Reviewed-on: https://go-review.googlesource.com/c/go/+/393916
Trust: mzh <mzh@golangcn.org>
Reviewed-by: Alessandro Arzilli <alessandro.arzilli@gmail.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Fangrui Song <maskray@google.com>
In last cycle we developed register ABI for ARM64, enabled by
default as a GOEXPERIMENT. This cycle we turn it on all the time.
Later CLs will clean up fallback code.
Change-Id: Idac4dcff634791cbc3d30988052ecd742b55ab8b
Reviewed-on: https://go-review.googlesource.com/c/go/+/394214
Trust: Cherry Mui <cherryyz@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
To pick up CL 394234.
Done by
go get -d golang.org/x/tools@c717623e3197
go mod tidy
go mod vendor
Change-Id: Ic67a7deb9a22b2679eec895210168f698d8d05eb
Reviewed-on: https://go-review.googlesource.com/c/go/+/394275
Trust: Cherry Mui <cherryyz@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
CL 342350 fixed deadcode panic with dead hidden closures. However, a
closure may contains nested dead hidden closures, so we need to mark
them dead as well.
Fixes#51839
Change-Id: Ib54581adfc1bdea60e74d733cd30fd8e783da983
Reviewed-on: https://go-review.googlesource.com/c/go/+/394079
Trust: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Tweak the (*Data).parseUnits method to check a bit more carefully for
buffer read errors, so as to avoid infinite looping on malformed
inputs.
Fixes#51758.
Updates #47653.
Change-Id: I6d67fcb53392acf651ceec636789ab9e49ad5a5c
Reviewed-on: https://go-review.googlesource.com/c/go/+/393874
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Trust: Than McIntosh <thanm@google.com>
Run-TryBot: Than McIntosh <thanm@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
When developing register ABI, for early testing the compiler
recognized a few magic names to trigger enabling register ABI.
After the development it is disabled (changed to a name that
cannot be spelled in the source code). Later in the development of
register ABI for ARM64 and PPC64, I don't think the magic names
were used. I think they can now be removed.
Keep the magic pragma for now in case it helps development.
Change-Id: Icbc34e2786a80fd8fffe4a464c569dc03a54cd09
Reviewed-on: https://go-review.googlesource.com/c/go/+/393877
Trust: Cherry Mui <cherryyz@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
CL 372774 is for reflect, this CL is for internal/reflectlite.
Updates #50208
Change-Id: Ib7e8b1bc031feab218d1addd78388fcfe9b675b5
Reviewed-on: https://go-review.googlesource.com/c/go/+/393918
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
Trust: Daniel Martí <mvdan@mvdan.cc>
This CL adds some initial support for spilling and reloading
registers in the new ABI for RISCV64.
Change-Id: I5e2b4d93c33c528809d569e5a442bb302074be78
Reviewed-on: https://go-review.googlesource.com/c/go/+/360215
Reviewed-by: Cherry Mui <cherryyz@google.com>
Trust: mzh <mzh@golangcn.org>
Run-TryBot: mzh <mzh@golangcn.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
CL 392918 changed n.Diag() to always return false, we can now get rid
of all its deadcode paths.
Updates #51691
Change-Id: I64c07970493e7bdcf89df9508ce88132ef4aa4d7
Reviewed-on: https://go-review.googlesource.com/c/go/+/393915
Trust: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
CL 392918 changed t.Broke() to always return false, we can now get rid
of all its deadcode paths.
Updates #51691
Change-Id: I0a2a13def07364e780e4785621690452948e219a
Reviewed-on: https://go-review.googlesource.com/c/go/+/393914
Trust: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
The -trimpath flag has a strong effect on the resulting binary:
in particular, it determines whether runtime.GOROOT can report
a meaningful path in the absence of an explicit GOROOT environment variable.
For #51461
Change-Id: Id0d55572c0a0a4e2e4724363ed80dfa05b202186
Reviewed-on: https://go-review.googlesource.com/c/go/+/391810
Trust: Bryan Mills <bcmills@google.com>
Reviewed-by: Russ Cox <rsc@golang.org>
Run-TryBot: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Also update cmd/dist to avoid setting gcflags and ldflags explicitly
when the set of flags to be set is empty (a verbose way of specifying
the default behavior).
Stamping was disabled for the Go standard library in CL 356014 due to
the cmd/dist flags causing cmd/go to (correctly) report the resulting
binaries as stale.
With cmd/dist fixed, we can also remove the special case in cmd/go,
which will allow tests of binaries in 'cmd' to read the build info
embedded in the test binary. That build info may be useful to
determine (say) whether runtime.GOROOT ought to work without GOROOT
set in the environment.
For #51483
Updates #37475
Change-Id: I64d04f5990190094eb6c0522db829d3bdfa50ef3
Reviewed-on: https://go-review.googlesource.com/c/go/+/391809
Trust: Bryan Mills <bcmills@google.com>
Run-TryBot: Bryan Mills <bcmills@google.com>
Reviewed-by: Russ Cox <rsc@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
This fixes a build failure due to inability to locate the "vet" tool
when the test binary is built with -trimpath.
Updates #51461
Change-Id: I81838cc8842e4ff7900cab81af60501ebba86ff1
Reviewed-on: https://go-review.googlesource.com/c/go/+/391808
Trust: Bryan Mills <bcmills@google.com>
Run-TryBot: Bryan Mills <bcmills@google.com>
Reviewed-by: Russ Cox <rsc@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Previously, we called path.Clean on the value of runtime.GOROOT() even
if it was empty, which would set it explicitly to ".".
That would cause (*Context).importGo to assume that errors resolving
paths in GOROOT are fatal and return early:
https://cs.opensource.google/go/go/+/master:src/go/build/build.go;l=1121-1127;drc=38174b3a3514629b84dcd76878b2f536b189dd7b
If we instead leave it empty (and are in module mode), then importGo
will fall back to letting the 'go' command resolve the path, which may
succeed if the 'go' command can infer the correct GOROOT (from its own
stamped-in default GOROOT or executable path).
Fixes#51483
Change-Id: I44dce7cec6c3d1c86670e629ddfbca8be461130c
Reviewed-on: https://go-review.googlesource.com/c/go/+/391805
Trust: Bryan Mills <bcmills@google.com>
Run-TryBot: Bryan Mills <bcmills@google.com>
Reviewed-by: Russ Cox <rsc@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
This fixes many (but not all) of the tests that currently fail
(due to a bogus path reported by runtime.GOROOT) when run with
'go test -trimpath std cmd'.
Updates #51461
Change-Id: Ia2cc05705529c4859e7928f32eeceed647f2e986
Reviewed-on: https://go-review.googlesource.com/c/go/+/391806
Trust: Bryan Mills <bcmills@google.com>
Run-TryBot: Bryan Mills <bcmills@google.com>
Reviewed-by: Russ Cox <rsc@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Previously, runtime.GOROOT() would return the string "go" in a binary
build with -trimpath. This change stamps the empty string instead,
using a sentinel value passed from cmd/go that looks like the GOROOT
environment variable (either "$GOROOT" or "%GOROOT%", depending on the
platform).
Fixes#51461
Change-Id: I1f10ef2435016a7b6213bd8c547df911f7feeae7
Reviewed-on: https://go-review.googlesource.com/c/go/+/390024
Trust: Bryan Mills <bcmills@google.com>
Run-TryBot: Bryan Mills <bcmills@google.com>
Reviewed-by: Russ Cox <rsc@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
In the beginning the Go compiler was in C, and C had a function
'getgoroot' that returned GOROOT from either the environment or a
generated constant. 'getgoroot' was mechanically converted to Go
(as obj.Getgoroot) in CL 3046.
obj.Getgoroot begat obj.GOROOT. obj.GOROOT begat objabi.GOROOT,
which begat buildcfg.GOROOT.
As far as I can tell, today's buildcfg.GOROOT is functionally
identical to runtime.GOROOT(). Let's reduce some complexity by
defining it in those terms.
While we're thinking about buildcfg.GOROOT, also check whether it is
non-empty: if the toolchain is built with -trimpath, the value of
GOROOT might not be valid or meaningful if the user invokes
cmd/compile or cmd/link directly, or via a build tool other than
cmd/go that doesn't care as much about GOROOT. (As of CL 390024,
runtime.GOROOT will return the empty string instead of a bogus one
when built with -trimpath.)
For #51461.
Change-Id: I9fec020d5fa65d4aff0dd39b805f5ca93f86c36e
Reviewed-on: https://go-review.googlesource.com/c/go/+/393155
Trust: Bryan Mills <bcmills@google.com>
Run-TryBot: Bryan Mills <bcmills@google.com>
Reviewed-by: Russ Cox <rsc@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Invoking a VCS tool requires that the VCS tool be installed, and also
adds latency to build commands. Unfortunately, we had been mistakenly
loading VCS metadata for tests of "main" packages.
Users almost never care about versioning for test binaries, because
'go test' runs the test in the source tree and test binaries are only
rarely used outside of 'go test'. So the user already knows exactly
which version the test is built against, because the source code is
right there — it's not worth the overhead to stamp.
Fixes#51723.
Change-Id: I96f191c5a765f5183e5e10b6dfb75a0381c99814
Reviewed-on: https://go-review.googlesource.com/c/go/+/393894
Trust: Bryan Mills <bcmills@google.com>
Run-TryBot: Bryan Mills <bcmills@google.com>
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
Trust: Daniel Martí <mvdan@mvdan.cc>
TryBot-Result: Gopher Robot <gobot@golang.org>
When the test binary is built with the -trimpath flag,
runtime.GOROOT() is invalid, and must not be used to locate
GOROOT/lib/time/zoneinfo.zip. (We can use other sources instead.)
However, the test for the package expects zoneinfo.zip to definitely
exist. 'go test' runs the test binary in the directory containing its
source code — in this case GOROOT/src/time — so we can use that
information to find the zoneinfo.zip file when runtime.GOROOT isn't
available.
For #51483
Change-Id: I9de35252a988d146b5d746794323214d400e64e5
Reviewed-on: https://go-review.googlesource.com/c/go/+/391814
Trust: Bryan Mills <bcmills@google.com>
Run-TryBot: Bryan Mills <bcmills@google.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
For #51698
Change-Id: Ifc5bef2cc41b163644ac80ace7c1470c8a130467
Reviewed-on: https://go-review.googlesource.com/c/go/+/393700
Trust: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Eli Bendersky <eliben@golang.org>
They should not share a shape with regular pointers. We could coalesce
multiple pointer-to-not-in-heap types, but doesn't seem worth it - just
make them fully stenciled.
Fixes#51733
Change-Id: Ie8158177226fbc46a798e71c51897a82f15153df
Reviewed-on: https://go-review.googlesource.com/c/go/+/393895
Trust: Keith Randall <khr@golang.org>
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
go get github.com/google/pprof@latest
go mod vendor
Plus a tiny change to the pprof command to match an upstream interface
change.
Updates #36905.
Change-Id: I4c7bbe8c317a6eeb217fce971b208f96ab0727fa
Reviewed-on: https://go-review.googlesource.com/c/go/+/393370
Trust: Heschi Kreinick <heschi@google.com>
Run-TryBot: Heschi Kreinick <heschi@google.com>
Auto-Submit: Heschi Kreinick <heschi@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Heschi Kreinick <heschi@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>