1
0
mirror of https://github.com/golang/go synced 2024-09-29 03:14:29 -06:00
Commit Graph

53065 Commits

Author SHA1 Message Date
Bryan C. Mills
a42573c2f1 net: avoid darwin/arm64 platform bug in TestCloseWrite
On darwin_arm64, reading from a socket at the same time as the other
end is closing it will occasionally hang for 60 seconds before
returning ECONNRESET. (This is a macOS issue, not a Go issue.)

Work around this condition by adding a brief sleep before the read.

Fixes #49352 (we hope).
Updates #37795.

Change-Id: I4052aec21d311d7370550aea9dd7941f39141133
Reviewed-on: https://go-review.googlesource.com/c/go/+/414534
Run-TryBot: Bryan Mills <bcmills@google.com>
Auto-Submit: Bryan Mills <bcmills@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-06-27 18:18:08 +00:00
SemihBKGR
68289f39f0 html/template: fix typo in content_test.go
esacped -> escaped

Change-Id: I253c46b30bb1cf7cdfb4668628907d16428fefb9
GitHub-Last-Rev: accd0e089f
GitHub-Pull-Request: golang/go#53553
Reviewed-on: https://go-review.googlesource.com/c/go/+/414274
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
Run-TryBot: Ian Lance Taylor <iant@google.com>
2022-06-27 17:04:56 +00:00
Than McIntosh
c3bea70d9b cmd/link: link against libsynchronization.a for -race on windows
As of LLVM rev 41cb504b7c4b18ac15830107431a0c1eec73a6b2, the
race detector runtime now refers to things in the windows
synchronization library, hence when doing windows internal
linking, at that library to the list of host archives that
we visit. The tsan code that makes the reference is here:

41cb504b7c/compiler-rt/lib/sanitizer_common/sanitizer_win.cpp (L48)
41cb504b7c/compiler-rt/lib/sanitizer_common/sanitizer_win.cpp (L834)

Note that libsynchronization.a is not guaranteed to be available on
all windows systems, so in the external linking case, check for its
existence before adding "-lsynchronization" to the external linker
args.

Updates #53539.

Change-Id: I433c95c869915693d59e9c1082d5b8a11da1fc8c
Reviewed-on: https://go-review.googlesource.com/c/go/+/413817
Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: Than McIntosh <thanm@google.com>
2022-06-27 16:28:25 +00:00
Ian Lance Taylor
f093cf90bf test: add test that caused gofrontend crash
For #52871

Change-Id: Id6102222a8b1ec8a84b716425bed0e349c65dbc4
Reviewed-on: https://go-review.googlesource.com/c/go/+/414336
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
2022-06-27 16:13:35 +00:00
Ian Lance Taylor
155612a9b9 test: add test that caused gofrontend crash
The gofrontend crashed importing a complex 0 constant.

For #52862

Change-Id: Ia87d8eadb9c5ddf51e1cd65c1a626f05f0d068d4
Reviewed-on: https://go-review.googlesource.com/c/go/+/413980
Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
2022-06-27 16:12:51 +00:00
Michael Pratt
a861eee51a cmd/go: compile runtime/internal/syscall as a runtime package
runtime/internal/syscall is a runtime package, so it should be built
with -+.

Specifically, we don't want libfuzzer instrumentation in Go functions
defined in runtime/internal/syscall, which is disabled with -+.

For #53190.

Change-Id: I9f16f5c7c7ce10b98371e9de82fcea6da854e163
Reviewed-on: https://go-review.googlesource.com/c/go/+/413818
Run-TryBot: Michael Pratt <mpratt@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-06-27 14:35:57 +00:00
Russ Cox
8f9bfa9b7b crypto/internal/boring: factor Cache into crypto/internal/boring/bcache
Requested by the maintainers of the OpenSSL-based fork of Go+BoringCrypto,
to make maintaining that fork easier.

Change-Id: I770e70ecc12b589034da31edecf59c73b2c6e1dd
Reviewed-on: https://go-review.googlesource.com/c/go/+/407135
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Russ Cox <rsc@golang.org>
2022-06-27 11:50:31 +00:00
Ian Lance Taylor
351e0f4083 runtime: avoid fma in mkfastlog2table
This lets us generate identical copies of fastlog2table.go on all hosts.

Tested by regenerating fastlog2table.go on linux-amd64 and darwin-arm64.

