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

1838 Commits

Author SHA1 Message Date
Ian Lance Taylor
4da408f676 test: match gccgo error messages for blank1.go
blank1.go:10:9: error: invalid package name _
blank1.go:17:2: error: cannot use _ as value
blank1.go:18:7: error: cannot use _ as value
blank1.go:20:8: error: invalid use of ‘_’

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/14088044
2013-09-28 15:19:05 -07:00
Ian Lance Taylor
bdafe73ce4 test: recognize gccgo error message in index.go
When a floating point constant is used as an array/slice
index, gccgo prints "error: index must be integer"; gc prints
"constant 2.1 truncated to integer".

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/14044044
2013-09-27 20:38:52 -07:00
Carl Shapiro
1c45f98fa3 test/chan: avoid wrap-around in memstats comparison
The select2.go test assumed that the memory allocated between
its two samplings of runtime.ReadMemStats is strictly
increasing.  To avoid failing the tests when this is not true,
a greater-than check is introduced before computing the
difference in allocated memory.

R=golang-dev, r, cshapiro
CC=golang-dev
https://golang.org/cl/13701046
2013-09-20 17:27:56 -07:00
Russ Cox
8ce9a4fd26 test/run: print command line for running an individual test
Fixes #5087.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/13812043
2013-09-20 15:25:59 -04:00
Russ Cox
5be1821a31 cmd/gc: fix imported and not used error for import .
Fixes issues 6420.

R=ken2
CC=golang-dev
https://golang.org/cl/13703044
2013-09-20 15:25:43 -04:00
Robert Griesemer
81dc0b65b2 test/fixedbugs/bug295.go: fix test in anticipation of future gc fix
See also issue 6428.

R=r, rsc
CC=golang-dev
https://golang.org/cl/13794043
2013-09-20 09:40:56 -07:00
Ian Lance Taylor
1325732ab9 test: add a test that causes gccgo to get a failure at link time
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/13788043
2013-09-19 15:20:39 -07:00
Ian Lance Taylor
4182889a09 test: add a test that gccgo failed to compile
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/13632057
2013-09-18 16:30:38 -07:00
Ian Lance Taylor
45e214fb62 test: add a test that gccgo failed to compile
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/13451045
2013-09-18 15:47:50 -07:00
Alan Donovan
3ddf5a655e test: disable failing tests under ssa/interp.
R=gri
CC=golang-dev
https://golang.org/cl/13471045
2013-09-18 14:44:57 -04:00
Ian Lance Taylor
e27b0cdfc4 test: add a test that crashed gccgo
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/13683046
2013-09-17 18:06:58 -07:00
Robert Griesemer
99d87720ad test: avoid future 'declared and not used' error
See also issue 6414.

R=r
CC=golang-dev
https://golang.org/cl/13683044
2013-09-17 15:24:54 -07:00
Russ Cox
aa0439ba65 cmd/gc: eliminate redundant &x.Field nil checks
This eliminates ~75% of the nil checks being emitted,
on all architectures. We can do better, but we need
a bit more general support from the compiler, and
I don't want to do that so close to Go 1.2.
What's here is simple but effective and safe.

A few small code generation cleanups were required
to make the analysis consistent on all systems about
which nil checks are omitted, at least in the test.

Fixes #6019.

R=ken2
CC=golang-dev
https://golang.org/cl/13334052
2013-09-17 16:54:22 -04:00
Russ Cox
51266761fd cmd/gc: fix divide by zero error in compiler
Fixes #6399.

R=ken2
CC=golang-dev
https://golang.org/cl/13253055
2013-09-16 14:22:37 -04:00
Russ Cox
b2794a1c2e runtime: make ARM integer div-by-zero traceback-friendly
The implementation of division in the 5 toolchain is a bit too magical.
Hide the magic from the traceback routines.

Also add a test for the results of the software divide routine.

Fixes #5805.

R=golang-dev, minux.ma
CC=golang-dev
https://golang.org/cl/13239052
2013-09-16 14:04:45 -04:00
Russ Cox
7276c02b41 runtime, cmd/gc, cmd/ld: ignore method wrappers in recover
Bug #1:

Issue 5406 identified an interesting case:
        defer iface.M()
may end up calling a wrapper that copies an indirect receiver
from the iface value and then calls the real M method. That's
two calls down, not just one, and so recover() == nil always
in the real M method, even during a panic.

[For the purposes of this entire discussion, a wrapper's
implementation is a function containing an ordinary call, not
the optimized tail call form that is somtimes possible. The
tail call does not create a second frame, so it is already
handled correctly.]

Fix this bug by introducing g->panicwrap, which counts the
number of bytes on current stack segment that are due to
wrapper calls that should not count against the recover
check. All wrapper functions must now adjust g->panicwrap up
on entry and back down on exit. This adds slightly to their
expense; on the x86 it is a single instruction at entry and
exit; on the ARM it is three. However, the alternative is to
make a call to recover depend on being able to walk the stack,
which I very much want to avoid. We have enough problems
walking the stack for garbage collection and profiling.
Also, if performance is critical in a specific case, it is already
faster to use a pointer receiver and avoid this kind of wrapper
entirely.

