1
0
mirror of https://github.com/golang/go synced 2024-11-18 12:14:42 -07:00
Commit Graph

39177 Commits

Author SHA1 Message Date
Alessandro Arzilli
374546d800 cmd/go: respect gcflags, ldflags in 'go test'
Fixes bug introduced by https://golang.org/cl/129059 where
gcflags='all=...' and ldflags='all=...' would not be applied to some
packages built by 'go test'.

LoadImport used to set gcflags/ldflags for the Package objects it
created, in https://golang.org/cl/129059 this code was factored out to
setToolFlags. The codepath of `go build` was updated to call
setToolFlags appropriatley, but the codepath of `go test -c` wasn't,
resulting in gcflags/ldflags being applied inconsistently when building
tests.

This commit changes TestPackagesFor to call setToolFlags on the package
objects it creates.

Fixes #27681

Change-Id: Idcbec0c989ee96ec066207184611f08818873e8d
Reviewed-on: https://go-review.googlesource.com/c/136275
Run-TryBot: Jay Conrod <jayconrod@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
2019-01-03 17:20:41 +00:00
Keith Randall
abd1dde1f7 cmd/compile: fix no-op instruction used by s390x
CL 152537 introduced a new use for ginsnop, the arch-dependent
routine that generates nops. The previous s390x nop clobbered flags.
It turns out the previous uses of this nop did not require flags
to be preserved, but the new use does.

Use a real nop: the 4-byte preferred nop.

Fixes #29453

Change-Id: I95310dfdd831932e26f5d5b6608324687f4c3162
Reviewed-on: https://go-review.googlesource.com/c/155926
Reviewed-by: Michael Munday <mike.munday@ibm.com>
2019-01-03 17:00:47 +00:00
Ian Lance Taylor
0175064e69 net: skip TestUDPZeroBytePayload on Darwin
Updates #29225

Change-Id: I4c9b7a108861ce5c9ab84f7324ced3da51e7bf2a
Reviewed-on: https://go-review.googlesource.com/c/156119
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-01-03 05:07:58 +00:00
Ian Lance Taylor
5de0c37ecf doc: go1.12: clarify use of MADV_FREE
Fixes #29337