Fixes #49891

Change-Id: I279d6b5abb5a5290c049d9658050fd9c8d0c0190
Reviewed-on: https://go-review.googlesource.com/c/go/+/413976
Run-TryBot: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Ian Lance Taylor <iant@google.com>
2022-06-26 22:12:19 +00:00
Ian Lance Taylor
416c953960 test: add test that gofrontend gets wrong
For #52856

Change-Id: Iab3e8352f64d774058391f0422cd01c53c3e711d
Reviewed-on: https://go-review.googlesource.com/c/go/+/414235
Reviewed-by: Robert Griesemer <gri@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
2022-06-26 00:26:59 +00:00
Robert Griesemer
666d736ecb cmd/compile: do branch/label checks only once
The previous change implemented the missing fallthrough checking
in the parser. Therefore we can now disable the duplicate check
in the type checker:

- rename (types2.Config.)IngoreLabels to IgnoreBranches to more
  accurately reflect its functionality

- now also ignore break/continue/fallthroughs, not just labels

The IgnoreBranches flag only exists for types2, for use with
the compiler. There's no need to port this code to go/types.

Note: An alternative (and perhaps better) approach would be
to not use the the parser's CheckBranches mode and instead
enable (i.e. not disable) the branch/label checking in the
type checker. However, this requires a bit more work because
the type checker's error messages about goto's jumping over
variables don't have access to the variable names, which are
desired in the error messages.

Fixes #51456.

Change-Id: Ib2e71e811d4e84e4895b729646e879fd43b12dcd
Reviewed-on: https://go-review.googlesource.com/c/go/+/414135
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
2022-06-26 00:21:33 +00:00
Robert Griesemer
6b309be7ab cmd/compile/internal/syntax: check fallthrough in CheckBranches mode
The parser CheckBranches mode checked correct use of break, continue,
and labels, but not of fallthrough statements.

This CL adds checking of fallthrough statements as well.

For #51456.

Change-Id: I5000388011973724f80c59a6aaf015e3bb70faea
Reviewed-on: https://go-review.googlesource.com/c/go/+/414134
Reviewed-by: Robert Griesemer <gri@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
2022-06-26 00:21:29 +00:00
Khaled Yakdan
1821639b57 runtime: mark string comparison hooks as no split
These functions can be inserted by the compiler into the code to be
instrumented. This may result in these functions having callers that
are nosplit. That is why they must be nosplit.

This is a followup for CL 410034 in order to fix #53190.

Change-Id: I03746208a2a302a581a1eaad6c9d0672bb1e949a
GitHub-Last-Rev: 6506d86f22
GitHub-Pull-Request: golang/go#53544
Reviewed-on: https://go-review.googlesource.com/c/go/+/413978
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
2022-06-25 21:33:56 +00:00
HowJMay
3b594b9255 io: clarify SeekEnd offset value
fixes #53474

Change-Id: I14c3dc800dc27233630a54592328bb0df1bbaa5d
GitHub-Last-Rev: 46f93cfbd4
GitHub-Pull-Request: golang/go#53505
Reviewed-on: https://go-review.googlesource.com/c/go/+/413614
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Emmanuel Odeke <emmanuel@orijtech.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
2022-06-25 19:08:51 +00:00
qmuntal
4f45ec5963 cmd/go: prepend builtin prolog when checking for preamble errors
Fixes #50710

Change-Id: I62feddbe3eaae9605d196bec60d378614436603a
Reviewed-on: https://go-review.googlesource.com/c/go/+/379754
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
2022-06-25 19:07:01 +00:00
Rémy Oudompheng
41e1d9075e strconv: avoid panic on invalid call to FormatFloat
Calling FormatFloat with an invalid value of fmt is expected
to return a string containing '%' and the input fmt character.
Since even before Go 1.0, the code has been panicking in the
case where prec=0.

Fixes #52187

Change-Id: I74fec601eedb7fe28efc5132c4253674661452aa
Reviewed-on: https://go-review.googlesource.com/c/go/+/402817
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
Auto-Submit: Emmanuel Odeke <emmanuel@orijtech.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
2022-06-24 23:50:20 +00:00
Rhys Hiltner
bd4753905d internal/trace: add Go 1.19 test data
Update instructions to match what seems to be the historical practice:
to generate canned traces when a version is finalized, rather than
waiting until it is superseded.