Bug #2:

The old code, which did not consider the possibility of two
calls, already contained a check to see if the call had split
its stack and so the panic-created segment was one behind the
current segment. In the wrapper case, both of the two calls
might split their stacks, so the panic-created segment can be
two behind the current segment.

Fix this by propagating the Stktop.panic flag forward during
stack splits instead of looking backward during recover.

Fixes #5406.

R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/13367052
2013-09-12 14:00:16 -04:00
Rémy Oudompheng
9c21ce54dd cmd/6g: handle very wide offsets.
Fixes #6036.

R=golang-dev, bradfitz, rsc
CC=golang-dev
https://golang.org/cl/12992043
2013-09-09 20:36:19 +02:00
Russ Cox
933d7129c0 cmd/gc: squelch spurious "invalid recursive type" error
R=ken2
CC=golang-dev
https://golang.org/cl/13512047
2013-09-09 13:03:59 -04:00
Russ Cox
903c2fda18 cmd/gc: diagnose '_ = nil' better
Fixes #6004.

R=ken2
CC=golang-dev
https://golang.org/cl/13616044
2013-09-09 12:49:39 -04:00
Russ Cox
8d530f2472 cmd/gc: show package name in 'imported and not used' error
Fixes #5957.

R=ken2
CC=golang-dev
https://golang.org/cl/13250046
2013-09-09 12:21:09 -04:00
Russ Cox
a7d8b35aac cmd/gc: fix 'internal error: typename ideal bool'
Fixes #6298.

R=ken2
CC=golang-dev
https://golang.org/cl/13624043
2013-09-09 12:00:16 -04:00
Rémy Oudompheng
c929ac5f7e cmd/gc: add missing typecheck for walk-generated constants.
Fixes #6131.

R=golang-dev, daniel.morsing, rsc
CC=golang-dev
https://golang.org/cl/12800045
2013-09-06 16:55:30 -04:00
Russ Cox
17e5539f7d test: fix build (update for new error message)
R=golang-dev
CC=golang-dev
https://golang.org/cl/13521044
2013-09-06 16:15:30 -04:00
Russ Cox
1116f74e08 test/nilptr: add more tests
These tests were suggested in golang.org/issue/6080.
They were fixed as part of the new nil pointer checks
that I added a few weeks ago.

Recording the tests as part of marking the issue closed.

Fixes #6080.

R=golang-dev, r, bradfitz
CC=golang-dev
https://golang.org/cl/13255049
2013-09-05 23:06:34 -04:00
Daniel Morsing
280c8b90e2 cmd/gc: make method names for function scoped types unique
Types in function scope can have methods on them if they embed another type, but we didn't make the name unique, meaning that 2 identically named types in different functions would conflict with eachother.

Fixes #6269.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/13326045
2013-08-29 16:48:44 +02:00
Rémy Oudompheng
66c8935f73 cmd/gc: fix detection of initialization loop.
The compiler computes initialization order by finding
a spanning tree between a package's global variables.
But it does so by walking both variables and functions
and stops detecting cycles between variables when they
mix with a cycle of mutually recursive functions.

Fixes #4847.

R=golang-dev, daniel.morsing, rsc
CC=golang-dev
https://golang.org/cl/9663047
2013-08-29 10:16:09 +02:00
Rémy Oudompheng
a9e119ac70 cmd/gc: fix method values whose receiver is an unnamed interface.
Fixes #6140.

R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/13083043
2013-08-29 10:00:58 +02:00
Rémy Oudompheng
a85cfbd433 cmd/gc: tag builtin error, byte, rune to avoid exporting them.
Fixes #5910.
Fixes #6260.

R=golang-dev, daniel.morsing
CC=golang-dev
https://golang.org/cl/13257044
2013-08-27 21:18:32 +02:00
Rémy Oudompheng
4fc7ff497d cmd/5g: avoid clash between R13 and F3 registers.
Fixes #6247.

R=golang-dev, lucio.dere, bradfitz
CC=golang-dev
https://golang.org/cl/13216043
2013-08-27 21:09:16 +02:00
Alan Donovan
d96de0633c test: exit non-zero on error from nilptr2.go.
(For go.tools/ssa/interp/interp_test, which runs a subset of
these tests under this assumption.)

