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

1165 Commits

Author SHA1 Message Date
Robert Griesemer
3fd3171c2c cmd/compile/internal/syntax: removed gcCompat code needed to pass orig. tests
The gcCompat mode was introduced to match the new parser's node position
setup exactly with the positions used by the original parser. Some of the
gcCompat adjustments were required to satisfy syntax error test cases,
and the rest were required to make toolstash cmp pass.

This change removes the former gcCompat adjustments and instead adjusts
the respective test cases as necessary. In some cases this makes the error
lines consistent with the ones reported by gccgo.

Where it has changed, the position associated with a given syntactic construct
is the position (line/col number) of the left-most token belonging to the
construct.

Change-Id: I5b60c00c5999a895c4d6d6e9b383c6405ccf725c
Reviewed-on: https://go-review.googlesource.com/36695
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2017-02-10 01:22:30 +00:00
Robert Griesemer
3c22e5ca27 cmd/compile/internal/parser: improved syntax error for incorrect if/for/switch header
Starting the error message with "expecting" rather than "missing"
causes the syntax error mechanism to add additional helpful info
(it recognizes "expecting" but not "missing").

Fixes #17328.

Change-Id: I8482ca5e5a6a6b22e0ed0d831b7328e264156334
Reviewed-on: https://go-review.googlesource.com/36637
Run-TryBot: Robert Griesemer <gri@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-02-09 03:54:47 +00:00
Robert Griesemer
9799622f09 cmd/compile/internal/syntax: differentiate between ';' and '\n' in syntax errors
Towards better syntax error messages: With this change, the parser knows whether
a semicolon was an actual ';' in the source, or whether it was an automatically
inserted semicolon as result of a '\n' or EOF. Using this information in error
messages makes them more understandable.

For #17328.

Change-Id: I8cd9accee8681b62569d0ecef922d38682b401eb
Reviewed-on: https://go-review.googlesource.com/36636
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2017-02-09 01:45:17 +00:00
Cherry Zhang
a146dd3a2f cmd/compile: handle DOT STRUCTLIT for zero-valued struct in SSA
CL 35261 makes SSA handle zero-valued STRUCTLIT, but DOT operation
was not handled.

Fixes #18994.