Follow rename of trace-internal tests from "Span" to "Region". Update
the net/http test invocation to match the apparent intent and the actual
http_1_5_good behavior (about 7ms of total run time and trace file size
under 50kB).

Change-Id: Ifd4c85882159478852e0b8f0d771b6f16b8f3c1b
Reviewed-on: https://go-review.googlesource.com/c/go/+/413776
Run-TryBot: Rhys Hiltner <rhys@justin.tv>
Reviewed-by: Carlos Amedee <carlos@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Michael Pratt <mpratt@google.com>
2022-06-24 22:08:17 +00:00
Bryan C. Mills
6b6c64b1cc cmd/internal/archive: don't rely on an erroneous install target in tests
Non-main packages in module mode should not be installed to
GOPATH/pkg, but due to #37015 they were installed there anyway.
This change switches the 'go install' command to instead use
'go build -buildmode=archive' with an explicit archive path.

For #37015.

Change-Id: Ib0c8f213100b6473a7657af96f31395703e28493
Reviewed-on: https://go-review.googlesource.com/c/go/+/414055
Auto-Submit: Bryan Mills <bcmills@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Michael Matloob <matloob@golang.org>
Run-TryBot: Bryan Mills <bcmills@google.com>
2022-06-24 21:22:43 +00:00
Matthew Dempsky
e7100adbca [dev.unified] all: merge master (5a1c5b8) into dev.unified
Conflicts:

- test/run.go

  Textual conflict adding to the known failures list for the nounified
  frontend.

Merge List:

+ 2022-06-24 5a1c5b8ae7 cmd/go: add per-package indexing for modules outside mod cache
+ 2022-06-24 b9c4d94fdb cmd/go/internal/list: update help info with Deprecated field
+ 2022-06-24 73475ef035 go/types, types2: print qualified object names in cycle errors
+ 2022-06-24 3e58ef6cc7 go/types, types2: better errors for == when type sets are empty
+ 2022-06-24 d38f1d13fa doc/go1.19: Linux race detector now requires glibc 2.17
+ 2022-06-23 de5329f1de debug/dwarf: handle malformed line table with bad program offset
+ 2022-06-23 15605ca827 embed: document additional file name restrictions
+ 2022-06-22 2e773a3894 test: add test that causes gofrontend crash
+ 2022-06-22 ff17b7d0d4 cmd/compile: don't use dictionary convert to shaped empty interface
+ 2022-06-22 2a3b467d5f cmd/go: make module .zip files group/world readable
+ 2022-06-22 bdab4cf47a cmd/go, cmd/link: support failure to create _cgo_import.go
+ 2022-06-22 aca37d16a5 cmd/go: avoid indexing modules in GOROOT
+ 2022-06-22 111cdb5848 all: update to current golang.org/x/sys revision
+ 2022-06-22 4045b1bc3f cmd/compile: fix assert condition in generic method call
+ 2022-06-22 6bad7e8243 compress/gzip: always close bodyReader in Example_compressingReader
+ 2022-06-22 606c6c371a encoding/xml: check nil pointer in DecodeElement
+ 2022-06-22 f571518139 cmd/cgo: dont override declared struct type
+ 2022-06-22 92c9b81447 net: don't set netGo = true on Windows with no cgo
+ 2022-06-22 be0b2a393a cmd/trace: add basic documentation to main page
+ 2022-06-22 b004c739b5 go/types, types2: fix parameter order dependence in type inference
+ 2022-06-21 f2c7e78592 spec: document operations which accept []byte|string constrained types
+ 2022-06-21 ab422f2749 runtime/trace: ignore fallback stacks in test
+ 2022-06-21 66685fb7dd doc/go1.19: use correct link to sync/atomic docs
+ 2022-06-21 4b236b45d0 runtime: convert flaky semaphore linearity test into benchmark
+ 2022-06-21 530511bacc cmd/go/internal/modindex: avoid walking modules when not needed
+ 2022-06-21 c2d373d5d1 cmd/compile: allow 128-bit values to be spilled
+ 2022-06-21 19ed442807 test: add regress test for #53477
+ 2022-06-20 3fcbfb07a8 doc/go1.19: fix HTML validation issues
+ 2022-06-18 527ace0ffa cmd/compile: skip substituting closures in unsafe builtins arguments
+ 2022-06-17 ec58e3f327 test: add regress test for #53419
+ 2022-06-17 103cc661f1 cmd/go/internal/modfetch: prevent duplicate hashes in go.sum
+ 2022-06-17 d42a48828f sync: add more notes about Cond behavior
+ 2022-06-17 9e2f289754 cmd/go/internal/work: log clearer detail for subprocess errors in (*Builder).toolID
+ 2022-06-17 dd2d00f9d5 net: fix flaky *TimeoutMustNotReturn tests
+ 2022-06-17 6c25ba624f go/token: delete unused File.set field
+ 2022-06-16 9068c6844d cmd/dist: add package . to 'go test' commands
+ 2022-06-16 7bad61554e runtime: write much more direct test for semaphore waiter scalability
+ 2022-06-16 f38a580a51 cmd/go: add more tracing