Change-Id: I1d632d19058c63dac8e25d2a5ad55555c1aec9d4
Reviewed-on: https://go-review.googlesource.com/c/155438
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-01-03 04:13:59 +00:00
David Chase
ae68cf4c53 cmd/compile: Update ssa/debug_test reference files for delve and gdb
Recent changes to compiler backtraces perturbed the line
number assignment, some better, some worse, probably net
worse.  For purposes of passing the long tests, update the
reference files (delve's file was also stale).

TODO: Figure out a less delicate way to locate statement
boundaries for 1.13.

Fixes #29511.

Change-Id: If0e488341d848ba6012045b126c86b1250408d65
Reviewed-on: https://go-review.googlesource.com/c/156021
Run-TryBot: David Chase <drchase@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-01-02 22:18:10 +00:00
Cherry Zhang
57879fea46 cmd/compile: fix format test
CL 156019 adds some debug output, including printing ssa.relation
as string. Update the map.

Change-Id: I0299d2008d199da10d86e5b47a50385b3a314c68
Reviewed-on: https://go-review.googlesource.com/c/156020
Run-TryBot: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-01-02 21:49:30 +00:00
Brad Fitzpatrick
64096dbb69 api: add os.(*File).SyscallConn to go1.12.txt
Fixes #29507

Change-Id: I8cf52e4b89fd28126f252757260d07a31d9dad61
Reviewed-on: https://go-review.googlesource.com/c/155933
Reviewed-by: Katie Hockman <katie@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
2019-01-02 21:21:53 +00:00
Brad Fitzpatrick
22738f07c8 runtime: add GODEBUG=madvdontneed=1
Fixes #28466

Change-Id: I05b2e0da09394d111913963b60f2ec865c9b4744
Reviewed-on: https://go-review.googlesource.com/c/155931
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
2019-01-02 20:55:53 +00:00
Austin Clements
8e6396115e runtime: don't spin in checkPut if non-preemptible
Currently it's possible for the runtime to deadlock if checkPut is
called in a non-preemptible context. In this case, checkPut may spin,
so it won't leave the non-preemptible context, but the thread running
gcMarkDone needs to preempt all of the goroutines before it can
release the checkPut spin loops.

Fix this by returning from checkPut if it's called under any of the
conditions that would prevent gcMarkDone from preempting it. In this
case, it leaves a note behind that this happened; if the runtime does
later detect left-over work it can at least indicate that it was
unable to catch it in the act.

For #27993.
Updates #29385 (may fix it).

Change-Id: Ic71c10701229febb4ddf8c104fb10e06d84b122e
Reviewed-on: https://go-review.googlesource.com/c/156017
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rick Hudson <rlh@golang.org>
2019-01-02 20:21:01 +00:00
Tobias Klauser
5ec5c5741e cmd/dist: list only supported platforms
Introduce an incomplete map in dist alongside cgoEnabled and filter out
the incomplete ports in 'dist list'.

Fixes #28944

Change-Id: I15aae56aec570e1cd9e28906900cd5ba0db77811
Reviewed-on: https://go-review.googlesource.com/c/155839
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-01-02 19:31:05 +00:00
Cherry Zhang
2e217fa726 cmd/compile: fix deriving from x+d >= w on overflow in prove pass
In the case of x+d >= w, where d and w are constants, we are
deriving x is within the bound of min=w-d and max=maxInt-d. When
there is an overflow (min >= max), we know only one of x >= min
or x <= max is true, and we derive this by excluding the other.
When excluding x >= min, we did not consider the equal case, so
we could incorrectly derive x <= max when x == min.

Fixes #29502.

Change-Id: Ia9f7d814264b1a3ddf78f52e2ce23377450e6e8a
Reviewed-on: https://go-review.googlesource.com/c/156019
Reviewed-by: David Chase <drchase@google.com>
2019-01-02 19:28:06 +00:00
Brad Fitzpatrick
1f035d036c runtime: disable GDB tests on freebsd/arm for now
Updates #29508
Updates #28679

Change-Id: I19bc9f88aeb2b1f3e69856173a00c5a4d5ed3613
Reviewed-on: https://go-review.googlesource.com/c/155932
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Katie Hockman <katie@golang.org>
2019-01-02 19:23:13 +00:00
Julien Salleyron
2175177497 net/http/httputil: fix missing previous headers in response when switching protocol in ReverseProxy
When using switching protocol, previous headers set before the reverse proxy are lost.

Fixes #29407

Change-Id: Ia2b9784022d9bccef8625519ccbabbe8a276dfc0
GitHub-Last-Rev: 79bb493dcb
GitHub-Pull-Request: golang/go#29408
Reviewed-on: https://go-review.googlesource.com/c/155741
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-01-02 17:00:30 +00:00
Daniel Ingram
8962b71c49 runtime: fix string formatting
Change-Id: I87d0bc78a246e479d97b3f83cf77c1f701975413
GitHub-Last-Rev: 22cd684e08
GitHub-Pull-Request: golang/go#29157
Reviewed-on: https://go-review.googlesource.com/c/153298
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com>
Reviewed-by: Austin Clements <austin@google.com>
2019-01-02 16:59:44 +00:00
Agniva De Sarker
04eda1a94d net/url: clarify documentation about (*URL).String
Fixes #23669

Change-Id: Ib7f0aab0b066f778a3097583f432f8092310fb81
Reviewed-on: https://go-review.googlesource.com/c/155598
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-01-02 16:41:22 +00:00
Iskander Sharipov
ad1644943b cmd/compile/internal/gc: remove unused methodbyname type
methodbyname was used for sorting in bexport.go, until
https://golang.org/cl/139338 removed the code that
invoked sorting function.

R=1.13

Change-Id: I13e313fb60111a142ed3883d81916af254445fdc
Reviewed-on: https://go-review.googlesource.com/c/155959
Run-TryBot: Iskander Sharipov <quasilyte@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-01-02 16:18:03 +00:00
Richard Musiol
f4f6594124 runtime: fix notetsleepg deadline on js/wasm
A notetsleepg may get stuck if its timeout callback gets invoked
exactly on its deadline due to low precision of nanotime. This change
fixes the comparison so it also resolves the note if the timestamps are
equal.

Updates #28975

Change-Id: I045d2f48b7f41cea0caec19b56876e9de01dcd6c
Reviewed-on: https://go-review.googlesource.com/c/153558
Run-TryBot: Richard Musiol <neelance@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2019-01-02 15:41:44 +00:00
Michael McLoughlin
204a8f55dc runtime: fix REFLECTMETHOD macro
Removes spurious equals sign from REFLECTMETHOD macro.

Fixes #29487

Change-Id: Iaa3d85ff57087aa79a259f28816f8b0a552536f3
Reviewed-on: https://go-review.googlesource.com/c/155927
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2019-01-01 20:15:48 +00:00
Josh Bleecher Snyder
c6282e7ac5 doc: 2019 is the Year of the Gopher
whereas this is a longstanding tradition
and insofaras it is worth continuing such traditions
and notwithstanding an attempt at future-proofing
thetruthofthematter is that I have been waiting for years to send this change
so despiteallobjections I have updated the copyright year.

Change-Id: I55961b15a7eda35d84fdd9250afdbe19f0bf8412
Reviewed-on: https://go-review.googlesource.com/c/155928
Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com>
2019-01-01 06:18:45 +00:00
Josh Bleecher Snyder
ed78c90a78 strconv: make docs for Itoa and Atoi slightly higher level
Fixes #29461

Change-Id: I5db8bc80e5bd0778dced8471581c67e66853aada
Reviewed-on: https://go-review.googlesource.com/c/155924
Reviewed-by: Rob Pike <r@golang.org>
2018-12-31 22:48:43 +00:00
Yuval Pavel Zholkover
480373c756 syscall: revert to pre-FreeBSD 10 / POSIX-2008 timespec field names in Stat_t on FreeBSD
CL 138595 introduced the new names when the hardcoded stat8 definitions was replaced
with a cgo generated one.

Fixes #29393
Updates #22448

Change-Id: I6309958306329ff301c17344b2e0ead0cc874224
Reviewed-on: https://go-review.googlesource.com/c/155958
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-12-30 19:36:52 +00:00
Hidetatsu Yaginuma
f4f1b14ab4 strconv: add missing package name into doc.go(godoc overview)
Change-Id: I336ad707a85bf0c81b6c2230c90452c0b3b92924
Reviewed-on: https://go-review.googlesource.com/c/155998
Reviewed-by: Robert Griesemer <gri@golang.org>
2018-12-30 18:30:11 +00:00
Jordan Rhee
3e89272f9c runtime: use EnumTimeFormatsEx instead of EnumWindows in callback tests
Use EnumTimeFormatsEx() to test panics across callback boundaries
instead of EnumWindows(). EnumWindows() is incompatible with Go's panic
unwinding mechanism. See the associated issue for more information.

Updates #26148

Change-Id: If1dd70885d9c418b980b6827942cb1fd16c73803
Reviewed-on: https://go-review.googlesource.com/c/155923
Run-TryBot: Alex Brainman <alex.brainman@gmail.com>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
2018-12-30 04:55:26 +00:00
Taufiq Rahman
58a17b43d1 net/http: fix typographical error in transport.go
Change-Id: I5f9de0daa3c18ecd7d6cd30ea13d147e227b3550
GitHub-Last-Rev: 5eabcbd91f
GitHub-Pull-Request: golang/go#29454
Reviewed-on: https://go-review.googlesource.com/c/155920
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-12-29 17:24:26 +00:00
Alberto Donizetti
efbd01f1dc test: disable issue 29329 test when cgo is not enabled
CL 155917 added a -race test that shouldn't be run when cgo is not
enabled. Enforce this in the test file, with a buildflag.

Fixes the nocgo builder.

Change-Id: I9fe0d8f21da4d6e2de3f8fe9395e1fa7e9664b02
Reviewed-on: https://go-review.googlesource.com/c/155957
Run-TryBot: Alberto Donizetti <alb.donizetti@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-12-29 14:18:11 +00:00
Keith Randall
ed15e82413 runtime: panic on uncomparable map key, even if map is empty
Reorg map flags a bit so we don't need any extra space for the extra flag.

Fixes #23734

Change-Id: I436812156240ae90de53d0943fe1aabf3ea37417
Reviewed-on: https://go-review.googlesource.com/c/155918
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-12-29 01:00:54 +00:00
Keith Randall
14bdcc76fd cmd/compile: fix racewalk{enter,exit} removal
We can't remove race instrumentation unless there are no calls,
not just no static calls. Closure and interface calls also count.

The problem in issue 29329 is that there was a racefuncenter, an
InterCall, and a racefuncexit.  The racefuncenter was removed, then
the InterCall was rewritten to a StaticCall. That prevented the
racefuncexit from being removed. That caused an imbalance in
racefuncenter/racefuncexit calls, which made the race detector barf.

Bug introduced at CL 121235

Fixes #29329

Change-Id: I2c94ac6cf918dd910b74b2a0de5dc2480d236f16
Reviewed-on: https://go-review.googlesource.com/c/155917
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-12-29 00:04:59 +00:00
Mostyn Bramley-Moore
d459962967 encoding/gob: mention that Encoder and Decoder are safe for concurrent use
Fixes #29416

Change-Id: I24364bfee77aceace53f85f1046ef4d73f8feebb

Change-Id: I24364bfee77aceace53f85f1046ef4d73f8feebb
GitHub-Last-Rev: ad9f311457
GitHub-Pull-Request: golang/go#29417
Reviewed-on: https://go-review.googlesource.com/c/155742
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-12-28 22:14:11 +00:00
Keith Randall
69c2c56453 cmd/compile,runtime: redo mid-stack inlining tracebacks
Work involved in getting a stack trace is divided between
runtime.Callers and runtime.CallersFrames.

Before this CL, runtime.Callers returns a pc per runtime frame.
runtime.CallersFrames is responsible for expanding a runtime frame
into potentially multiple user frames.

After this CL, runtime.Callers returns a pc per user frame.
runtime.CallersFrames just maps those to user frame info.

Entries in the result of runtime.Callers are now pcs
of the calls (or of the inline marks), not of the instruction
just after the call.

Fixes #29007
Fixes #28640
Update #26320

Change-Id: I1c9567596ff73dc73271311005097a9188c3406f
Reviewed-on: https://go-review.googlesource.com/c/152537
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
2018-12-28 20:55:36 +00:00
Ian Lance Taylor
c043fc4f65 os: don't let sendFile put a pipe into blocking mode
Use SyscallConn to avoid calling the Fd method in sendFile on Unix
systems, since Fd has the side effect of putting the descriptor into
blocking mode.

Fixes #28330

Change-Id: If093417a225fe44092bd2c0dbbc3937422e98c0b
Reviewed-on: https://go-review.googlesource.com/c/155137
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-12-28 04:17:55 +00:00
Ian Lance Taylor
b115207baf syscall: document LockOSThread with GNU/Linux SysProcAttr.Ptrace
Fixes #28315

Change-Id: Ie02c72d02ad2f66c9cdbbba579a304641f327672
Reviewed-on: https://go-review.googlesource.com/c/155138
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-12-27 18:53:02 +00:00
Ian Lance Taylor
c0914d5df3 os: add SyscallConn method for os.File
Fixes #24331

Change-Id: I119c09a4259d852cdf8ea31b3e03e6f09a5f7bda
Reviewed-on: https://go-review.googlesource.com/c/155517
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-12-27 16:36:34 +00:00
Cherry Zhang
6a64efc250 cmd/compile: fix MIPS SGTconst-with-shift rules
(SGTconst [c] (SRLconst _ [d])) && 0 <= int32(c) && uint32(d) <= 31 && 1<<(32-uint32(d)) <= int32(c) -> (MOVWconst [1])

This rule is problematic. 1<<(32-uint32(d)) <= int32(c) meant to
say that it is true if c is greater than the largest possible
value of the right shift. But when d==1, 1<<(32-1) is negative
and results in the wrong comparison.

Rewrite the rules in a more direct way.

Fixes #29402.

Change-Id: I5940fc9538d9bc3a4bcae8aa34672867540dc60e
Reviewed-on: https://go-review.googlesource.com/c/155798
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
2018-12-27 00:07:53 +00:00
Will Beason
bfaf11c158 math/big: fix incorrect comment variable reference
Fix comment as w&1 is the parity of 'x', not of 'n'.

Change-Id: Ia0e448f7e5896412ff9b164459ce15561ab624cc
GitHub-Last-Rev: 54ba08ab10
GitHub-Pull-Request: golang/go#29419
Reviewed-on: https://go-review.googlesource.com/c/155743
Reviewed-by: Robert Griesemer <gri@golang.org>
2018-12-26 05:21:41 +00:00
Keith Randall
55e3aced9e cmd: vendor x/sys/unix into the stdlib
Last of the Macos libSystem changes, hopefully.

Fixes #17490

Change-Id: I88b303bafd92494cc4ddde712213d2ef976ce4e2
Reviewed-on: https://go-review.googlesource.com/c/155737
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-12-25 01:24:47 +00:00
Max Ushakov
652d59861e time: return ENOENT if a zoneinfo zip file is not found
Updates #20969

Change-Id: Ibcf0bf932d5b1de67c22c63dd8514ed7a5d198fb
Reviewed-on: https://go-review.googlesource.com/c/155538
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-12-24 19:25:18 +00:00
LE Manh Cuong
b32ee0a3c0 path/filepath: walkSymlinks: return correct error for file with trailing slash
Rather than return os.ErrNotExist for /path/to/existing_file/,
walkSymLinks now returns syscall.ENOTDIR.

This is consistent with behavior of os.Lstat.

Fixes #29372

Change-Id: Id5c471d901db04b2f35d60f60a81b2a0be93cae9
Reviewed-on: https://go-review.googlesource.com/c/155597
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-12-24 18:38:18 +00:00
Andrew Bonventre
3b66c00857 reflect: fix panic when Value.IsNil is called for UnsafePointer
UnsafePointer is a valid type kind to call IsNil on.

Fixes #29381

Change-Id: Iaf65d582c67f4be52cd1885badf40f174920500b
Reviewed-on: https://go-review.googlesource.com/c/155797
Run-TryBot: Andrew Bonventre <andybons@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
2018-12-24 01:23:25 +00:00
Daniel Martí
97d5cb24b1 cmd/go: add regression test for cryptic vcs errors
On Go 1.11.x, if one ran 'go build' on a main package within a module,
while a needed vcs program like git was missing, a confusing error would
show up:

	build testmod: cannot find module for path rsc.io/quote

The error should instead point at the source of the problem, which is
the missing vcs program. Thankfully, Go 1.12 doesn't have this bug, even
though it doesn't seem like the bug was fixed directly and
intentionally.

To ensure that this particular edge case isn't broken again, add a
regression test. Piggyback on mod_vcs_missing, since it already requires
a missing vcs program and network access.

I double-checked that Go 1.11 fails this test via /usr/bin/go, which is
1.11.3 on my system:

	$ PATH=~/tip/bin go test -v -run Script/mod_vcs_missing
	[...]
	> exec /usr/bin/go build
	[stderr]
	build m: cannot find module for path launchpad.net/gocheck

Fixes #28948.

Change-Id: Iff1bcf77d9f7c11d15935cb87d6f58d7981d33d2
Reviewed-on: https://go-review.googlesource.com/c/155537
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
2018-12-22 09:37:04 +00:00
Josh Bleecher Snyder
3a3b98fdf9 cmd/compile/internal/ssa/gen: set wasm genfile
This appears to have been an oversight and/or
left over from development.

Setting the genfile means that extra sanity
checks are executed when regenerating SSA files.
They already pass.

Change-Id: Icc01ecf85020d3d51355e8bccfbc521b52371747
Reviewed-on: https://go-review.googlesource.com/c/154459
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: Keith Randall <khr@golang.org>
2018-12-22 04:10:42 +00:00
Keith Randall
c5414457c6 cmd/compile: pad zero-sized stack variables
If someone takes a pointer to a zero-sized stack variable, it can
be incorrectly interpreted as a pointer to the next object in the
stack frame. To avoid this, add some padding after zero-sized variables.

We only need to pad if the next variable in memory (which is the
previous variable in the order in which we allocate variables to the
stack frame) has pointers. If the next variable has no pointers, it
won't hurt to have a pointer to it.

Because we allocate all pointer-containing variables before all
non-pointer-containing variables, we should only have to pad once per
frame.

Fixes #24993

Change-Id: Ife561cdfdf964fdbf69af03ae6ba97d004e6193c
Reviewed-on: https://go-review.googlesource.com/c/155698
Run-TryBot: Keith Randall <khr@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2018-12-22 01:16:00 +00:00
Keith Randall
debca77971 cmd/compile: fix line number for implicitly declared method expressions
Method expressions where the method is implicitly declared have no
line number. The Error method of the built-in error type is one such
method.  We leave the line number at the use of the method expression
in this case.

Fixes #29389

Change-Id: I29c64bb47b1a704576abf086599eb5af7b78df53
Reviewed-on: https://go-review.googlesource.com/c/155639
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-12-22 01:08:39 +00:00
Ian Lance Taylor
08477a38ab cmd/cgo: don't let inserted /*line*/ become a // comment
Fixes #29383

Change-Id: I0fb2929863e153b96d32d851e25e536231e4ae65
Reviewed-on: https://go-review.googlesource.com/c/155638
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
2018-12-22 00:45:13 +00:00
Ian Lance Taylor
e7c20b7917 doc: go_mem: clarify Once docs
Fixes #27808

Change-Id: Ia643d51004c47953642a2ba41dfed281f1112be6
Reviewed-on: https://go-review.googlesource.com/c/155637
Reviewed-by: Bryan C. Mills <bcmills@google.com>
2018-12-21 21:46:38 +00:00
Jay Conrod
b7451e299b cmd/go: use cached source files in "go list -find -compiled"
When "go list" is invoked with -find, it clears the list of imports
for each package matched on the command line. This affects action IDs,
since they incorporate dependencies' action IDs. Consequently, the
build triggered by -compiled won't find sources cached by
"go build".

We can still safely cache compiled sources from multiple runs of
"go list -find -compiled" though, since cgo generated sources are not
affected by imported dependencies. This change adds a second look into
the cache in this situation.

Fixes #29371

Change-Id: Ia0ae5a403ab5d621feaa16f521e6a65ac0ae6d9a
Reviewed-on: https://go-review.googlesource.com/c/155481
Reviewed-by: Bryan C. Mills <bcmills@google.com>
2018-12-21 20:45:04 +00:00
Jay Conrod
00055152d3 cmd/go: fix -n output in runtime/internal/atomic
When building runtime/internal/atomic, the toolchain writes a symabis2
file. This file is read back in, filtered, and appended to the symabis
file. This breaks with -n, since the symabis2 file is never written.

With this change, when -n is used, an equivalent "grep" command is
printed instead. The output for -x is unchanged.

Fixes #29346

Change-Id: Id25e06e06364fc6689e71660d000f09c649c4f0c
Reviewed-on: https://go-review.googlesource.com/c/155480
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
2018-12-21 20:44:41 +00:00
Michael Anthony Knyszek
429bae7158 runtime: skip TestLockOSThreadAvoidsStatePropagation if one can't unshare
This change splits a testprog out of TestLockOSThreadExit and makes it
its own test. Then, this change makes the testprog exit prematurely with
a special message if unshare fails with EPERM because not all of the
builders allow the user to call the unshare syscall.

Also, do some minor cleanup on the TestLockOSThread* tests.

Fixes #29366.

Change-Id: Id8a9f6c4b16e26af92ed2916b90b0249ba226dbe
Reviewed-on: https://go-review.googlesource.com/c/155437
Run-TryBot: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-12-21 18:42:22 +00:00
Ian Lance Taylor
90dca98d33 doc: clarify change to File.Sync on macOS
Updates #26650

Change-Id: I0ec070127dcacc7fc68dd5baf125eb762e1ea846
Reviewed-on: https://go-review.googlesource.com/c/155038
Reviewed-by: Bryan C. Mills <bcmills@google.com>
2018-12-20 22:11:45 +00:00
Matthew Dempsky
706b54bb85 cmd/compile: fix ICE due to bad rune width
It was possible that

    var X interface{} = 'x'

could cause a compilation failure due to having not calculated rune's
width yet. typecheck.go normally calculates the width of things, but
it doesn't for implicit conversions to default type. We already
compute the width of all of the standard numeric types in universe.go,
but we failed to calculate it for the rune alias type. So we could
later crash if the code never otherwise explicitly mentioned 'rune'.

While here, explicitly compute widths for 'byte' and 'error' for
consistency.

Fixes #29350.

Change-Id: Ifedd4899527c983ee5258dcf75aaf635b6f812f8
Reviewed-on: https://go-review.googlesource.com/c/155380
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: Robert Griesemer <gri@golang.org>
2018-12-20 19:35:04 +00:00
Kevin Burke
8ff04a9966 os: clearer doc for Interrupt
I was confused by the juxtaposition of os.Interrupt docs, which are
"guaranteed to exist on all platforms" in one sentence and then
"not implemented" in the next sentence. Reading the code reveals
"not implemented" refers specifically to the implementation of
os.Process.Signal on Windows, not to the os.Interrupt variable itself.
Reword the doc to make this distinction clearer.

Fixes #27854.

Change-Id: I5fe7cddea61fa1954cef2006dc51b8fa8ece4d6e
Reviewed-on: https://go-review.googlesource.com/c/137336
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
2018-12-20 18:56:28 +00:00