This change essentially matches the 1.17 compiler error message for
this error.
Fixes#51877.
Change-Id: I24ec2f9cc93d8cd2283d097332a39bc1a0eed3a1
Reviewed-on: https://go-review.googlesource.com/c/go/+/394914
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
The code iterates through the func table to find a function with
a given file and line number. The code panics if it sees a non-
real function (e.g. go.buildid), because its CU offset is -1,
which causes an index-out-of-bounds error. The debug/gosym package
recovers the panic and returns "not found", without looping
through the rest of the entries.
Skip the non-real functions. They cannot be looked up by line
number anyway.
Fixes#51890.
Change-Id: I96f64c17b4a53ffdce047c8244b35a402a0d39ac
Reviewed-on: https://go-review.googlesource.com/c/go/+/395074
Trust: Cherry Mui <cherryyz@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Jeremy Faller <jeremy@golang.org>
For a non-generic defined type, we generate its type descriptor
symbol only in the defining package. So there is no duplicate and
it doesn't need to be dupok.
For unnamed types and instantiated types, the type descriptor can
be generated in multiple packages and so still need to be dupok.
Change-Id: I92ed68c998ad68c5917b77b1dfd62eac4ced6bcf
Reviewed-on: https://go-review.googlesource.com/c/go/+/394636
Trust: Cherry Mui <cherryyz@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
With the previous CL the compiler emits an unlinkable object if
the -p flag is not specified. It is actually okay (and convenient)
to omit the -p flag for (just) the main package. This CL makes it
so.
Change-Id: I978d54d14c45b3bb9ed7471e40a2c47f269b56f7
Reviewed-on: https://go-review.googlesource.com/c/go/+/394834
Trust: Cherry Mui <cherryyz@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
The importer type param index used package name type parameter key,
causing type parameters to be reused/overwritten if two packages in the
import graph had the same combination of (name, declaration name, type
parameter name).
Fix this by instead using the *Package in the key.
Fixes#51836
Change-Id: I881ceaf3cf7c1ab4e0835962350feb552e79b233
Reviewed-on: https://go-review.googlesource.com/c/go/+/394219
Trust: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
Restructure TestCPUProfileMultithreadMagnitude so it will run again with
a longer duration on failure. Log the split between the user vs system
CPU time that rusage reports.
For #50232
Change-Id: Ice5b38ee7594dbee1eaa5686d32b968c306e3e85
Reviewed-on: https://go-review.googlesource.com/c/go/+/393934
Run-TryBot: Rhys Hiltner <rhys@justin.tv>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Michael Pratt <mpratt@google.com>
Trust: Michael Knyszek <mknyszek@google.com>
For unlinkable object the link will fail, but it opens the output
file in writable mode first then delete it on failure. This fails
if the current directory is not writable. Write to the temporary
directory instead.
Change-Id: Iefd73b5cc8efdc0f11b12edc0920169a8ad3f37c
Reviewed-on: https://go-review.googlesource.com/c/go/+/394755
Trust: Cherry Mui <cherryyz@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
The glibc loader explicitly sets the first doubleword on the stack (R1)
to $0 to indicate it was dynamically loaded.
An ELFv2 ABI compliant loader will set R3/R4 to argc/argv when starting
the process, and R13 to TLS. musl is not compliant. Instead it passes
argc/argv like the kernel, but R3/R4 are in an undefined state and R13
is valid.
With the knowledge above, the startup code can be modified to
dynamically handle all three cases when linked internally.
Fixes#51787
Change-Id: I5de33862c161900d9161817388bbc13a65fdc69c
Reviewed-on: https://go-review.googlesource.com/c/go/+/394654
Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: Paul Murphy <murp@ibm.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Trust: Paul Murphy <murp@ibm.com>
Trust: Lynn Boger <laboger@linux.vnet.ibm.com>
The TPIDR macro in tls_arm64.h is not used anywhere, so remove it
to reduce confusion.
Change-Id: I04aa5e64ee30753f28f43bc67b44559d81d093c1
Reviewed-on: https://go-review.googlesource.com/c/go/+/373357
Trust: Eric Fang <eric.fang@arm.com>
Run-TryBot: Eric Fang <eric.fang@arm.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Michael Pratt <mpratt@google.com>
Symbol's content hash used to depend on package path expansion in
symbol names, so we have special logic handling hashed symbols
when path expansion is needed. As we required -p in the compiler
the symbol names are now fully expanded. Remove that logic.
Change-Id: I888574f63ea3789455d96468a6abd500e0958230
Reviewed-on: https://go-review.googlesource.com/c/go/+/394218
Trust: Cherry Mui <cherryyz@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
CL 391014 requires the compiler to be invoked with the -p flag, to
specify the package path. People are used to run "go tool compile"
from the command line with the -p flag. This is mostly for simple
testing, or debugging the compiler. The produced object file is
almost never intended to be linked.
This CL makes the compiler allow "go tool compile" without the -p
flag again. It will produce an unlinkable object. If the linker
sees such an object it will error out.
Change-Id: I7bdb162c3cad61dadd5c456d903b92493a3df20f
Reviewed-on: https://go-review.googlesource.com/c/go/+/394217
Trust: Cherry Mui <cherryyz@google.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
This makes the short link discoverable.
Change-Id: I9a2f091652bc096feebbbd79a854aa68efe702bb
Reviewed-on: https://go-review.googlesource.com/c/go/+/394634
Trust: Austin Clements <austin@google.com>
Reviewed-by: Eli Bendersky <eliben@golang.org>
ParseMultipartForm relies on a valid multipartReader, if the request body is nil,
the multipartReader should return an error. This way ParseMultipartForm can return
an error instead of causing mr.ReadForm(maxMemory) to panic
Fixes#48206
Change-Id: Ief906f2340c7ab29cacbd5f56892117202a0b911
Reviewed-on: https://go-review.googlesource.com/c/go/+/384454
Trust: Damien Neil <dneil@google.com>
Run-TryBot: Damien Neil <dneil@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Trust: Brad Fitzpatrick <bradfitz@golang.org>
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>