Change-Id: I912c5879165e03f4d7f8ac3ee9241d50fc92a419
2022-06-24 13:48:41 -07:00
Michael Matloob
5a1c5b8ae7 cmd/go: add per-package indexing for modules outside mod cache
Packages outside the module cache including the standard library will be
indexed individually rather than as a whole module.

For #52876

Change-Id: I142dad6a790e9e8eb4dc6430a588fbfa86552e49
Reviewed-on: https://go-review.googlesource.com/c/go/+/413815
Reviewed-by: Michael Matloob <matloob@golang.org>
Run-TryBot: Michael Matloob <matloob@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-06-24 19:58:23 +00:00
Sean Liao
b9c4d94fdb cmd/go/internal/list: update help info with Deprecated field
Also align Retracted documentation with actual type of []string

Fixes #51876

Change-Id: I3b34e53424aa7ee5330eb71adac23510fff91798
Reviewed-on: https://go-review.googlesource.com/c/go/+/394677
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
2022-06-24 18:54:27 +00:00
Robert Griesemer
73475ef035 go/types, types2: print qualified object names in cycle errors
Fixes #50788.

Change-Id: Id1ed7d9c0687e3005e28598373fd5634178c78ca
Reviewed-on: https://go-review.googlesource.com/c/go/+/413895
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
2022-06-24 17:48:24 +00:00
Robert Griesemer
3e58ef6cc7 go/types, types2: better errors for == when type sets are empty
For #51525.

Change-Id: I3762bc4a48a1aaab3b006b1ad1400f866892243c
Reviewed-on: https://go-review.googlesource.com/c/go/+/413934
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Robert Griesemer <gri@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
2022-06-24 17:45:41 +00:00
Ian Lance Taylor
d38f1d13fa doc/go1.19: Linux race detector now requires glibc 2.17
Fixes #53522

Change-Id: Ibed838d358a733d26a6c3d89446d7fadb1012961
Reviewed-on: https://go-review.googlesource.com/c/go/+/413876
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-06-24 00:37:46 +00:00
Matthew Dempsky
09a838ad86 [dev.unified] cmd/compile: rename haveRType and implicitExpr
This CL renames:

1. "haveRType" to "hasRType", suggested by drchase@ during review of
CL 413358; and

2. "implicitExpr" to "implicitConvExpr", suggested by khr@ during
review of CL 413396.

Change-Id: Ibb4deae20908d960706640991ea44d1b9c0b9e3c
Reviewed-on: https://go-review.googlesource.com/c/go/+/413854
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
2022-06-23 23:03:20 +00:00
Matthew Dempsky
421e9e9db2 [dev.unified] cmd/compile: implicit conversions for return statements
This CL inserts implicit conversions for simple N:N return
statements. A subsequent CL will handle N:1 return statements.

Change-Id: Ia672db3e214025510485e17d3d50d42ff01bc74e
Reviewed-on: https://go-review.googlesource.com/c/go/+/413517
Reviewed-by: Keith Randall <khr@golang.org>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: David Chase <drchase@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-06-23 21:55:25 +00:00
Matthew Dempsky
a3fea7796a [dev.unified] cmd/compile/internal/noder: implicit conversions for writer.assignStmt
This CL inserts implicit conversions for simple N:N assignment
statements within Unified IR. A subsequent CL will handle N:1
assignments.

Change-Id: I7e204c6ee9ffdb9fa2bc9146315fd79735c04628
Reviewed-on: https://go-review.googlesource.com/c/go/+/413516
Reviewed-by: David Chase <drchase@google.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-06-23 21:55:17 +00:00
Matthew Dempsky
82a958a661 [dev.unified] cmd/compile/internal/noder: refactor stmtAssign generation
Eliminate some code duplication between assignment statements and
variable declarations, so they're easier to extend with implicit
conversions.