Change-Id: Ic7976036acca1523b0b14afac4d170797e8aee20
Reviewed-on: https://go-review.googlesource.com/36565
Run-TryBot: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-02-08 21:01:51 +00:00
Shintaro Kaneko
936749efb0 test: improve output format of issue10607a.go test
Change-Id: Iad5ff820a95f5082b75aa5260e40c33c7b0ecf22
Reviewed-on: https://go-review.googlesource.com/35990
Reviewed-by: Russ Cox <rsc@golang.org>
2017-02-07 14:00:27 +00:00
Robert Griesemer
3b68a64769 cmd/compile/internal/syntax: make a parser error "1.7 compliant"
For code such as

	if a := 10 { ...

the 1.7 compiler reported

	a := 10 used as value

while the 1.8 compiler reported

	invalid condition, tag, or type switch guard

Changed the error message to match the 1.7 compiler.

Fixes #18915.

Change-Id: I01308862e461922e717f9f8295a9db53d5a914eb
Reviewed-on: https://go-review.googlesource.com/36470
Run-TryBot: Robert Griesemer <gri@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-02-06 23:33:07 +00:00
Keith Randall
807c80fce3 cmd/compile: using CONV instead of CONVNOP for interface conversions
We shouldn't use CONVNOP for conversions between two different
nonempty interface types, because we want to update the itab
in those situations.

Fixes #18595

After this CL, we are guaranteed that itabs are unique, that is
there is only one itab per compile-time-type/concrete type pair.
See also the tests in CL 35115 and 35116 which make sure this
invariant holds even for shared libraries and plugins.

Unique itabs are required for CL 34810 (faster type switch code).

R=go1.9

Change-Id: Id27d2e01ded706680965e4cb69d7c7a24ac2161b
Reviewed-on: https://go-review.googlesource.com/35119
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
2017-02-06 20:00:05 +00:00
Cherry Zhang
b53f0f8c96 cmd/compile: do not fold large offset on ARM64
Fixes #18933.

Change-Id: I8bb98e95bb4486a086d93bcf99e3a37488e77b03
Reviewed-on: https://go-review.googlesource.com/36318
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
2017-02-04 16:46:11 +00:00
Michael Munday
ddf807fce8 cmd/compile: fix type propagation through s390x SSA rules
This CL fixes two issues:

1. Load ops were initially always lowered to unsigned loads, even
   for signed types. This was fine by itself however LoadReg ops
   (used to re-load spilled values) were lowered to signed loads
   for signed types. This meant that spills could invalidate
   optimizations that assumed the original unsigned load.

2. Types were not always being maintained correctly through rules
   designed to eliminate unnecessary zero and sign extensions.

Fixes #18906.

Change-Id: I95785dcadba03f7e3e94524677e7d8d3d3b9b737
Reviewed-on: https://go-review.googlesource.com/36256
Run-TryBot: Michael Munday <munday@ca.ibm.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2017-02-03 21:27:21 +00:00
Robert Griesemer
c1363b2d91 cmd/compile: provide line number for cgo directive error (fix a TODO)
Also: Remove double "go:" prefix in related error message.

Fixes #18882.

Change-Id: Ifbbd8e2f7529b43f035d3dbf7ca4a91f212bc6b6
Reviewed-on: https://go-review.googlesource.com/36121
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2017-02-02 21:24:50 +00:00
Emmanuel Odeke
cb6e0639fb cmd/compile: improve error message if init is directly invoked
Fixes #8481.

Inform the user that init functions cannot be directly invoked
in user code, as mandated by the spec at:
http://golang.org/ref/spec#Program_initialization_and_execution.

Change-Id: Ib12c0c08718ffd48b76b6f9b13c76bb6612d2e7b
Reviewed-on: https://go-review.googlesource.com/34790
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-02-02 05:55:03 +00:00
Emmanuel Odeke
dba0d38298 cmd/compile: fix conversion error message for printed slices
Fixes #15055.

Updates exprfmt printing using fmt verb "%v" to check that n.Left
is non-nil before attempting to print it, otherwise we'll print
the nodes in the list using verb "%.v".

Credit to @mdempsky for this approach and for finding
the root cause of the issue.

Change-Id: I20a6464e916dc70d5565e145164bb9553e5d3865
Reviewed-on: https://go-review.googlesource.com/25361
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-02-02 05:10:22 +00:00
Josh Bleecher Snyder
b443babad4 test: add extra test for issue18661
Make sure that the lack of an lvalue doesn't
cause extra side-effects.

Updates #18661
Updates #18739

Change-Id: I52eb4b4a5c6f8ff5cddd2115455f853c18112c19
Reviewed-on: https://go-review.googlesource.com/36126
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2017-02-02 04:57:33 +00:00
Matthew Dempsky
16dd0624c2 cmd/compile/internal/gc: add comment and test for #15550
When switching to the new parser, I changed cmd/compile to handle iota
per an intuitive interpretation of how nested constant declarations
should work (which also matches go/types).

Note: if we end up deciding that the current spec wording is
intentional (i.e., confirming gccgo's current behavior), the test will
need to be updated to expect 4 instead of 1.

Updates #15550.

Change-Id: I441f5f13209f172b73ef75031f2a9daa5e985277
Reviewed-on: https://go-review.googlesource.com/36122
Reviewed-by: David Crawshaw <crawshaw@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-02-02 04:25:23 +00:00
Alberto Donizetti
871300308a cmd/compile: never report "truncated to real" for toint calls
Whoever called toint() is expecting the {Mpint, Mpflt, Mpcplx} arg to
be converted to an integer expression, so it never makes sense to
report an error as "constant X truncated to real".

Fixes #11580

Change-Id: Iadcb105f0802358a7f77188c2b1e63fe80c5580c
Reviewed-on: https://go-review.googlesource.com/34638
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
Run-TryBot: Robert Griesemer <gri@golang.org>
2017-02-01 21:22:50 +00:00
Russ Cox
47ce87877b all: merge dev.inline into master
Change-Id: I7715581a04e513dcda9918e853fa6b1ddc703770
2017-02-01 09:47:23 -05:00
Russ Cox
c47df7ae17 all: merge dev.typealias into master
For #18130.

f8b4123613 [dev.typealias] spec: use term 'embedded field' rather than 'anonymous field'
9ecc3ee252 [dev.typealias] cmd/compile: avoid false positive cycles from type aliases
49b7af8a30 [dev.typealias] reflect: add test for type aliases
9bbb07ddec [dev.typealias] cmd/compile, reflect: fix struct field names for embedded byte, rune
43c7094386 [dev.typealias] reflect: fix StructOf use of StructField to match StructField docs
9657e0b077 [dev.typealias] cmd/doc: update for type alias
de2e5459ae [dev.typealias] cmd/compile: declare methods after resolving receiver type
9259f3073a [dev.typealias] test: match gccgo error messages on alias2.go
5d92916770 [dev.typealias] cmd/compile: change Func.Shortname to *Sym
a7c884efc1 [dev.typealias] go/internal/gccgoimporter: support for type aliases
5802cfd900 [dev.typealias] cmd/compile: export/import test cases for type aliases
d7cabd40dd [dev.typealias] go/types: clarified doc string
cc2dcce3d7 [dev.typealias] cmd/compile: a few better comments related to alias types
5c160b28ba [dev.typealias] cmd/compile: improved error message for cyles involving type aliases
b2386dffa1 [dev.typealias] cmd/compile: type-check type alias declarations
ac8421f9a5 [dev.typealias] cmd/compile: various minor cleanups
f011e0c6c3 [dev.typealias] cmd/compile, go/types, go/importer: various alias related fixes
49de5f0351 [dev.typealias] cmd/compile, go/importer: define export format and implement importing of type aliases
5ceec42dc0 [dev.typealias] go/types: export TypeName.IsAlias so clients can use it
aa1f0681bc [dev.typealias] go/types: improved Object printing
c80748e389 [dev.typealias] go/types: remove some more vestiges of prior alias implementation
80d8b69e95 [dev.typealias] go/types: implement type aliases
a917097b5e [dev.typealias] go/build: add go1.9 build tag
3e11940437 [dev.typealias] cmd/compile: recognize type aliases but complain for now (not yet supported)
e0a05c274a [dev.typealias] cmd/gofmt: added test cases for alias type declarations
2e5116bd99 [dev.typealias] go/ast, go/parser, go/printer, go/types: initial type alias support

Change-Id: Ia65f2e011fd7195f18e1dce67d4d49b80a261203
2017-01-31 13:01:31 -05:00
Michael Munday
96ea0918e6 cmd/compile: use CMPWU for 32-bit or smaller unsigned Geq on ppc64{,le}
Fixes #18808.

Change-Id: I49b266380b9d6804c9f6563ebac9c7c0e05f37f6
Reviewed-on: https://go-review.googlesource.com/35890
Run-TryBot: Michael Munday <munday@ca.ibm.com>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2017-01-27 16:04:04 +00:00
Matthew Dempsky
9ecc3ee252 [dev.typealias] cmd/compile: avoid false positive cycles from type aliases
For #18130.
Fixes #18640.

Change-Id: I26cf1d1b78cca6ef207cc4333f30a9011ef347c9
Reviewed-on: https://go-review.googlesource.com/35831
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
2017-01-26 18:35:13 +00:00
Matthew Dempsky
de2e5459ae [dev.typealias] cmd/compile: declare methods after resolving receiver type
For #18130.
Fixes #18655.

Change-Id: I58e2f076b9d8273f128cc033bba9edcd06c81567
Reviewed-on: https://go-review.googlesource.com/35575
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
2017-01-25 08:04:17 +00:00
Keith Randall
256a605faa cmd/compile: don't use nilcheck information until the next block
When nilcheck runs, the values in a block are not in any particular
order.  So any facts derived from examining the blocks shouldn't be
used until we reach the next block.

This is suboptimal as it won't eliminate nil checks within a block.
But it's probably a better fix for now as it is a much smaller change
than other strategies for fixing this bug.

nilptr3.go changes are mostly because for this pattern:
  _ = *p
  _ = *p
either nil check is fine to keep, and this CL changes which one
the compiler tends to keep.
There are a few regressions from code like this:
  _ = *p
  f()
  _ = *p
For this pattern, after this CL we issue 2 nil checks instead of one.
(For the curious, this happens because intra-block nil check
 elimination now falls to CSE, not nilcheck proper.  The former
 pattern has two nil checks with the same store argument.  The latter
 pattern has two nil checks with different store arguments.)

Fixes #18725

Change-Id: I3721b494c8bc9ba1142dc5c4361ea55c66920ac8
Reviewed-on: https://go-review.googlesource.com/35485
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2017-01-20 20:21:55 +00:00
Josh Bleecher Snyder
5b708a6b6a cmd/compile: lvalues are only required for == when calling runtime fns
Fixes #18661.

Change-Id: I865802a9b88ab22560c9914a70901d1924242bdc
Reviewed-on: https://go-review.googlesource.com/35236
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-01-16 05:40:45 +00:00
David Chase
d9a0579156 cmd/compile: disable flaky test
The test is inherently racy and vulnerable to starvation,
and within all.bash on some platforms that means it flakes.
Test is kept because it can be useful standalone to verify
behavior of GOEXPERIMENT=preeemptibleloops, and there is
likely to be further development of this feature in the
future.

There's also some question as to why it is flaking, because
though technically this is permitted, it's very odd in this
simple case.

Fixes #18589.

Change-Id: Ia0dd9037285c4a03122da4012c96981c9cc43b60
Reviewed-on: https://go-review.googlesource.com/35051
Run-TryBot: David Chase <drchase@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
2017-01-10 17:29:46 +00:00
David Chase
7f1ff65c39 cmd/compile: insert scheduling checks on loop backedges
Loop breaking with a counter.  Benchmarked (see comments),
eyeball checked for sanity on popular loops.  This code
ought to handle loops in general, and properly inserts phi
functions in cases where the earlier version might not have.

Includes test, plus modifications to test/run.go to deal with
timeout and killing looping test.  Tests broken by the addition
of extra code (branch frequency and live vars) for added
checks turn the check insertion off.

If GOEXPERIMENT=preemptibleloops, the compiler inserts reschedule
checks on every backedge of every reducible loop.  Alternately,
specifying GO_GCFLAGS=-d=ssa/insert_resched_checks/on will
enable it for a single compilation, but because the core Go
libraries contain some loops that may run long, this is less
likely to have the desired effect.

This is intended as a tool to help in the study and diagnosis
of GC and other latency problems, now that goal STW GC latency
is on the order of 100 microseconds or less.

Updates #17831.
Updates #10958.

Change-Id: I6206c163a5b0248e3f21eb4fc65f73a179e1f639
Reviewed-on: https://go-review.googlesource.com/33910
Run-TryBot: David Chase <drchase@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
2017-01-09 21:01:29 +00:00
Robert Griesemer
f412bd31ce cmd/compile: file line number for //go:xxx directives
Minimally invasive; fixes a regression from 1.7.

Fixes #18459.

Change-Id: I93b3b5c05706eaff8ae97a237f770838c1f8778c
Reviewed-on: https://go-review.googlesource.com/34721
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-01-09 19:39:56 +00:00
David Chase
41d2278eef cmd/compile: rewrite literal.method to ensure full initialization
CALLPART of STRUCTLIT did not check for incomplete initialization
of struct; modify PTRLIT treatment to force zeroing.

Test for structlit, believe this might have also failed for
arraylit.

Fixes #18410.

Change-Id: I511abf8ef850e300996d40568944665714efe1fc
Reviewed-on: https://go-review.googlesource.com/34622
Run-TryBot: David Chase <drchase@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
2017-01-06 20:35:52 +00:00
Emmanuel Odeke
b03dce927b cmd/compile: avoid n.Right nil dereference on non-existent interface methods
Fixes #18392.

Avoid nil dereferencing n.Right when dealing with non-existent
self referenced interface methods e.g.
type A interface{
  Fn(A.Fn)
}

Instead, infer the symbol name from n.Sym itself.

Change-Id: I60d5f8988e7318693e5c8da031285d8d7347b771
Reviewed-on: https://go-review.googlesource.com/34817
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2017-01-05 22:09:25 +00:00
Emmanuel Odeke
5bfba30d33 cmd/compile: lock-in test for repeated variables in range declaration
Fixes #6772.

Lock-in test for invalid range loop: repeated variables in range declaration.

Change-Id: I37dd8b1cd7279abe7810deaf8a5d485c5c3b73ca
Reviewed-on: https://go-review.googlesource.com/34714
Reviewed-by: Keith Randall <khr@golang.org>
2016-12-24 22:37:11 +00:00
Ian Lance Taylor
6e542dce21 test: add test gcc78763.go that caused a gccgo compiler crash
Change-Id: I0d990d494ee8eebfc804b526f5ced71944572b4d
Reviewed-on: https://go-review.googlesource.com/34491
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-12-15 22:42:33 +00:00
Vladimir Stefanovic
01b006fc18 test/fixedbugs: add mipsx case to issue11656
Change-Id: Ifcbd2ea19fc7fa832cd88aa857a5704c32eb4765
Reviewed-on: https://go-review.googlesource.com/34511
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-12-15 16:57:20 +00:00
Vladimir Stefanovic
49e5bdfe79 test: enable fixedbugs/issue10607 test on GOARCH=mips{,le}
Change-Id: I00c97c36e8fdc79582eaed21877e4c8f44568666
Reviewed-on: https://go-review.googlesource.com/34316
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-12-15 00:12:31 +00:00
Robert Griesemer
4b8895e2dd [dev.inline] cmd/compile/internal/syntax: remove gcCompat uses in scanner
- make the scanner unconditionally gc compatible
- consistently use "invalid" instead "illegal" in errors

Reviewed in and cherry-picked from https://go-review.googlesource.com/#/c/33896/.

Change-Id: I4c4253e7392f3311b0d838bbe503576c9469b203
Reviewed-on: https://go-review.googlesource.com/34237
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2016-12-09 01:35:23 +00:00
Brad Fitzpatrick
4c4201f0e2 all: make spelling consistent
Fixes #17938

Change-Id: Iad12155f4976846bd4a9a53869f89e40e5b3deb3
Reviewed-on: https://go-review.googlesource.com/34147
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Joe Tsai <thebrokentoaster@gmail.com>
2016-12-08 23:22:37 +00:00
Ian Lance Taylor
51a6d3e074 test: add bug501.go, a gccgo compiler crash
Change-Id: I271707dee03fd97cd37bfb116eb00a5532034b57
Reviewed-on: https://go-review.googlesource.com/34020
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-12-07 21:55:00 +00:00
Matthew Dempsky
749720a036 cmd/compile: fix static-initialization compilation failure
Fixes #13263.

Change-Id: Ie1cafc62b6bfe6c5381c35d9a95563267b4cc9b0
Reviewed-on: https://go-review.googlesource.com/33970
Reviewed-by: Robert Griesemer <gri@golang.org>
Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-12-06 06:14:59 +00:00
Ian Lance Taylor
6270c5ac28 test: add test case for which gccgo generated incorrect GC info
Change-Id: I5e33db9e63f70706882b85ab124a48509797b05a
Reviewed-on: https://go-review.googlesource.com/33790
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-12-02 21:29:37 +00:00
Robert Griesemer
2d136ae82e cmd/compile: correctly parse //line filename:line where filename contains ':'
This was a regression from 1.7. See the issue for details.

Fixes #18149.

Change-Id: Ic8f5a35d14edf9254b1275400316cff7aff32a27
Reviewed-on: https://go-review.googlesource.com/33799
Run-TryBot: Robert Griesemer <gri@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-12-01 22:01:33 +00:00
Robert Griesemer
8fa0d85b38 cmd/compile: don't panic on syntax error in select statement
Fixes #18092.

Change-Id: I54e2da2e0f168c068f5e4a1b22ba508d78259168
Reviewed-on: https://go-review.googlesource.com/33658
TryBot-Result: Gobot Gobot <gobot@golang.org>
Run-TryBot: Robert Griesemer <gri@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2016-11-29 16:47:34 +00:00
Brad Fitzpatrick
c2bb52b830 test: remove amd64 build tag from test
It was supposed to be testing SSA, not amd64.

For #18024

Change-Id: Ibe65d7eb6bed9bc4b3eda68e1eaec5fa39fe8f76
Reviewed-on: https://go-review.googlesource.com/33491
Reviewed-by: Keith Randall <khr@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
2016-11-23 22:01:32 +00:00
Philip Hofer
a34fddf46c cmd/compile: in cse, allow for new ssa values
The table of rewrites in ssa/cse is not sized appropriately for
ssa IDs that are created during copying of selects into new blocks.

Fixes #17918

Change-Id: I65fe86c6aab5efa679aa473aadc4ee6ea882cd41
Reviewed-on: https://go-review.googlesource.com/33240
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Reviewed-by: David Chase <drchase@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-11-18 16:31:27 +00:00
Ian Lance Taylor
4d1fdd8b5e test: add test case that failed when built with gccgo
Change-Id: Ie7512cc27436cde53b58686b32a0389849a365e4
Reviewed-on: https://go-review.googlesource.com/33249
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-11-15 21:25:44 +00:00
Dmitri Shuralyov
d8264de868 all: spell "marshal" and "unmarshal" consistently
The tree is inconsistent about single l vs double l in those
words in documentation, test messages, and one error value text.

	$ git grep -E '[Mm]arshall(|s|er|ers|ed|ing)' | wc -l
	      42
	$ git grep -E '[Mm]arshal(|s|er|ers|ed|ing)' | wc -l
	    1694

Make it consistently a single l, per earlier decisions. This means
contributors won't be confused by misleading precedence, and it helps
consistency.

Change the spelling in one error value text in newRawAttributes of
crypto/x509 package to be consistent.

This change was generated with:

	perl -i -npe 's,([Mm]arshal)l(|s|er|ers|ed|ing),$1$2,' $(git grep -l -E '[Mm]arshall' | grep -v AUTHORS | grep -v CONTRIBUTORS)

Updates #12431.
Follows https://golang.org/cl/14150.

Change-Id: I85d28a2d7692862ccb02d6a09f5d18538b6049a2
Reviewed-on: https://go-review.googlesource.com/33017
Run-TryBot: Minux Ma <minux@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-11-12 00:13:35 +00:00
Michael Munday
6c2a35ae0c test/fixedbugs: enable issue 10607 test on ppc64le
ppc64le supports both internal and external linking so I don't
think there is any reason for it to skip this test.

Change-Id: I05c80cc25909c0364f0a1fb7d20766b011ea1ebb
Reviewed-on: https://go-review.googlesource.com/32854
Reviewed-by: Lynn Boger <laboger@linux.vnet.ibm.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-11-07 18:42:57 +00:00
Vladimir Stefanovic
3f69909851 test: disable unsupported test for GOARCH=mips{,le}
External linking on mips/mipsle is not supported yet (issue #17792).

Change-Id: Ic25f4f8fe9e0ec35c72ca9f85c053b398df4952c
Reviewed-on: https://go-review.googlesource.com/31512
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-11-04 16:46:38 +00:00
Matthew Dempsky
3797446150 cmd/compile: prevent Noalg from breaking user types
Use a separate symbol for reflect metadata for types with Noalg set.

Fixes #17752.

Change-Id: Icb6cade7e3004fc4108f67df61105dc4085cd7e2
Reviewed-on: https://go-review.googlesource.com/32679
Reviewed-by: David Crawshaw <crawshaw@golang.org>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-11-04 00:11:28 +00:00
Keith Randall
cf28e5cc9d cmd/compile: compute faulting args before writing args to stack
when compiling f(a, b, c), we do something like:
  *(SP+0) = eval(a)
  *(SP+8) = eval(b)
  *(SP+16) = eval(c)
  call f

If one of those evaluations is later determined to unconditionally panic
(say eval(b) in this example), then the call is deadcode eliminated. But
any previous argument write (*(SP+0)=... here) is still around. Becuase
we only compute the size of the outarg area for calls which are still
around at the end of optimization, the space needed for *(SP+0)=v is not
accounted for and thus the outarg area may be too small.

The fix is to make sure that we evaluate any potentially panicing
operation before we write any of the args to the stack. It turns out
that fix is pretty easy, as we already have such a mechanism available
for function args. We just need to extend it to possibly panicing args
as well.

The resulting code (if b and c can panic, but a can't) is:
  tmpb = eval(b)
  *(SP+16) = eval(c)
  *(SP+0) = eval(a)
  *(SP+8) = tmpb
  call f

This change tickled a bug in how we find the arguments for intrinsic
calls, so that latent bug is fixed up as well.

Update #16760.

Change-Id: I0bf5edf370220f82bc036cf2085ecc24f356d166
Reviewed-on: https://go-review.googlesource.com/32551
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2016-11-02 21:34:12 +00:00
Keith Randall
761443edd5 cmd/compile: On a runtime.KeepAlive call, keep whole variable alive
We generate an OpKeepAlive for the idata portion of the interface
for a runtime.KeepAlive call.  But given such an op, we need to keep
the entire containing variable alive, not just the range that was
passed to the OpKeepAlive operation.

Fixes #17710

Change-Id: I90de66ec8065e22fb09bcf9722999ddda289ae6e
Reviewed-on: https://go-review.googlesource.com/32477
Run-TryBot: Keith Randall <khr@golang.org>
Reviewed-by: Joe Tsai <thebrokentoaster@gmail.com>
2016-11-02 21:29:41 +00:00
Dhananjay Nakrani
9a8bf2d67d cmd/compile: avoid nil-ing out a node's Type in typecheckcomplit() on error
typecheckcomplit nils out node's type, upon finding new errors.
This hides new errors in children's node as well as the type info
of current node. This change fixes that.

Fixes #17645.

Change-Id: Ib473291f31c7e8fa0307cb1d494e0c112ddd3583
Reviewed-on: https://go-review.googlesource.com/32324
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-10-31 22:29:40 +00:00
Dhananjay Nakrani
f46239b85c cmd/compile: initialize Decldepth in all cases
Previously, on encountering Func.Nname.Type == nil, typecheckfunc()
returned without initializing Decldepth for that func. This causes
typecheckclosure() to fatal. This change ensures that we initialize
Decldepth in all cases.

Fixes #17588.

Change-Id: I2e3c81ad52e8383395025388989e8dbf03438b68
Reviewed-on: https://go-review.googlesource.com/32415
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-10-31 19:48:17 +00:00
David Chase
9c066bab64 cmd/compile: mark temps with new AutoTemp flag, and use it.
This is an extension of
https://go-review.googlesource.com/c/31662/
to mark all the temporaries, not just the ssa-generated ones.

Before-and-after ls -l `go tool -n compile` shows a 3%
reduction in size (or rather, a prior 3% inflation for
failing to filter temps out properly.)

Replaced name-dependent "is it a temp?" tests with calls to
*Node.IsAutoTmp(), which depends on AutoTemp.  Also replace
calls to istemp(n) with n.IsAutoTmp(), to reduce duplication
and clean up function name space.  Generated temporaries
now come with a "." prefix to avoid (apparently harmless)
clashes with legal Go variable names.

Fixes #17644.
Fixes #17240.

Change-Id: If1417f29c79a7275d7303ddf859b51472890fd43
Reviewed-on: https://go-review.googlesource.com/32255
Run-TryBot: David Chase <drchase@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2016-10-31 19:38:50 +00:00