R=rsc, r
CC=golang-dev
https://golang.org/cl/13108043
2013-08-19 17:50:22 -04:00
Rob Pike
a8fe176156 test: fix build
syntax/*: update messages
sliceerr3.go: bizarre new error fixed by deleting a space.

I could have sworn I ran all.bash before submitting the CL that triggered these.

TBR=golang-dev@googlegroups.com

R=golang-dev
CC=golang-dev
https://golang.org/cl/12812044
2013-08-19 12:05:33 +10:00
Anthony Martin
f316a7ea87 cmd/gc: don't attempt to generate wrappers for blank interface methods
Fixes #5691.

R=golang-dev, bradfitz, daniel.morsing, rsc
CC=golang-dev
https://golang.org/cl/10255047
2013-08-19 11:53:34 +10:00
Dmitriy Vyukov
eaa0704483 test: say that nilptr2.go requires 256+MB stack
Fixes #6161.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/13059043
2013-08-16 21:14:38 +04:00
Russ Cox
999a36f9af cmd/gc: &x panics if x does
See golang.org/s/go12nil.

This CL is about getting all the right checks inserted.
A followup CL will add an optimization pass to
remove redundant checks.

R=ken2
CC=golang-dev
https://golang.org/cl/12970043
2013-08-15 14:38:32 -04:00
Russ Cox
08fdf00906 tests: remove two misuses of nil pointers
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/12858044
2013-08-15 11:51:04 -04:00
Anthony Martin
a538558003 test/run: process build tags like go/build
R=bradfitz, dave, rsc, r
CC=golang-dev
https://golang.org/cl/10001045
2013-08-13 12:25:41 -04:00
Keith Randall
36f223dace runtime: Better test tracebackability of jmpdefer when running a nil defer.
R=bradfitz, dvyukov
CC=golang-dev
https://golang.org/cl/12536046
2013-08-09 15:27:45 -07:00
Ian Lance Taylor
58845656e8 test: update bug086.go for current gccgo behaviour
bug086.go:14:1: error: missing return at end of function

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/12697043
2013-08-09 08:43:19 -07:00
Rick Arnold
66e8471391 cmd/gc: make missing package error fatal
No longer continue assuming package main.

Fixes #4776.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/12677043
2013-08-09 16:05:40 +10:00
Russ Cox
1f4d58ad5d cmd/gc: move large stack variables to heap
Individual variables bigger than 10 MB are now
moved to the heap, as if they had escaped on
their own.

This avoids ridiculous stacks for programs that
do things like
        x := [1<<30]byte{}
        ... use x ...

If 10 MB is too small, we can raise the limit.

Fixes #6077.

R=ken2
CC=golang-dev
https://golang.org/cl/12650045
2013-08-08 13:46:30 -04:00
Keith Randall
a97a91de06 runtime: Record jmpdefer's argument size.
Fixes bug 6055.

R=golang-dev, bradfitz, dvyukov, khr
CC=golang-dev
https://golang.org/cl/12536045
2013-08-07 14:03:50 -07:00
Ian Lance Taylor
2b45124a59 test: add cases to return.go that gccgo got wrong
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/12620043
2013-08-07 11:31:01 -07:00
Ian Lance Taylor
96c583b84c test: fix return.go to remove unused labels
The gc compiler only gives an error about an unused label if
it has not given any errors in an earlier pass.  Remove all
unused labels in this test because they don't test anything
useful and they cause gccgo to give unexpected errors.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/12580044
2013-08-07 11:19:07 -07:00
Ian Lance Taylor
5e0278b7a0 test: fix return.go to not use fallthrough in a type switch
The gc compiler only gives an error about fallthrough in a
type switch if it has not given any errors in an earlier pass.
Remove all functions in this test that use fallthrough in a
type switch because they don't test anything useful and they
cause gccgo to give unexpected errors.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/12614043
2013-08-07 11:05:19 -07:00
Rémy Oudompheng
49da9a8e44 cmd/gc: fix inlining of unnamed structs with embedded fields.
Update #5910.

R=golang-dev, daniel.morsing, rsc
CC=golang-dev
https://golang.org/cl/11373044
2013-08-05 22:09:53 +02:00
Russ Cox
27d17255db cmd/gc: insert \n at end of every input file
Not just the first one.

Fixes #5433.
Fixes #5913.

R=ken2
CC=golang-dev
https://golang.org/cl/12028049
2013-07-30 10:27:08 -04:00
Russ Cox
14062efb16 runtime: handle runtime.Goexit during init
Fixes #5963.

R=golang-dev, dsymonds, dvyukov
CC=golang-dev
https://golang.org/cl/11879045
2013-07-26 13:54:44 -04:00
Rémy Oudompheng
d7c99cdf9f cmd/gc: avoid passing unevaluated constant expressions to backends.
Backends do not exactly expect receiving binary operators with
constant operands or use workarounds to move them to
register/stack in order to handle them.

Fixes #5841.

R=golang-dev, daniel.morsing, rsc
CC=golang-dev
https://golang.org/cl/11107044
2013-07-25 09:42:05 -04:00
Dmitriy Vyukov
e242562506 test: fix error output in the test
R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/11432046
2013-07-19 17:48:19 +04:00
Daniel Morsing
85a7c090c4 cmd/8g: Make clearfat non-interleaved with pointer calculations.
clearfat (used to zero initialize structures) will use AX for x86 block ops. If we write to AX while calculating the dest pointer, we will fill the structure with incorrect values.
Since 64-bit arithmetic uses AX to synthesize a 64-bit register, getting an adress by indexing with 64-bit ops can clobber the register.

Fixes #5820.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/11383043
2013-07-17 11:04:34 +02:00