Change-Id: I605cf7817e3cb230f2c4612b777d8023c926e8b2
Reviewed-on: https://go-review.googlesource.com/c/go/+/413515
Reviewed-by: Keith Randall <khr@golang.org>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: David Chase <drchase@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-06-23 21:55:08 +00:00
Matthew Dempsky
711dacd8cf [dev.unified] cmd/compile/internal/noder: implicit conversion of call arguments
Function call arguments need to be implicitly converted to their
respective parameter types. This CL updates the Unified IR writer to
handle this case, at least for typical function calls. I'll handle
f(g()) calls is a subsequent CL.

Change-Id: I7c031d21f57885c9516eaf89eca517977bf9e39a
Reviewed-on: https://go-review.googlesource.com/c/go/+/413514
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: David Chase <drchase@google.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-06-23 21:55:01 +00:00
Matthew Dempsky
46b01ec667 [dev.unified] cmd/compile/internal/noder: remove needType logic
This logic is a holdover from very early on when it wasn't as clear
how we would handle dictionary entries for derived types, particularly
ones that are emitted during desugaring.

However, the current plan is to explicitly wire runtime type info
through IR nodes, so we can drop this logic.

Notably, the "needed" bit is exposed to the go/types importers, so
removing it would break the x/tools importer. To minimize churn for
now, we can just leave the bools in place.

Change-Id: I374927887d4f3d6d711d3355607849a407d717c4
Reviewed-on: https://go-review.googlesource.com/c/go/+/413367
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
2022-06-23 21:54:51 +00:00
Matthew Dempsky
a3e474f867 [dev.unified] cmd/compile/internal/noder: implicit conversions for complits
Operands within a composite literal must be implicitly converted to
their respective key/element type.

Change-Id: Idc12eba1559e9c9ffebd03395cd91473dd5fc2db
Reviewed-on: https://go-review.googlesource.com/c/go/+/413364
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
2022-06-23 21:54:41 +00:00
Matthew Dempsky
5f5422a2dd [dev.unified] cmd/compile/internal/noder: start writing implicit conversions
This CL adds support for implicit conversions to the unified IR export
data format, and starts inserting them in a few low-hanging
places (send statements, index expressions).

Subsequentl CLs will handle the remaining trickier cases.

Change-Id: Iaea9d1c5df8432b61bd82578ab2ef02adaf26367
Reviewed-on: https://go-review.googlesource.com/c/go/+/413396
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: David Chase <drchase@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-06-23 21:54:34 +00:00
Matthew Dempsky
9cb784ac69 [dev.unified] cmd/compile/internal/noder: add pkgWriter.typeOf helper
Getting the type of a value expression is already a very common
operation during writing, and it's going to become more common to
handle implicit conversions.

Change-Id: I5401c6b01546bbf8e85b1ed3fe4acf2835925e2f
Reviewed-on: https://go-review.googlesource.com/c/go/+/413395
Reviewed-by: Keith Randall <khr@golang.org>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: David Chase <drchase@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-06-23 21:54:02 +00:00
Matthew Dempsky
c70e93ff3d [dev.unified] cmd/compile/internal/typecheck: replace unreachable code with assert
Since the removal of -G=0 mode, IR is always well-typed. And in
well-typed IR, convlit will always returns expressions having real
types (i.e., not untyped).

Change-Id: I1ac99a88c94777829852519347a716d19af7948c
Reviewed-on: https://go-review.googlesource.com/c/go/+/413363
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
2022-06-23 21:53:52 +00:00
Matthew Dempsky
20e1d5ac8c [dev.unified] cmd/compile: special case f(g()) calls in Unified IR
For f(g()) calls where g() is multi-valued, we may need to insert
implicit conversions to convert g()'s result values to f()'s parameter
types. This CL refactors code slightly so this will be easier to
handle.

Change-Id: I3a432220dcb62daecf9a66030e8fa1f097e95f95
Reviewed-on: https://go-review.googlesource.com/c/go/+/413362
Reviewed-by: David Chase <drchase@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
2022-06-23 21:53:38 +00:00
Matthew Dempsky
61ae2b734c [dev.unified] cmd/compile: plumb rtype through OSWITCH/OCASE clauses
For (value) switch statements, we may generate OEQ comparisons between
values of interface and concrete type, which in turn may require
access to the concrete type's RType.

To plumb this through, this CL adds CaseClause.RTypes to hold the
rtype values, updates the GOEXPERIMENT=unified frontend to set it, and
updates walk to plumb rtypes through into generated OEQ nodes.

Change-Id: I6f1de2a1167ce54f5770147498a0a591efb3f012
Reviewed-on: https://go-review.googlesource.com/c/go/+/413361
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: David Chase <drchase@google.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-06-23 21:53:09 +00:00
Matthew Dempsky
3d432b6c4b [dev.unified] cmd/compile: plumb rtype through for OMAPLIT
OMAPLIT gets lowered into a bunch of OINDEXMAP operations, which in
general may require a *runtime._type argument. This CL adds
CompLitExpr.RType, updates the GOEXPERIMENT=unified frontend to start
setting it, and updates walk to propagate it through to any generated
OINDEXMAP operations.

Change-Id: I278e7e8e615ea6d01f65a5eba6d6fc8e00045735
Reviewed-on: https://go-review.googlesource.com/c/go/+/413360
Reviewed-by: David Chase <drchase@google.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-06-23 21:52:53 +00:00
Matthew Dempsky
7368647ac6 [dev.unified] cmd/compile: start setting RType fields for Unified IR
This CL switches the GOEXPERIMENT=unified frontend to set RType fields
in the simpler cases, and to make it fatal if they're missing.

Subsequent CLs will handle the remaining more complex cases (e.g.,
expressions from later desugaring, and implicit conversions to
interface type).

Change-Id: If6257dcb3916905afd9b8371ea64b85f108ebbfb
Reviewed-on: https://go-review.googlesource.com/c/go/+/413359
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: David Chase <drchase@google.com>
2022-06-23 21:52:45 +00:00
Matthew Dempsky
5960f4ec10 [dev.unified] cmd/compile: add RType fields
This CL adds RType/ITab fields to IR nodes that (may) ultimately
become runtime calls that require a *runtime._type or *runtime.itab
argument. It also updates the corresponding reflectdata IR helpers to
use these fields in preference of calling TypePtr/ITabAddr.

Subsequent CLs will start updating the GOEXPERIMENT=unified frontend
to set the RType fields, and incrementally switch the reflectdata
helpers to require them.

Passes toolstash -cmp.

Change-Id: I30e31d91f0a53961e3d6d872d7b5f9df2ec5074c
Reviewed-on: https://go-review.googlesource.com/c/go/+/413358
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
2022-06-23 21:52:30 +00:00
Than McIntosh
de5329f1de debug/dwarf: handle malformed line table with bad program offset
Touch up the line table reader to ensure that it can detect and reject
an invalid program offset field in the table header.

Fixes #53329.

Change-Id: Ia8d684e909af3aca3014b4a3d0dfd431e3f5a9f0
Reviewed-on: https://go-review.googlesource.com/c/go/+/413814
Run-TryBot: Than McIntosh <thanm@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
2022-06-23 19:05:29 +00:00
tulip
15605ca827 embed: document additional file name restrictions
For #44486

Change-Id: I66af9f7a9f95489a41fd6710e50bdd7878f78b85
Reviewed-on: https://go-review.googlesource.com/c/go/+/413494
Run-TryBot: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
2022-06-23 16:32:40 +00:00
Ian Lance Taylor
2e773a3894 test: add test that causes gofrontend crash
For #52846

Change-Id: I763f81def97b53277396c123c524f7b8193ea35e
Reviewed-on: https://go-review.googlesource.com/c/go/+/413694
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
2022-06-22 23:27:17 +00:00
Wayne Zuo
ff17b7d0d4 cmd/compile: don't use dictionary convert to shaped empty interface
Fixes: #53254

Change-Id: I3153d6ebb9f25957b09363f45c5cd4651ee84c2d
Reviewed-on: https://go-review.googlesource.com/c/go/+/410655
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Wayne Zuo <wdvxdr@golangcn.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
2022-06-22 22:14:02 +00:00
Dmitri Goutnik
2a3b467d5f cmd/go: make module .zip files group/world readable
os.CreateTemp in downloadZip leaves downloaded .zip files readable only
by the owner. Make them group/world readable.

Fixes #52765

Change-Id: Iace13e4ad813201a533a1a5fc0c6d9b2e5349a42
Reviewed-on: https://go-review.googlesource.com/c/go/+/404854
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Bryan Mills <bcmills@google.com>
2022-06-22 21:27:19 +00:00
Ian Lance Taylor
bdab4cf47a cmd/go, cmd/link: support failure to create _cgo_import.go
For a package that uses cgo, the file _cgo_import.go is created to
record information required for internal linking: the non-Go dynamic
symbols and libraries that the package depends on. Generating this
information sometimes fails, because it can require recreating all the
dependencies of all transitively imported packages. And the
information is rarely needed, since by default we use external linking
when there are packages outside of the standard library that use cgo.

With this CL, if generating _cgo_import.go fails, we don't report an
error. Instead, we mark the package as requiring external linking, by
adding an empty file named "dynimportfail" into the generated archive.
If the linker sees a file with that name, it rejects an attempt to use
internal linking.

Fixes #52863

Change-Id: Ie586e6753a5b67e49bb14533cd7603d9defcf0ea
Reviewed-on: https://go-review.googlesource.com/c/go/+/413460
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-06-22 20:56:07 +00:00
Bryan C. Mills
aca37d16a5 cmd/go: avoid indexing modules in GOROOT
Scanning GOROOT modules for changes appears to be causing Windows
builders to time out in x/tools tests. We may try a per-package index
instead, but for now just skip GOROOT modules (as we do for main
modules).

Fixes #53493.

Change-Id: Ic5bb90b4ce173a24fc6564e85fcde96e1f9b975f
Reviewed-on: https://go-review.googlesource.com/c/go/+/413634
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Bryan Mills <bcmills@google.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
2022-06-22 19:56:09 +00:00
Guoqi Chen
111cdb5848 all: update to current golang.org/x/sys revision
go get -d golang.org/x/sys@6c1b26c55098eae66ce95ab7c3712ab6cbfff2b7
go mod tidy
go mod vendor

This fixes the problem of the second return value in syscall on linux/loong64.

Change-Id: I8018ae96f4e5ca9779b2c053cdccc6b2866bf0de
Reviewed-on: https://go-review.googlesource.com/c/go/+/412274
Reviewed-by: Bryan Mills <bcmills@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Bryan Mills <bcmills@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-06-22 16:47:18 +00:00
Wayne Zuo
4045b1bc3f cmd/compile: fix assert condition in generic method call
Fixes #53406.

Change-Id: If7ae39ec1042a792d82a0a2de96d168c22d8ab71
Reviewed-on: https://go-review.googlesource.com/c/go/+/412614
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Alex Rakoczy <alex@golang.org>
Auto-Submit: Alex Rakoczy <alex@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
Run-TryBot: Wayne Zuo <wdvxdr@golangcn.org>
2022-06-22 16:25:18 +00:00
Ian Lance Taylor
6bad7e8243 compress/gzip: always close bodyReader in Example_compressingReader
For #53362
Fixes #53414

Change-Id: I352164e70c136eed210c7ee4ceba5dc631f81f94
Reviewed-on: https://go-review.googlesource.com/c/go/+/412955
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Joseph Tsai <joetsai@digital-static.net>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Reviewed-by: Alex Rakoczy <alex@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-06-22 16:24:14 +00:00
shaoliming
606c6c371a encoding/xml: check nil pointer in DecodeElement
Fixes #53350

Change-Id: Id5e1f4016db5f1d4349ee1a76a9dfe3aeae83cee
GitHub-Last-Rev: 45add12161
GitHub-Pull-Request: golang/go#53407
Reviewed-on: https://go-review.googlesource.com/c/go/+/412634
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Alex Rakoczy <alex@golang.org>
2022-06-22 16:23:59 +00:00
kkHAIKE
f571518139 cmd/cgo: dont override declared struct type
Fixes #52611

Change-Id: I835df8d6a98a37482446ec00af768c96fd8ee4fe
GitHub-Last-Rev: ea54dd69ee
GitHub-Pull-Request: golang/go#52733
Reviewed-on: https://go-review.googlesource.com/c/go/+/404497
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Dexter Ouyang <kkhaike@gmail.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Reviewed-by: Alex Rakoczy <alex@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-06-22 16:21:49 +00:00