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

879 Commits

Author SHA1 Message Date
Russ Cox
cb856adea9 cmd/gc: annotate local variables with unique ids for inlining
Avoids problems with local declarations shadowing other names.
We write a more explicit form than the incoming program, so there
may be additional type annotations. For example:

        int := "hello"
        j := 2

would normally turn into

        var int string = "hello"
        var j int = 2

but the int variable shadows the int type in the second line.

This CL marks all local variables with a per-function sequence number,
so that this would instead be:

        var int·1 string = "hello"
        var j·2 int = 2

Fixes #4326.

R=ken2
CC=golang-dev
https://golang.org/cl/6816100
2012-11-07 09:59:19 -05:00
Rémy Oudompheng
1e233ad075 cmd/6g: fix use of large integers as indexes or array sizes.
A check for smallintconst was missing before generating the
comparisons.

Fixes #4348.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6815088
2012-11-06 22:53:57 +01:00
Rémy Oudompheng
8d95245d0d cmd/gc: fix incomplete export data when inlining with local variables.
When local declarations needed unexported types, these could
be missing in the export data.

Fixes build with -gcflags -lll, except for exp/gotype.

R=golang-dev, rsc, lvd
CC=golang-dev
https://golang.org/cl/6813067
2012-11-01 19:06:52 +01:00
Rémy Oudompheng
76500b14a1 cmd/gc: fix inlining bug with local variables.
Fixes #4323.

R=rsc, lvd, golang-dev
CC=golang-dev
https://golang.org/cl/6815061
2012-11-01 18:59:32 +01:00
Ian Lance Taylor
7dc1182c27 test: match gccgo error messages for bug358.go
I fixed a bug in gccgo that was causing it to only give an
error for the first package that was imported and not used.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/6813058
2012-10-30 20:56:32 -07:00
Daniel Morsing
48af64b295 cmd/gc: Mark use of builtin functions as calls.
Fixes #4097.

R=rsc
CC=golang-dev, gri
https://golang.org/cl/6749059
2012-10-22 19:14:30 +02:00
Rémy Oudompheng
319131f295 cmd/gc: fix inlining bug for composite literals in if statements.
Fixes #4230.

R=golang-dev, rsc
CC=golang-dev, remy
https://golang.org/cl/6640056
2012-10-22 08:38:23 +02:00
Daniel Morsing
d7a3407e3d cmd/gc: fix confusing error when using variable as type.
Fixes #3783.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6737053
2012-10-21 20:50:31 +02:00
Daniel Morsing
a7a3fe7238 cmd/gc: Friendlier errors on oversized arrays.
Someone new to the language may not know the connection between ints and arrays, which was the only thing that the previous error told you anything about.

Fixes #4256.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6739048
2012-10-21 19:22:51 +02:00
Rémy Oudompheng
a4682348c2 cmd/gc: don't squash complex literals when inlining.
Since this patch changes the way complex literals are written
in export data, there are a few other glitches.

Fixes #4159.

R=golang-dev, rsc
CC=golang-dev, remy
https://golang.org/cl/6674047
2012-10-17 20:33:44 +02:00
Rémy Oudompheng
dda1b560ec test: convert tests to run.go whenever possible.
The other tests either need a complex procedure
or are architecture- or OS-dependent.

Update #4139.

R=golang-dev, daniel.morsing, iant
CC=golang-dev
https://golang.org/cl/6618062
2012-10-10 22:35:27 +02:00
David Symonds
f8b5838123 testing: change -test.benchtime to a flag.Duration.
Fixes #3902.

R=golang-dev, minux.ma, rsc, r
CC=golang-dev
https://golang.org/cl/6611059
2012-10-09 08:57:29 +11:00
Rémy Oudompheng
46bce2ac27 test: convert more tests to rundir/compiledir conventions
Update #4139.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6609051
2012-10-07 23:22:01 +02:00
Rémy Oudompheng
d9953c9dde test: use rundir and errorcheckdir for a few more tests.
Update #4139.

R=golang-dev, minux.ma
CC=golang-dev
https://golang.org/cl/6620070
2012-10-07 18:37:05 +02:00
Rémy Oudompheng
892fa3ae6c cmd/gc: replace "typechecking loop" by nicer errors in some cases.
For issue 3757:
BEFORE:  test/fixedbugs/bug463.go:12: typechecking loop involving a
             test/fixedbugs/bug463.go:12 a
             test/fixedbugs/bug463.go:12 <node DCLCONST>
AFTER:   test/fixedbugs/bug463.go:12: constant definition loop
             test/fixedbugs/bug463.go:12: a uses a

For issue 3937:
BEFORE: test/fixedbugs/bug464.go:12: typechecking loop involving foo
            test/fixedbugs/bug464.go:12 <T>
            test/fixedbugs/bug464.go:12 foo
            test/fixedbugs/bug464.go:12 <node DCLFUNC>
AFTER:  test/fixedbugs/bug464.go:12: foo is not a type

Fixes #3757.
Fixes #3937.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6614058
2012-10-07 17:35:21 +02:00
Daniel Morsing
87c35d8df1 cmd/gc: Don't accept qualified names as literal keys
Fixes #4067.

R=golang-dev, minux.ma, dave, rsc
CC=golang-dev
https://golang.org/cl/6622056
2012-10-07 16:47:53 +02:00
Daniel Morsing
a45777fe99 cmd/gc: Don't export embedded builtins
Fixes #4124.

R=golang-dev, dave, minux.ma, remyoudompheng, rsc
CC=golang-dev
https://golang.org/cl/6543057
2012-10-07 06:53:57 +02:00
Rémy Oudompheng
0b2ca9e62f cmd/gc: avoid clobbering the AST in cgen_callmeth.
It confused the detection of init loops when involving
method calls.

Fixes #3890.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6620067
2012-10-07 00:52:40 +02:00
Rémy Oudompheng
94acfde22e cmd/gc: make rnd() more 64-bit-friendly.
Fixes #4200.

R=golang-dev, dave, rsc
CC=golang-dev
https://golang.org/cl/6619057
2012-10-07 00:29:55 +02:00
Rémy Oudompheng
782464aea5 runtime: fix a panic when growing zero-width-element slices.
Fixes #4197.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/6611056
2012-10-06 12:05:52 +02:00
Rémy Oudompheng
4bb75cd9ad test/fixedbugs: forgotten test cases for issues 3907 and 4156.
Update #3907.
Update #4156.

R=golang-dev, dave
CC=golang-dev
https://golang.org/cl/6595044
2012-09-30 10:35:09 +02:00
Shenghou Ma
9a3bc51c81 test/fixedbugs/bug454.go: add a test for CL 6564052
Also mention that ignoring second blank identifier of range is required by the spec in the code.

   Fixes #4173.

R=daniel.morsing, remyoudompheng, r
CC=golang-dev
https://golang.org/cl/6594043
2012-09-29 23:23:56 +08:00
Ian Lance Taylor
6ed800c01d test: match gccgo error messages
const1.go:31:12: error: integer constant overflow
const1.go:31:12: error: integer constant overflow
const1.go:33:12: error: integer constant overflow
const1.go:33:12: error: integer constant overflow
const1.go:34:14: error: integer constant overflow
const1.go:35:17: error: integer constant overflow
const1.go:35:17: error: integer constant overflow
const1.go:35:17: error: integer constant overflow
const1.go:35:17: error: integer constant overflow
const1.go:35:17: error: integer constant overflow
const1.go:36:19: error: integer constant overflow
const1.go:37:15: error: integer constant overflow
const1.go:37:15: error: integer constant overflow
const1.go:37:24: error: integer constant overflow
const1.go:37:15: error: integer constant overflow
const1.go:37:15: error: integer constant overflow
const1.go:37:15: error: integer constant overflow
const1.go:37:24: error: integer constant overflow
const1.go:37:15: error: integer constant overflow
const1.go:38:12: error: integer constant overflow
const1.go:38:12: error: integer constant overflow
const1.go:38:12: error: integer constant overflow
const1.go:38:12: error: integer constant overflow
const1.go:41:20: error: integer constant overflow
const1.go:41:20: error: integer constant overflow
const1.go:42:20: error: integer constant overflow
const1.go:42:20: error: integer constant overflow
const1.go:44:28: error: integer constant overflow
const1.go:44:28: error: integer constant overflow
const1.go:45:14: error: integer constant overflow
const1.go:49:14: error: integer constant overflow
const1.go:50:14: error: integer constant overflow
const1.go:51:14: error: integer constant overflow
const1.go:54:23: error: integer constant overflow
const1.go:54:23: error: integer constant overflow
const1.go:54:23: error: integer constant overflow
const1.go:54:23: error: integer constant overflow
const1.go:56:14: error: integer constant overflow
const1.go:57:24: error: integer constant overflow
const1.go:57:24: error: integer constant overflow
const1.go:58:24: error: integer constant overflow
const1.go:58:24: error: integer constant overflow
const1.go:59:22: error: integer constant overflow
const1.go:59:22: error: integer constant overflow
const1.go:61:24: error: integer constant overflow
const1.go:62:20: error: division by zero
const1.go:65:19: error: floating point constant overflow
const1.go:65:19: error: floating point constant overflow
const1.go:66:28: error: floating point constant overflow
const1.go:66:28: error: floating point constant overflow
const1.go:67:19: error: floating point constant overflow
const1.go:67:19: error: floating point constant overflow
const1.go:68:19: error: division by zero
const1.go:33:14: error: integer constant overflow
const1.go:35:19: error: integer constant overflow
const1.go:42:22: error: integer constant overflow
const1.go:53:17: error: integer constant overflow
const1.go:55:14: error: integer constant overflow
const1.go:59:24: error: integer constant overflow
const1.go:69:20: error: expected integer type
const1.go:75:4: error: argument 1 has incompatible type (cannot use type int8 as type int)
const1.go:76:4: error: argument 1 has incompatible type (cannot use type int8 as type int)
const1.go:77:4: error: argument 1 has incompatible type (cannot use type uint8 as type int)
const1.go:79:4: error: argument 1 has incompatible type (cannot use type float32 as type int)
const1.go:80:4: error: argument 1 has incompatible type (cannot use type float64 as type int)
const1.go:81:4: error: floating point constant truncated to integer
const1.go:83:4: error: argument 1 has incompatible type (cannot use type float64 as type int)
const1.go:84:4: error: argument 1 has incompatible type (cannot use type string as type int)
const1.go:85:4: error: argument 1 has incompatible type (cannot use type bool as type int)
const1.go:88:7: error: const initializer cannot be nil

const2.go:14:8: error: expected ‘=’

const5.go:27:7: error: expression is not constant
const5.go:28:7: error: expression is not constant
const5.go:30:7: error: expression is not constant
const5.go:31:7: error: expression is not constant

ddd1.go:57:23: error: invalid use of ‘...’ in type conversion
ddd1.go:59:6: error: invalid use of ‘...’ in type conversion
ddd1.go:60:12: error: use of ‘[...]’ outside of array literal
ddd1.go:21:15: error: argument 1 has incompatible type
ddd1.go:22:10: error: argument 1 has incompatible type
ddd1.go:30:6: error: invalid use of ‘...’ with non-slice
ddd1.go:30:6: error: invalid use of ‘...’ with non-slice
ddd1.go:46:2: error: invalid use of %<...%> with builtin function
ddd1.go:47:2: error: invalid use of %<...%> with builtin function
ddd1.go:49:2: error: invalid use of %<...%> with builtin function
ddd1.go:50:6: error: invalid use of %<...%> with builtin function
ddd1.go:51:6: error: invalid use of %<...%> with builtin function
ddd1.go:53:6: error: invalid use of %<...%> with builtin function
ddd1.go:58:13: error: invalid use of %<...%> with builtin function
ddd1.go:20:10: error: floating point constant truncated to integer
ddd1.go:32:6: error: invalid use of ‘...’ calling non-variadic function

declbad.go:20:3: error: variables redeclared but no variable is new
declbad.go:38:3: error: variables redeclared but no variable is new
declbad.go:44:3: error: variables redeclared but no variable is new
declbad.go:51:3: error: variables redeclared but no variable is new
declbad.go:57:3: error: variables redeclared but no variable is new
declbad.go:63:3: error: variables redeclared but no variable is new
declbad.go:26:3: error: incompatible types in assignment (cannot use type float32 as type int)
declbad.go:32:3: error: incompatible types in assignment (cannot use type int as type float32)
declbad.go:44:3: error: incompatible types in assignment (different number of results)

fixedbugs/bug223.go:21:5: error: initialization expression for ‘m’ depends upon itself

fixedbugs/bug412.go:10:2: error: duplicate field name ‘x’

fixedbugs/bug413.go:11:5: error: initialization expression for ‘i’ depends upon itself

fixedbugs/bug416.go:13:1: error: method ‘X’ redeclares struct field name

fixedbugs/bug435.go:15:49: error: missing ‘)’
fixedbugs/bug435.go:15:2: error: reference to undefined name ‘bar’

fixedbugs/bug451.go:9:9: error: expected package

typeswitch3.go:39:9: error: no new variables on left side of ‘:=’
typeswitch3.go:24:2: error: impossible type switch case (type has no methods)

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6560063
2012-09-28 08:30:30 -07:00
Russ Cox
0d82e69811 test: prepare for 64-bit ints
Minor tweaks to avoid assuming that int is always 32 bits.

Update #2188.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/6553062
2012-09-24 00:06:41 -04:00
Russ Cox
cd22afa07b test: expand run.go's errorcheck, make clear which bugs run
Today, if run.go doesn't understand a test header line it just ignores
the test, making it too easy to write or edit tests that are not actually
being run.

- expand errorcheck to accept flags, so that bounds.go and escape*.go can run.
- create a whitelist of skippable tests in run.go; skipping others is an error.
- mark all skipped tests at top of file.

Update #4139.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/6549054
2012-09-23 13:16:14 -04:00
Rémy Oudompheng
36df358a30 cmd/6g: fix internal error with SSE registers.
Revision 63f7abcae015 introduced a bug caused by
code assuming registers started at X5, not X0.

Fixes #4138.

R=rsc
CC=golang-dev, remy
https://golang.org/cl/6558043
2012-09-23 18:22:03 +02:00
Russ Cox
05ac300830 cmd/gc: fix use of nil interface, slice
Fixes #3670.

R=ken2
CC=golang-dev
https://golang.org/cl/6542058
2012-09-22 20:42:11 -04:00
Adam Langley
2c5b53866c undo CL 6498092 / 4ff71bc1a199
Broke tests on 386.

««« original CL description
6l/8l: emit correct opcodes to F(SUB|DIV)R?D.

When the destination was not F0, 6l and 8l swapped FSUBD/FSUBRD and
FDIVD/FDIVRD.

R=golang-dev, dave, rsc
CC=golang-dev
https://golang.org/cl/6498092
»»»

R=golang-dev
CC=golang-dev
https://golang.org/cl/6492100
2012-09-10 15:52:36 -04:00
Adam Langley
72fa142fc5 6l/8l: emit correct opcodes to F(SUB|DIV)R?D.
When the destination was not F0, 6l and 8l swapped FSUBD/FSUBRD and
FDIVD/FDIVRD.

R=golang-dev, dave, rsc
CC=golang-dev
https://golang.org/cl/6498092
2012-09-10 15:35:39 -04:00
Rémy Oudompheng
8f3c2055bd cmd/6g, cmd/8g: eliminate short integer arithmetic when possible.
Fixes #3909.
Fixes #3910.

R=rsc, nigeltao
CC=golang-dev
https://golang.org/cl/6442114
2012-09-01 16:40:54 +02:00
Russ Cox
6d0e3242eb test: restore nigel's bug451 as bug452.
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/6497066
2012-08-31 15:43:27 -04:00
Daniel Morsing
85ce3c7241 cmd/gc: mark broken type declarations as broken.
This fixes a spurious 'invalid recursive type' error, and stops the compiler from emitting errors on uses of the invalid type.

Fixes #3766.

R=golang-dev, dave, minux.ma, rsc
CC=golang-dev
https://golang.org/cl/6443100
2012-08-31 13:02:29 -04:00
Rémy Oudompheng
a85fa33ece test: use run.go for more tests.
R=golang-dev, alex.brainman, minux.ma
CC=golang-dev
https://golang.org/cl/6443110
2012-08-25 10:16:02 +02:00
Shenghou Ma
e80f6a4de1 cmd/6g: fix float32/64->uint64 conversion
CVTSS2SQ's rounding mode is controlled by the RC field of MXCSR;
as we specifically need truncate semantic, we should use CVTTSS2SQ.

    Fixes #3804.

R=rsc, r
CC=golang-dev
https://golang.org/cl/6352079
2012-08-23 14:35:26 +08:00
Nigel Tao
251199c430 cmd/8g: roll back the small integer constant optimizations introduced
in 13416:67c0b8c8fb29 "faster code, mainly for rotate" [1]. The codegen
can run out of registers if there are too many small-int arithmetic ops.

An alternative approach is to copy 6g's sbop/abop codegen to 8g, but
this change is less risky.

Fixes #3835.

[1] http://code.google.com/p/go/source/diff?spec=svn67c0b8c8fb29b1b7b6221977af6b89cae787b941&name=67c0b8c8fb29&r=67c0b8c8fb29b1b7b6221977af6b89cae787b941&format=side&path=/src/cmd/8g/cgen.c

R=rsc, remyoudompheng, r
CC=golang-dev
https://golang.org/cl/6450163
2012-08-23 16:17:22 +10:00
Rémy Oudompheng
823962c521 cmd/8g: fix miscompilation due to BADWIDTH.
Fixes #3899.

R=rsc
CC=golang-dev, remy
https://golang.org/cl/6453084
2012-08-03 22:05:51 +02:00
Shenghou Ma
e07958f7df runtime: round return value address in runtime.equal
Fixes #3866.

R=rsc, r, nigeltao
CC=golang-dev
https://golang.org/cl/6452046
2012-07-31 23:02:46 -04:00
Rémy Oudompheng
b6ea905ed9 cmd/gc: fix inlining bug with receive operator.
The receive operator was given incorrect precedence
resulting in incorrect deletion of parentheses.

Fixes #3843.

R=rsc
CC=golang-dev, remy
https://golang.org/cl/6442049
2012-08-01 00:45:26 +02:00
Rémy Oudompheng
adc9337262 test: add a compiledir pattern in run.go
The compiledir pattern compiles all files xxx.dir/*.go
in lexicographic order (which is assumed to coincide with
the topological order of dependencies).

R=rsc
CC=golang-dev, remy
https://golang.org/cl/6440048
2012-07-30 21:12:05 +02:00
Rémy Oudompheng
6cbf35c172 cmd/gc: fix initialization order involving method calls.
They were previously ignored when deciding order and
detecting dependency loops.
Fixes #3824.

R=rsc, golang-dev
CC=golang-dev, remy
https://golang.org/cl/6455055
2012-07-30 09:14:49 +02:00
Shenghou Ma
a732cbb593 cmd/gc: add missing case for OCOM in defaultlit()
Fixes #3765.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/6349064
2012-07-02 09:33:22 +08:00
Russ Cox
2a9410c19c cmd/gc: fix LEAQ $0, SI bug
Cannot take effective address of constant.

Fixes #3670.

R=ken2
CC=golang-dev
https://golang.org/cl/6299055
2012-06-07 11:59:18 -04:00
Russ Cox
6363fc5aa6 cmd/gc: fix type checking loop
CL 4313064 fixed its test case but did not address a
general enough problem:

type T1 struct { F *T2 }
type T2 T1
type T3 T2

could still end up copying the definition of T1 for T2
before T1 was done being evaluated, or T3 before T2
was done.

In order to propagate the updates correctly,
record a copy of an incomplete type for re-execution
once the type is completed. Roll back CL 4313064.

Fixes #3709.

R=ken2
CC=golang-dev, lstoakes
https://golang.org/cl/6301059
2012-06-07 03:06:40 -04:00
Russ Cox
744b23fe48 cmd/gc: do not crash on struct with _ field
Fixes #3607.

R=ken2
CC=golang-dev
https://golang.org/cl/6296052
2012-06-07 02:05:08 -04:00
Russ Cox
ee5f59ab4f cmd/gc: preserve side effects during inlining of function with _ argument
Fixes #3593.

R=ken2
CC=golang-dev, lvd
https://golang.org/cl/6305061
2012-06-07 01:54:07 -04:00
Ian Lance Taylor
6f6bbdf9b7 test: add bug439, valid code that caused a gccgo crash
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/6198075
2012-05-15 13:29:46 -07:00
Ian Lance Taylor
6c8447d429 test: add bug438, a valid test case that gccgo used to fail to compile
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6196047
2012-05-04 13:14:09 -07:00
Ian Lance Taylor
890be5ced0 test: add bug437, a test that used to fail with gccgo at link time
Updates #3391.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6177045
2012-05-03 14:25:11 -07:00
Ian Lance Taylor
df64448932 test: add bug436, valid code that crashed gccgo
R=golang-dev, bsiegert, rsc
CC=golang-dev
https://golang.org/cl/6158046
2012-05-03 10:33:10 -07:00
Luuk van Dijk
81d9621534 cmd/gc: test for issue 3552
R=rsc
CC=golang-dev
https://golang.org/cl/6128051
2012-05-02 16:56:26 +02:00
Anthony Martin
42aa9abae9 gc: use correct line number for EOF syntax error
I also added some debugging code that's turned
on with -xx.

Fixes #3392.

R=rsc, lvd
CC=golang-dev
https://golang.org/cl/5909058
2012-04-26 02:57:23 -07:00
Ian Lance Taylor
f14a5347e6 test: test handling of negative float constants
This used to panic when compiled by gccgo.

Updates #2876.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6100055
2012-04-23 15:47:34 -07:00
Ian Lance Taylor
373f1a95b0 test: add some tests of valid code that failed with gccgo
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5971044
2012-03-30 08:42:21 -07:00
Russ Cox
5eb007dede runtime: work around false negative in deadlock detection
Not a complete fix for issue 3342, but fixes the trivial case.
There may still be a race in the instants before and after
a scavenger-induced garbage collection.

Intended to be "obviously safe": a call to runtime·gosched
before main.main is no different than a call to runtime.Gosched
at the beginning of main.main, and it is (or had better be)
safe to call runtime.Gosched at any point during main.

Update #3342.

R=iant
CC=golang-dev
https://golang.org/cl/5919052
2012-03-27 12:22:19 -04:00
Mikio Hara
4c2614c57c undo CL 5844051 / 5d0322034aa8
Breaks closure test when GOMAXPROCS=2 or more.

««« original CL description
runtime: restore deadlock detection in the simplest case.

Fixes #3342.

R=iant, r, dave, rsc
CC=golang-dev, remy
https://golang.org/cl/5844051

»»»

R=rsc
CC=golang-dev
https://golang.org/cl/5924045
2012-03-27 13:05:17 +09:00
Rémy Oudompheng
84bb2547fb runtime: restore deadlock detection in the simplest case.
Fixes #3342.

R=iant, r, dave, rsc
CC=golang-dev, remy
https://golang.org/cl/5844051
2012-03-26 23:06:20 -04:00
Ian Lance Taylor
d12f1ff7ad test: fix run.bash by spelling out the commands to use for bug424.go
R=golang-dev, gri, iant
CC=golang-dev
https://golang.org/cl/5882046
2012-03-22 12:48:41 -07:00
Ian Lance Taylor
47b6197a01 cmd/gc: when expanding append inline, preserve arguments
Fixes #3369.

R=golang-dev, gri, lvd, r
CC=golang-dev
https://golang.org/cl/5876044
2012-03-22 09:44:31 -07:00
Shenghou Ma
e2662835b8 test: use testlib in a few more cases
Introduce a new skip cmd.

R=golang-dev, bradfitz, iant, iant
CC=golang-dev
https://golang.org/cl/5868048
2012-03-22 02:14:44 +08:00
Anthony Martin
e1f22bdcc5 gc: fix struct and array comparisons for new bool rules
The two optimizations for small structs and arrays
were missing the implicit cast from ideal bool.

Fixes #3351.

R=rsc, lvd
CC=golang-dev
https://golang.org/cl/5848062
2012-03-19 15:57:28 -07:00
Russ Cox
08854b022f test: fix typo
R=ken2
CC=golang-dev
https://golang.org/cl/5752073
2012-03-07 10:21:56 -05:00
Russ Cox
4267974c0b cmd/gc: unnamed struct types can have methods
Fixes #3143.

R=ken2
CC=golang-dev
https://golang.org/cl/5752070
2012-03-07 02:27:15 -05:00
Russ Cox
987a580b9f cmd/gc: do not confuse unexported methods of same name
Fixes #3146.

R=ken2
CC=golang-dev
https://golang.org/cl/5756074
2012-03-07 01:55:17 -05:00
Ian Lance Taylor
06b7024462 test: match gccgo error messages for bug388.go
As runtime.UintType is no longer defined, the gccgo error
messages have changed.

bug388.go:12:10: error: reference to undefined identifier ‘runtime.UintType’
bug388.go:12:10: error: invalid named/anonymous mix
bug388.go:13:21: error: reference to undefined identifier ‘runtime.UintType’
bug388.go:17:10: error: reference to undefined identifier ‘runtime.UintType’
bug388.go:18:18: error: reference to undefined identifier ‘runtime.UintType’
bug388.go:22:9: error: non-name on left side of ‘:=’
bug388.go:27:10: error: expected type
bug388.go:32:9: error: expected type
bug388.go:23:14: error: reference to field ‘i’ in object which has no fields or methods

R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/5755044
2012-03-05 16:21:46 -08:00
Ian Lance Taylor
532c1b451b test: add bug426.go: a gccgo crash on valid code
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5715044
2012-02-29 21:51:21 -08:00
Anthony Martin
564a1f3358 gc: fix string comparisons for new bool rules
The two string comparison optimizations were
missing the implicit cast from ideal bool.

Fixes #3119.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5696071
2012-02-29 13:55:50 -08:00
Brad Fitzpatrick
e014cf0e54 test: add cmpout to testlib
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5699060
2012-02-24 13:17:26 +11:00
Russ Cox
a457fa500d gc: return of ideal bool
This is a manual undo of CL 5674098.
It does not implement the even less strict spec
that we just agreed on, but it gets us back where
we were at the last weekly.

R=ken2
CC=golang-dev
https://golang.org/cl/5683069
2012-02-21 22:54:07 -05:00
Rémy Oudompheng
fc3797a491 test: use testlib in a few more cases.
R=golang-dev, rsc
CC=golang-dev, remy
https://golang.org/cl/5688057
2012-02-22 00:19:59 +01:00
Rémy Oudompheng
9666a959cf test: fix bug423.go to actually fail with older releases.
The supposedly overflowing variable was registerized.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5687061
2012-02-21 07:50:10 +01:00
Rob Pike
b888671f4c test: fix broken test
TBR=bradfitz

R=golang-dev
CC=golang-dev
https://golang.org/cl/5684050
2012-02-21 16:47:42 +11:00
Rémy Oudompheng
f2ad374ae6 cmd/gc: don't believe that variables mentioned 256 times are unused.
Such variables would be put at 0(SP), leading to serious
corruptions at zero initialization.
Fixes #3084.

R=golang-dev, r
CC=golang-dev, remy
https://golang.org/cl/5683052
2012-02-21 16:38:01 +11:00
Russ Cox
126d475a43 gc: drop ideal bool
R=golang-dev, ken2
CC=golang-dev
https://golang.org/cl/5674098
2012-02-18 21:07:08 -05:00
Rémy Oudompheng
2ece2f58ee test: use testlib (another bunch).
Apply sed with:

1s,^// $G $D/$F.go && $L $F.$A && ./$A.out || echo.*,// run,
1s,^// $G $D/$F.go || echo.*,// compile,

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5656099
2012-02-18 22:15:42 +01:00
Ian Lance Taylor
292bd04a43 test: change bug040 to use errorcheck
Because bug040.go was ignoring all error messages, the fact
that it got an error about fuction main was being ignored.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5675085
2012-02-17 20:35:40 -08:00
Ian Lance Taylor
f228ed1a90 test: remove a couple of bad tests that duplicate declbad.go
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5673089
2012-02-17 20:35:18 -08:00
Ian Lance Taylor
7737e19b15 test: add some tests that gccgo failed to handle correctly
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5671090
2012-02-17 17:52:05 -08:00
Russ Cox
d2cc988429 test: use testlib (fourth 100)
X ,s;^// \$G (\$D/)?\$F\.go *$;// compile;g
X ,s;^// \$G (\$D/)?\$F\.go && \$L \$F\.\$A *$;// build;g
X ,s;^// \$G (\$D/)?\$F\.go && \$L \$F\.\$A && \./\$A\.out *$;// run;g
X ,s;^// errchk \$G( -e)? (\$D/)?\$F\.go *$;// errorcheck;g

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5673079
2012-02-16 23:50:37 -05:00
Russ Cox
8080384a68 test: use testlib (third 100)
X ,s;^// \$G (\$D/)?\$F\.go *$;// compile;g
X ,s;^// \$G (\$D/)?\$F\.go && \$L \$F\.\$A *$;// build;g
X ,s;^// \$G (\$D/)?\$F\.go && \$L \$F\.\$A && \./\$A\.out *$;// run;g
X ,s;^// errchk \$G( -e)? (\$D/)?\$F\.go *$;// errorcheck;g

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5656083
2012-02-16 23:49:59 -05:00
Russ Cox
2b1c9b4be2 test: use testlib (second 100)
X ,s;^// \$G (\$D/)?\$F\.go *$;// compile;g
X ,s;^// \$G (\$D/)?\$F\.go && \$L \$F\.\$A *$;// build;g
X ,s;^// \$G (\$D/)?\$F\.go && \$L \$F\.\$A && \./\$A\.out *$;// run;g
X ,s;^// errchk \$G( -e)? (\$D/)?\$F\.go *$;// errorcheck;g

R=golang-dev
CC=golang-dev
https://golang.org/cl/5673078
2012-02-16 23:49:30 -05:00
Russ Cox
0b477ef17e test: use testlib (first 100)
X ,s;^// \$G (\$D/)?\$F\.go *$;// compile;g
X ,s;^// \$G (\$D/)?\$F\.go && \$L \$F\.\$A *$;// build;g
X ,s;^// \$G (\$D/)?\$F\.go && \$L \$F\.\$A && \./\$A\.out *$;// run;g
X ,s;^// errchk \$G( -e)? (\$D/)?\$F\.go *$;// errorcheck;g

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5656082
2012-02-16 23:48:57 -05:00
Rob Pike
56069f0333 os: delete os.EINVAL and so on
The set of errors forwarded by the os package varied with system and
was therefore non-portable.
Three helpers added for portable error checking: IsExist, IsNotExist, and IsPermission.
One or two more may need to come, but let's keep the set very small to discourage
thinking about errors that way.

R=mikioh.mikioh, gustavo, r, rsc
CC=golang-dev
https://golang.org/cl/5672047
2012-02-17 10:04:29 +11:00
Rémy Oudompheng
1d3ca9236e cmd/gc: correctly typecheck expression lists in returns.
Invalid return statements were accidentally compiling or
triggering internal errors.
Fixes #3044.

R=golang-dev, rsc
CC=golang-dev, remy
https://golang.org/cl/5673074
2012-02-16 23:42:19 +01:00
Ian Lance Taylor
aef23cc49e test: add new test of indirect type references
Similar to bug190, but without recursive reference.  Crashed
gccgo.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5672053
2012-02-15 07:39:46 -08:00
Russ Cox
7b848c6964 cmd/dist: cross-compiling fixes
This CL makes it possible to run make.bash with
GOOS and GOARCH set to something other than
the native host GOOS and GOARCH.

As part of the CL, the tool directory moves from bin/tool/
to pkg/tool/goos_goarch where goos and goarch are
the values for the host system (running the build), not
the target.  pkg/ is not technically appropriate, but C objects
are there now tool (pkg/obj/) so this puts all the generated
binaries in one place (rm -rf $GOROOT/pkg cleans everything).
Including goos_goarch in the name allows different systems
to share a single $GOROOT on a shared file system.

Fixes #2920.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5645093
2012-02-13 22:31:51 -05:00
Russ Cox
7dd90621f8 gc: diagnose field+method of same name
Fixes #2828.

R=ken2
CC=golang-dev
https://golang.org/cl/5653065
2012-02-11 01:21:12 -05:00
Russ Cox
77aaa3555d gc: fix import of struct type in struct literal
Fixes #2716.

R=ken2
CC=golang-dev
https://golang.org/cl/5652065
2012-02-11 00:34:01 -05:00
Russ Cox
12fab9d122 gc: add test case for issue 1743
Fixes #1743.
(Actually was fixed earlier, but now we have proof.)

R=ken2
CC=golang-dev
https://golang.org/cl/5649064
2012-02-10 23:20:00 -05:00
Russ Cox
896f0c61c8 gc: diagnose init loop involving func
Fixes #2295.

R=ken2
CC=golang-dev
https://golang.org/cl/5655057
2012-02-10 23:10:45 -05:00
Russ Cox
7ae1fe420e gc: eliminate duplicate ambiguous selector message
Also show actual expression in message when possible.

Fixes #2599.

R=ken2
CC=golang-dev
https://golang.org/cl/5654059
2012-02-10 22:46:56 -05:00
Russ Cox
5340510203 8g: fix opt bug
Was trying to optimize a duplicate float64 move
by registerizing an int64.

Fixes #2588.

R=ken2
CC=golang-dev
https://golang.org/cl/5645086
2012-02-10 22:32:02 -05:00
Russ Cox
ca5da31f83 6g: fix out of registers bug
Fix it twice: reuse registers more aggressively in cgen abop,
and also release R14 and R15, which are no longer m and g.

Fixes #2669.

R=ken2
CC=golang-dev
https://golang.org/cl/5655056
2012-02-10 22:19:34 -05:00
Russ Cox
5c52404aca gc: implicit type bug fix in export data
TBR=lvd
CC=golang-dev
https://golang.org/cl/5644064
2012-02-09 00:26:08 -05:00
Jamie Gennis
fff732ea2c 6g,8g: make constant propagation inlining-friendly.
This changes makes constant propagation compare 'from' values using node
pointers rather than symbol names when checking to see whether a set
operation is redundant. When a function is inlined multiple times in a
calling function its arguments will share symbol names even though the values
are different. Prior to this fix the bug409 test would hit a case with 6g
where an LEAQ instruction was incorrectly eliminated from the second inlined
function call. 8g appears to have had the same bug, but the test did not fail
there.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5646044
2012-02-08 10:25:13 -05:00
Rob Pike
c5de9b773f bug408: delete
It's disabled and unreproducible.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5642053
2012-02-08 10:52:54 +11:00
Russ Cox
2cc58e93d6 test: disable bug408
Fixes #2902.

TBR=golang-dev
CC=golang-dev
https://golang.org/cl/5641047
2012-02-07 15:50:26 -05:00
Rémy Oudompheng
0d07600de3 cgo: print line numbers in fatal errors when relevant.
Signatures of fatalf and error_ helpers have been matched for
consistency.
Fixes #1800.

R=rsc
CC=golang-dev, remy
https://golang.org/cl/5593049
2012-02-06 20:38:54 +01:00
Luuk van Dijk
0b9f090861 cmd/gc: another special (%hhS) case for method names.
Fixes #2877

R=rsc
CC=golang-dev
https://golang.org/cl/5637047
2012-02-06 16:38:59 +01:00
Luuk van Dijk
5efd5624cc cmd/gc: fix codegen reordering for expressions involving && and ||
Fixes #2821.

R=rsc
CC=golang-dev
https://golang.org/cl/5606061
2012-02-06 15:41:01 +01:00
Luuk van Dijk
419c53af30 gc: don't print implicit type on struct literal in export
As pointed out in the discussion around 2678.

R=rsc
CC=golang-dev
https://golang.org/cl/5534077
2012-02-06 12:19:59 +01:00
Ian Lance Taylor
f25a3873b7 test: fix copyright year in new test case
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5631044
2012-02-03 17:36:48 -08:00
Russ Cox
3fe3ae7476 test: fix bug headers
The letter is $A, not $O.
($O is set accidentally, but not for long.)

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5629045
2012-02-03 15:22:19 -05:00
Brad Fitzpatrick
040fe32119 test: don't use package main for files without a main function
Part of issue 2833, but works fine with current test runner.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5606056
2012-02-03 11:43:24 -08:00
Ian Lance Taylor
1493bf58f3 test: add test for receiver named _
Was miscompiled by gccgo.

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/5622054
2012-02-03 07:19:25 -08:00
Russ Cox
b3750ff52d build: rename $GOROOT/bin/go-tool to $GOROOT/bin/tool.
The go- is redundant now that the directory is required
to be inside $GOROOT.  Rob LGTMed the idea.

R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/5618044
2012-02-02 23:32:41 -05:00
Ian Lance Taylor
cdabb3d315 test: add import test that caused an incorrect gccgo error
R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/5622048
2012-02-02 11:04:09 -08:00
Ian Lance Taylor
f6f83e4938 test: add test which crashed gccgo compiler
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5605046
2012-01-31 16:19:25 -08:00
Ian Lance Taylor
2d7495d287 test: float to integer test case
gccgo currently fails this test:

fixedbugs/bug402.go:12:9: error: floating point constant truncated to integer
fixedbugs/bug402.go:13:8: error: floating point constant truncated to integer

R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/5600050
2012-01-30 21:39:38 -08:00
Rob Pike
ff8133d42e gopack: rename pack, move to go-tool directory
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5598045
2012-01-30 10:30:46 -08:00
Rémy Oudompheng
21f1769519 gc: use original constant expression in error messages.
Fixes #2768.

R=golang-dev, lvd, iant
CC=golang-dev, remy
https://golang.org/cl/5572081
2012-01-29 10:35:11 +01:00
Ian Lance Taylor
d5b7c5157e test: match gccgo error messages
complit1.go:37:34: error: may only omit types within composite literals of slice, array, or map type
complit1.go:38:19: error: may only omit types within composite literals of slice, array, or map type
complit1.go:18:21: error: slice of unaddressable value
complit1.go:19:10: error: slice of unaddressable value
complit1.go:20:9: error: slice of unaddressable value

convert1.go:28:13: error: invalid type conversion
convert1.go:32:12: error: invalid type conversion (cannot use type string as type Tint64)
convert1.go:36:12: error: invalid type conversion
convert1.go:37:13: error: invalid type conversion
convert1.go:40:11: error: invalid type conversion
convert1.go:41:12: error: invalid type conversion
convert1.go:44:12: error: invalid type conversion
convert1.go:46:13: error: invalid type conversion
convert1.go:48:11: error: invalid type conversion
convert1.go:50:12: error: invalid type conversion
convert1.go:52:6: error: invalid type conversion
convert1.go:53:12: error: invalid type conversion
convert1.go:54:12: error: invalid type conversion
convert1.go:56:13: error: invalid type conversion
convert1.go:57:11: error: invalid type conversion
convert1.go:58:11: error: invalid type conversion
convert1.go:64:13: error: invalid type conversion
convert1.go:68:12: error: invalid type conversion (cannot use type Tstring as type Tint64)
convert1.go:72:12: error: invalid type conversion
convert1.go:73:13: error: invalid type conversion
convert1.go:76:11: error: invalid type conversion (cannot use type Tbyte as type Trune)
convert1.go:77:12: error: invalid type conversion (cannot use type Tbyte as type Tint64)
convert1.go:80:12: error: invalid type conversion
convert1.go:82:13: error: invalid type conversion
convert1.go:84:11: error: invalid type conversion (cannot use type Trune as type Tbyte)
convert1.go:86:12: error: invalid type conversion (cannot use type Trune as type Tint64)
convert1.go:88:6: error: invalid type conversion (cannot use type Tint64 as type string)
convert1.go:89:12: error: invalid type conversion
convert1.go:90:12: error: invalid type conversion
convert1.go:92:13: error: invalid type conversion (cannot use type Tint64 as type Tstring)
convert1.go:93:11: error: invalid type conversion (cannot use type Tint64 as type Tbyte)
convert1.go:94:11: error: invalid type conversion (cannot use type Tint64 as type Trune)

fixedbugs/bug195.go:9:21: error: interface contains embedded non-interface
fixedbugs/bug195.go:12:21: error: interface contains embedded non-interface
fixedbugs/bug195.go:15:15: error: interface contains embedded non-interface
fixedbugs/bug195.go:18:2: error: invalid recursive interface
fixedbugs/bug195.go:26:2: error: invalid recursive interface
fixedbugs/bug195.go:22:2: error: invalid recursive interface

fixedbugs/bug251.go:15:2: error: invalid recursive interface
fixedbugs/bug251.go:11:2: error: invalid recursive interface

fixedbugs/bug374.go:18:34: error: use of undefined type ‘xxxx’
fixedbugs/bug374.go:16:5: error: incompatible type in initialization (incompatible type for method ‘m’ (different number of parameters))

fixedbugs/bug383.go:11:2: error: expected boolean expression
fixedbugs/bug383.go:12:2: error: expected boolean expression

fixedbugs/bug386.go:10:25: error: incompatible type for return value 1 (type has no methods)
fixedbugs/bug386.go:12:25: error: incompatible type for return value 1 (type has no methods)

fixedbugs/bug388.go:12:10: error: invalid named/anonymous mix
fixedbugs/bug388.go:17:19: error: non-name on left side of ‘:=’
fixedbugs/bug388.go:22:9: error: non-name on left side of ‘:=’
fixedbugs/bug388.go:27:10: error: expected type
fixedbugs/bug388.go:32:9: error: expected type
fixedbugs/bug388.go:23:14: error: reference to field ‘i’ in object which has no fields or methods
fixedbugs/bug388.go:18:18: error: invalid use of type

fixedbugs/bug389.go:12:5: error: incompatible type in initialization (different parameter types)

fixedbugs/bug390.go:15:24: error: expected integer, floating, or complex type

fixedbugs/bug394.go:10:1: error: expected declaration

fixedbugs/bug397.go:12:2: error: incompatible type for element 2 key in map construction

switch3.go:18:2: error: incompatible types in binary expression
switch3.go:22:2: error: incompatible types in binary expression
switch3.go:28:2: error: map can only be compared to nil
switch3.go:35:2: error: slice can only be compared to nil
switch3.go:42:2: error: func can only be compared to nil

syntax/else.go:11:9: error: expected ‘if’ or ‘{’

typeswitch2.go:15:2: error: duplicate type in switch
typeswitch2.go:19:2: error: duplicate type in switch
typeswitch2.go:26:2: error: duplicate type in switch
typeswitch2.go:40:9: error: ‘t’ declared and not used

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5573073
2012-01-26 23:06:47 -08:00
Russ Cox
ee9bfb023a gc: fix order of evaluation
Pulling function calls out to happen before the
expression being evaluated was causing illegal
reorderings even without inlining; with inlining
it got worse.  This CL adds a separate ordering pass
to move things with a fixed order out of expressions
and into the statement sequence, where they will
not be reordered by walk.

Replaces lvd's CL 5534079.

Fixes #2740.

R=lvd
CC=golang-dev
https://golang.org/cl/5569062
2012-01-25 17:53:50 -05:00
Olivier Duperray
0da89b3964 test: Add the usual Copyright notice.
Fixes #2759.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5570053
2012-01-24 14:48:15 -05:00
Luuk van Dijk
93c4e29605 gc: missed typecheck in subscripting a const string.
Fixes #2674.

R=rsc
CC=golang-dev
https://golang.org/cl/5574045
2012-01-23 16:57:12 +01:00
Luuk van Dijk
5ad9e2db28 gc: handle function calls in arguments to builtin complex operations.
Fixes #2582

R=rsc
CC=golang-dev
https://golang.org/cl/5574044
2012-01-23 16:56:57 +01:00
Russ Cox
427b5bddcd gc: fix recursion loop in interface comparison
iant's idea.

Fixes #2745.

R=iant, dsymonds
CC=golang-dev
https://golang.org/cl/5536085
2012-01-23 09:19:02 -05:00
Ian Lance Taylor
387e7c2742 test: explicitly use variables to avoid gccgo "not used" error
I haven't looked at the source, but the gc compiler appears to
omit "not used" errors when there is an error in the
initializer.  This is harder to do in gccgo, and frankly I
think the "not used" error is still useful even if the
initializer has a problem.  This CL tweaks some tests to avoid
the error, which is not the point of these tests in any case.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5561059
2012-01-22 11:50:45 -08:00
Russ Cox
290e68b983 gc: undo most of 'fix infinite recursion for embedded interfaces'
Preserve test.

changeset:   11593:f1deaf35e1d1
user:        Luuk van Dijk <lvd@golang.org>
date:        Tue Jan 17 10:00:57 2012 +0100
summary:     gc: fix infinite recursion for embedded interfaces

This is causing 'interface type loop' errors during compilation
of a complex program.  I don't understand what's happening
well enough to boil it down to a simple test case, but undoing
this change fixes the problem.

The change being undone is fixing a corner case (uses of
pointer to interface in an interface definition) that basically
only comes up in erroneous Go programs.  Let's not try to
fix this again until after Go 1.

Unfixes issue 1909.

TBR=lvd
CC=golang-dev
https://golang.org/cl/5555063
2012-01-20 17:14:09 -05:00
Jeff R. Allen
46e7cb57c9 gc: do not try to add a key with incorrect type to a hash
Fixes #2623.

R=rsc, bradfitz
CC=golang-dev
https://golang.org/cl/5533043
2012-01-20 13:34:38 -05:00
Ian Lance Taylor
5e77b009d0 test: split golden.out into expected output per test
This will permit gccgo to check test output.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5554056
2012-01-18 16:12:24 -08:00
Ian Lance Taylor
f203093852 test: change several tests to not print
This will make these tests more meaningful for gccgo, which
runs tests in parallel and has no equivalent to golden.out.

Remove ken/simpprint.go since it duplicates helloworld.go.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5536058
2012-01-18 14:31:31 -08:00
Ian Lance Taylor
6b3462820f test: gofmt a few tests
I'm planning to change these tests, but the gofmt changes are
fairly extensive, so I'm separating the gofmt changes from the
substantive changes.

R=golang-dev, rsc, r
CC=golang-dev
https://golang.org/cl/5557052
2012-01-18 13:20:55 -08:00
Luuk van Dijk
6ff01f01f4 gc: fieldnames in structliterals in exported inlines should not be qualified if they're embedded builtin types.
Trust me.
Fixes #2687.

R=rsc
CC=golang-dev
https://golang.org/cl/5545047
2012-01-18 17:51:28 +01:00
Ian Lance Taylor
6a5db20d14 test: match gccgo error messages for bug345
bug345.dir/main.go:25:18: error: argument 1 has incompatible type (need explicit conversion; missing method ‘Write’)
bug345.dir/main.go:27:8: error: argument 1 has incompatible type

R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/5556043
2012-01-17 18:00:34 -08:00
Ian Lance Taylor
24c76f68ed test: fix bug364 to actually run
R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/5536044
2012-01-17 18:00:11 -08:00
Luuk van Dijk
9523b4d59c gc: fix infinite recursion for embedded interfaces
Fixes #1909

R=rsc, gri
CC=golang-dev
https://golang.org/cl/5523047
2012-01-17 10:00:57 +01:00
Scott Lawrence
b16f3a2d50 gc: don't fault on return outside function
Fixes #2598.

R=golang-dev, ality, minux.ma, mpimenov, rsc
CC=golang-dev
https://golang.org/cl/5510043
2012-01-16 18:12:25 -05:00
Rémy Oudompheng
6b72b07016 gc: do not compile switch on interface values into a binary search.
Fixes #2672.

R=golang-dev, lvd
CC=golang-dev, remy
https://golang.org/cl/5543058
2012-01-14 17:00:14 +01:00
Russ Cox
524fb81c41 gc: inlining bug
R=lvd
CC=golang-dev
https://golang.org/cl/5533078
2012-01-11 20:32:02 -05:00
Russ Cox
81728cf06d gc: fix inlining bug
R=lvd
CC=golang-dev
https://golang.org/cl/5532077
2012-01-11 17:25:09 -05:00
Russ Cox
836a517f69 gc: fix inlining bug
Fixes #2682.

R=lvd
CC=golang-dev
https://golang.org/cl/5538043
2012-01-11 13:21:06 -08:00
Luuk van Dijk
feaa9ed10a gc: export nil literals without inferred type.
Fixes #2678

R=rsc
CC=golang-dev
https://golang.org/cl/5529066
2012-01-11 21:26:54 +01:00
Luuk van Dijk
a6c49098bc gc: Nicer errors before miscompiling.
This fixes issue 2444.

A big cleanup of all 31/32bit size boundaries i'll leave for another cl though.  (see also issue 1700).

R=rsc
CC=golang-dev
https://golang.org/cl/5484058
2012-01-10 11:19:22 +01:00
Luuk van Dijk
4bcc9c6b5e gc: disallow declaration of variables outside package.
Fixes #2231.

Declaring main.i in package main in the same way already triggers syntax errors.

R=rsc
CC=golang-dev
https://golang.org/cl/5483078
2012-01-10 11:18:56 +01:00
Luuk van Dijk
41806ec26d gc: remove now redundant typecheck of ->ninit on switches.
Fixes #2576.

R=rsc
CC=golang-dev
https://golang.org/cl/5498105
2012-01-09 21:42:24 +01:00
Ryan Hitchman
a15448d65e gc: improve unsafe.Pointer type-check error messages
Fixes #2627.

R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/5498088
2012-01-06 14:34:16 -08:00
Rob Pike
c50e4f5e2f testing: allow benchmarks to print and fail
Refactors the benchmarks and test code.
Now benchmarks can call Errorf, Fail, etc.,
and the runner will act accordingly.

Because functionality has been folded into an
embedded type, a number of methods' docs
no longer appear in godoc output. A fix is
underway; if it doesn't happen fast enough,
I'll add wrapper methods to restore the
documentation.

R=bradfitz, adg, rsc
CC=golang-dev
https://golang.org/cl/5492060
2011-12-20 09:51:39 -08:00
Luuk van Dijk
5b2f8d96ce gc: omit argument names from function types in error messages
Fixes #2563

R=rsc
CC=golang-dev
https://golang.org/cl/5495047
2011-12-15 17:38:47 +01:00
Luuk van Dijk
e14d1d7e41 gc: use inferred type rather than original one when reporting non-assignability.
Fixes #2451

R=rsc, bradfitz
CC=golang-dev
https://golang.org/cl/5372105
2011-12-14 17:34:35 +01:00
Luuk van Dijk
1f6d130b14 gc: add forgotten typecheck in a lonely corner of sinit
Fixes #2549

R=rsc
CC=golang-dev
https://golang.org/cl/5484060
2011-12-14 15:54:10 +01:00
Luuk van Dijk
3c638f2892 gc: Use %#F in error messages instead of %F.
Fixes #2520

R=rsc
CC=golang-dev
https://golang.org/cl/5482056
2011-12-14 08:22:36 +01:00
Luuk van Dijk
6a401339c1 gc: suppress non-root cause message for bad receivers.
Fixed issue 2500

R=rsc
CC=golang-dev
https://golang.org/cl/5485053
2011-12-14 08:21:37 +01:00
Luuk van Dijk
e1b1a5fea2 gc: fix use of stackallocated AST node in generation of static initialisation code.
Fixes #2529

R=rsc, rogpeppe
CC=golang-dev
https://golang.org/cl/5483048
2011-12-13 09:09:10 +01:00
Russ Cox
1cb7f85d74 gc: 0 expected bugs
Now that Luuk's qualified exporting code
is in, fixing this bug is trivial.

R=ken2
CC=golang-dev
https://golang.org/cl/5479048
2011-12-09 14:58:28 -05:00
Rémy Oudompheng
4349effb15 gc: keep pointer to original node in constant rewrites.
This allows printing meaningful expressions in error messages
instead of evaluated constants.
Fixes #2276.

R=golang-dev, rsc
CC=golang-dev, remy
https://golang.org/cl/5432082
2011-12-07 16:18:50 -05:00
Russ Cox
5e98505ba7 gc: fix spurious typecheck loop in &composite literal
Fixes #2538.

R=ken2
CC=golang-dev
https://golang.org/cl/5449114
2011-12-07 15:48:55 -05:00
Russ Cox
2666b815a3 use new strconv API
All but 3 cases (in gcimporter.go and hixie.go)
are automatic conversions using gofix.

No attempt is made to use the new Append functions
even though there are definitely opportunities.

R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/5447069
2011-12-05 15:48:46 -05:00
Russ Cox
7d15eda95d gc: do not allow slice of array literal
R=ken2
CC=golang-dev
https://golang.org/cl/5440083
2011-12-02 12:30:56 -05:00
Adam Langley
bac7bc55a6 Add a []byte argument to hash.Hash to allow an allocation to be saved.
This is the result of running `gofix -r hashsum` over the tree, changing
the hash function implementations by hand and then fixing a couple of
instances where gofix didn't catch something.

The changed implementations are as simple as possible while still
working: I'm not trying to optimise in this CL.

R=rsc, cw, rogpeppe
CC=golang-dev
https://golang.org/cl/5448065
2011-12-01 12:35:37 -05:00
Rémy Oudompheng
60e4a61d30 gc: don't inherit orig from subnodes in constant expression nodes.
The wrong value made Nconv() show "1" for node "-1", and "2" from
node "2+3".
Fixes #2452.

R=gri, lvd, rsc
CC=golang-dev, remy
https://golang.org/cl/5435064
2011-11-28 12:22:15 -05:00
Maxim Pimenov
ffa6b383f5 gc: fix copying of types
reset xmethod during copytype

Fixes #2497

R=rsc, dvyukov
CC=golang-dev
https://golang.org/cl/5441045
2011-11-28 11:52:16 -05:00
Russ Cox
4d27f64863 gofmt: do not stop test.sh after 1 error
Fix bug377.go to be gofmt-compliant.

R=gri, r, r
CC=golang-dev
https://golang.org/cl/5400045
2011-11-16 18:44:21 -05:00
Russ Cox
d03611f628 allow copy of struct containing unexported fields
An experiment: allow structs to be copied even if they
contain unexported fields.  This gives packages the
ability to return opaque values in their APIs, like reflect
does for reflect.Value but without the kludgy hacks reflect
resorts to.

In general, we trust programmers not to do silly things
like *x = *y on a package's struct pointers, just as we trust
programmers not to do unicode.Letter = unicode.Digit,
but packages that want a harder guarantee can introduce
an extra level of indirection, like in the changes to os.File
in this CL or by using an interface type.

All in one CL so that it can be rolled back more easily if
we decide this is a bad idea.

Originally discussed in March 2011.
https://groups.google.com/group/golang-dev/t/3f5d30938c7c45ef

R=golang-dev, adg, dvyukov, r, bradfitz, jan.mercl, gri
CC=golang-dev
https://golang.org/cl/5372095
2011-11-15 12:20:59 -05:00
Russ Cox
5bb54b8e9c gc: remove func, map compare
R=ken, ken
CC=golang-dev
https://golang.org/cl/5373079
2011-11-13 22:58:08 -05:00
Russ Cox
5fc3771b3a gc: remove m[k] = x, false
R=ken2
CC=golang-dev
https://golang.org/cl/5376076
2011-11-11 16:48:25 -05:00
Luuk van Dijk
924ea515cf gc: better error for non-calling use of unsafe builtins.
Fixes #1951

R=rsc
CC=golang-dev
https://golang.org/cl/5372041
2011-11-09 18:30:54 +01:00
Luuk van Dijk
d5a5855ba1 gc: Preserve original blank name for .anon substitution on out params.
Fixes #1802.

R=rsc
CC=golang-dev
https://golang.org/cl/5364043
2011-11-09 11:27:27 +01:00
Luuk van Dijk
151b2f1509 gc: Fail on implicit assigment to non-exported fields in copy and append.
Fixes #1387.

R=rsc
CC=golang-dev
https://golang.org/cl/5348046
2011-11-09 11:17:06 +01:00
Luuk van Dijk
13e92e4d75 gc: Better typechecks and errors in switches.
Allow any type in switch on interface value.
Statically check typeswitch early.

Fixes #2423.
Fixes #2424.

R=rsc, dsymonds
CC=golang-dev
https://golang.org/cl/5339045
2011-11-09 10:58:53 +01:00
Rob Pike
6ab6c49fce renaming_1: hand-edited files for go 1 renaming
This contains the files that required handiwork, mostly
Makefiles with updated TARGs, plus the two packages
with modified package names.
html/template/doc.go needs a separate edit pass.
test/fixedbugs/bug358.go is not legal go so gofix fails on it.

R=rsc
CC=golang-dev
https://golang.org/cl/5340050
2011-11-08 15:38:47 -08:00
Luuk van Dijk
087bec3dcd gc: Clean up dostruct/stotype, detect broken fields and propagate up to structs and functions to supress spurious errors.
Fixes #1556.

R=rsc
CC=golang-dev
https://golang.org/cl/5351042
2011-11-07 21:35:13 +01:00
Luuk van Dijk
0d6f857c3f gc: Switch related errors should use plain format.
Fixes #2422.

R=rsc
CC=golang-dev
https://golang.org/cl/5353046
2011-11-06 22:13:54 +01:00
Luuk van Dijk
aac144b120 gc: detect type switch variable not used cases.
Fixes #873
Fixes #2162

R=rsc
CC=golang-dev
https://golang.org/cl/5341043
2011-11-04 17:03:50 +01:00
Luuk van Dijk
11075ed893 gc: Don't pollute the xmethod list with non-methods.
Fixes #2355.

I have a test, but not sure if it's worth adding.  Instead i've made
the patching-over in reflect.c methods more fatal and more descriptive.

R=rsc
CC=golang-dev
https://golang.org/cl/5302082
2011-11-03 17:51:15 +01:00
Luuk van Dijk
7df9ff5594 gc: helpful message instead of internal error on method call on pointer to pointer.
Fixes #2343.

R=rsc
CC=golang-dev
https://golang.org/cl/5332048
2011-11-02 17:18:53 +01:00
Russ Cox
44526cdbe0 non-pkg: gofix -r error -force=error
R=golang-dev, iant, r, r
CC=golang-dev
https://golang.org/cl/5307066
2011-11-01 22:06:05 -04:00
Russ Cox
a07841e21e test: make bug107 os.Error-proof
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5306087
2011-10-31 17:50:38 -04:00
Luuk van Dijk
50110c9f83 gc: clean up printing.
Got rid of all the magic mystery globals. Now
for %N, %T, and %S, the flags +,- and # set a sticky
debug, sym and export mode, only visible in the new fmt.c.
Default is error mode. Handle h and l flags consistently with
the least side effects, so we can now change
things without worrying about unrelated things
breaking.

fixes #2361

R=rsc
CC=golang-dev
https://golang.org/cl/5316043
2011-10-31 18:09:40 +01:00
Russ Cox
64f78c918a test: error-related fixes
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5328051
2011-10-27 19:41:39 -07:00
Russ Cox
db33959797 cgo, goyacc, go/build, html, http, path, path/filepath, testing/quick, test: use rune
Nothing terribly interesting here.

R=golang-dev, bradfitz, gri, r
CC=golang-dev
https://golang.org/cl/5300043
2011-10-25 22:20:02 -07:00
Dmitriy Vyukov
5695915833 runtime: fix spurious deadlock reporting
Fixes #2337.
Unfortunate sequence of events is:
1. maxcpu=2, mcpu=1, grunning=1
2. starttheworld creates an extra M:
   maxcpu=2, mcpu=2, grunning=1
4. the goroutine calls runtime.GOMAXPROCS(1)
   maxcpu=1, mcpu=2, grunning=1
5. since it sees mcpu>maxcpu, it calls gosched()
6. schedule() deschedules the goroutine:
   maxcpu=1, mcpu=1, grunning=0
7. schedule() call getnextandunlock() which
   fails to pick up the goroutine again,
   because canaddcpu() fails, because mcpu==maxcpu
8. then it sees that grunning==0,
   reports deadlock and terminates

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5191044
2011-10-06 18:10:14 +03:00
Brad Fitzpatrick
2cef85f8a1 Fix build, disabling flaky registerization test.
R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/5179045
2011-10-03 17:25:55 -07:00
Russ Cox
e419535f2a 5g, 6g, 8g: registerize variables again
My previous CL:

changeset:   9645:ce2e5f44b310
user:        Russ Cox <rsc@golang.org>
date:        Tue Sep 06 10:24:21 2011 -0400
summary:     gc: unify stack frame layout

introduced a bug wherein no variables were
being registerized, making Go programs 2-3x
slower than they had been before.

This CL fixes that bug (along with some others
it was hiding) and adds a test that optimization
makes at least one test case faster.

R=ken2
CC=golang-dev
https://golang.org/cl/5174045
2011-10-03 17:46:36 -04:00
Russ Cox
092a211fb9 5g: fix -f()
R=ken2
CC=golang-dev
https://golang.org/cl/5161041
2011-09-29 12:09:46 -04:00
Russ Cox
4bdf1fc02b test: silence/coalesce some tests
Add copyright notice to nilptr.go.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5139048
2011-09-26 19:35:21 -04:00
Ian Lance Taylor
8a06936ea1 test: match gccgo error messages
bug340.go:14:7: error: expected type
bug340.go:15:4: error: reference to undefined field or method ‘x’

bug350.go:12:1: error: redefinition of ‘m’
bug350.go:11:1: note: previous definition of ‘m’ was here
bug350.go:15:1: error: redefinition of ‘p’
bug350.go:14:1: note: previous definition of ‘p’ was here

bug351.go:12:6: error: non-name on left side of ‘:=’

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5127041
2011-09-23 21:23:40 -07:00
Ian Lance Taylor
9169c27eaa test: match gccgo error messages
bug363.go:13:12: error: invalid context-determined non-integer type for shift operand
bug363.go:16:12: error: invalid context-determined non-integer type for shift operand

pointer.go:34:6: error: incompatible type in initialization (pointer to interface type has no methods)
pointer.go:36:6: error: incompatible type in initialization

method2.go:15:1: error: invalid pointer or interface receiver type
method2.go:16:1: error: invalid pointer or interface receiver type
method2.go:21:1: error: invalid pointer or interface receiver type
method2.go:22:1: error: invalid pointer or interface receiver type
method2.go:28:15: error: type ‘*Val’ has no method ‘val’
method2.go:33:11: error: reference to undefined field or method ‘val’

shift1.go:19:16: error: invalid context-determined non-integer type for shift operand
shift1.go:24:19: error: invalid context-determined non-integer type for shift operand
shift1.go:25:17: error: invalid context-determined non-integer type for shift operand
shift1.go:18:18: error: shift of non-integer operand
shift1.go:26:13: error: floating point constant truncated to integer
shift1.go:33:15: error: integer constant overflow
shift1.go:34:15: error: integer constant overflow
shift1.go:35:17: error: integer constant overflow

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5081051
2011-09-21 17:25:48 -07:00
Ian Lance Taylor
1f27519988 test: match gccgo error messages
Added a return to bug357.go to avoid an error which gccgo
reports but 6g does not.

bug353.go:16:14: error: reference to undefined identifer ‘io.ReadWriterCloser’

bug357.go:18:2: error: value computed is not used

bug358.go:14:11: error: imported and not used: ioutil
bug358.go:19:9: error: invalid use of type

bug359.go:25:14: error: redefinition of ‘a’
bug359.go:25:6: note: previous definition of ‘a’ was here
bug359.go:19:6: error: incompatible type in initialization (implicit assignment of ‘list.List’ hidden field ‘front’)

bug362.go:13:6: error: iota is only defined in const declarations
bug362.go:14:6: error: iota is only defined in const declarations
bug362.go:15:6: error: iota is only defined in const declarations

bug363.go:13:12: error: shift of non-integer operand
bug363.go:16:12: error: shift of non-integer operand

bug365.go:15:8: error: expected package

R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/5078046
2011-09-20 16:47:17 -07:00
Ian Lance Taylor
86d97aa981 test: match gccgo error messages for bug349.go
bug349.go:12:14: error: expected ‘;’ or ‘}’ or newline
bug349.go:12:2: error: not enough arguments to return

R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/5081047
2011-09-20 14:47:48 -07:00
Ian Lance Taylor
f1aefc0d36 test: match gccgo error messages for goto.go and bug344.go
goto.go:39:2: error: goto jumps over declaration of ‘x’
goto.go:40:2: note: ‘x’ defined here
goto.go:57:2: error: goto jumps over declaration of ‘x’
goto.go:62:2: note: ‘x’ defined here
goto.go:77:2: error: goto jumps over declaration of ‘x’
goto.go:78:2: note: ‘x’ defined here
goto.go:87:2: error: goto jumps over declaration of ‘x’
goto.go:88:2: note: ‘x’ defined here
goto.go:114:2: error: goto jumps into block
goto.go:115:2: note: goto target block starts here
goto.go:125:2: error: goto jumps into block
goto.go:122:2: note: goto target block starts here
goto.go:130:2: error: goto jumps into block
goto.go:133:4: note: goto target block starts here
goto.go:142:2: error: goto jumps into block
goto.go:145:2: note: goto target block starts here
goto.go:179:2: error: goto jumps into block
goto.go:180:10: note: goto target block starts here
goto.go:186:2: error: goto jumps into block
goto.go:187:10: note: goto target block starts here
goto.go:194:2: error: goto jumps into block
goto.go:196:4: note: goto target block starts here
goto.go:205:3: error: goto jumps into block
goto.go:202:11: note: goto target block starts here
goto.go:211:3: error: goto jumps into block
goto.go:212:4: note: goto target block starts here
goto.go:219:3: error: goto jumps into block
goto.go:220:18: note: goto target block starts here
goto.go:227:3: error: goto jumps into block
goto.go:228:18: note: goto target block starts here
goto.go:241:3: error: goto jumps into block
goto.go:243:4: note: goto target block starts here
goto.go:290:2: error: goto jumps into block
goto.go:287:6: note: goto target block starts here
goto.go:299:2: error: goto jumps into block
goto.go:294:6: note: goto target block starts here
goto.go:306:2: error: goto jumps into block
goto.go:303:12: note: goto target block starts here
goto.go:313:2: error: goto jumps into block
goto.go:310:24: note: goto target block starts here
goto.go:320:2: error: goto jumps into block
goto.go:317:18: note: goto target block starts here
goto.go:327:2: error: goto jumps into block
goto.go:324:18: note: goto target block starts here
goto.go:334:2: error: goto jumps into block
goto.go:331:18: note: goto target block starts here
goto.go:341:2: error: goto jumps into block
goto.go:338:18: note: goto target block starts here
goto.go:395:2: error: goto jumps into block
goto.go:398:2: note: goto target block starts here
goto.go:403:2: error: goto jumps into block
goto.go:406:2: note: goto target block starts here
goto.go:413:2: error: goto jumps into block
goto.go:417:2: note: goto target block starts here
goto.go:424:3: error: goto jumps into block
goto.go:426:2: note: goto target block starts here
goto.go:436:3: error: goto jumps into block
goto.go:433:2: note: goto target block starts here
goto.go:492:2: error: goto jumps into block
goto.go:495:2: note: goto target block starts here
goto.go:500:2: error: goto jumps into block
goto.go:503:2: note: goto target block starts here
goto.go:510:2: error: goto jumps into block
goto.go:514:2: note: goto target block starts here
goto.go:521:3: error: goto jumps into block
goto.go:523:2: note: goto target block starts here
goto.go:533:3: error: goto jumps into block
goto.go:530:2: note: goto target block starts here

bug344.go:17:2: error: goto jumps into block
bug344.go:20:21: note: goto target block starts here

R=rsc
CC=golang-dev
https://golang.org/cl/5077044
2011-09-20 14:45:54 -07:00
Ian Lance Taylor
c55d0c4dd7 test: match gccgo error message for bug337.go
bug337.go:17:2: error: value computed is not used

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5094042
2011-09-20 09:31:07 -07:00
Ian Lance Taylor
bfe9f228a4 test: match gccgo error messages for bug330.go.
bug330.go:11:6: error: expected numeric type
bug330.go:12:6: error: expected numeric type

R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/5031050
2011-09-16 18:28:57 -07:00
Russ Cox
4fb3c4f765 gc: fix div bug
R=ken2
CC=golang-dev
https://golang.org/cl/4950052
2011-08-30 08:47:28 -04:00
Russ Cox
a5d7c1f45e errchk: allow multiple patterns
// ERROR "pattern1" "pattern2"

means that there has to be one or more
lines matching pattern1 and then excluding
those, there have to be one or more lines
matching pattern2.  So if you expect two
different error messages from a particular
line, writing two separate patterns checks
that both errors are produced.

Also, errchk now flags lines that produce
more errors than expected.  Before, as long as
at least one error matched the pattern, all the
others were ignored.

Revise tests to expect or silence these
additional errors.

R=lvd, r, iant
CC=golang-dev
https://golang.org/cl/4869044
2011-08-16 11:14:26 -04:00
Russ Cox
032ffb2e90 gc: more graceful errors during struct definition
Fixes #2110.

R=ken2
CC=golang-dev
https://golang.org/cl/4823060
2011-07-28 20:41:18 -04:00
Russ Cox
28a23675cd 5g, 6g, 8g: shift, opt fixes
Fixes #1808.

R=ken2
CC=golang-dev
https://golang.org/cl/4813052
2011-07-28 18:22:12 -04:00
Russ Cox
8c23c1ab87 5g: defer vs optimizer bug
Fixes #1924.

R=ken2
CC=golang-dev
https://golang.org/cl/4802063
2011-07-28 16:28:23 -04:00
Russ Cox
4389192669 gc: shift type bug
Fixes #1664.

R=ken2
CC=golang-dev
https://golang.org/cl/4798056
2011-07-28 13:03:30 -04:00
Russ Cox
acb02ebc30 gc: another width test
R=ken2
CC=golang-dev
https://golang.org/cl/4808057
2011-07-28 12:32:43 -04:00
Russ Cox
2f8190a8f8 gc: line number + type checking nits
Fixes #1910.
Fixes #1979.
Fixes #1990.
Fixes #1993.
Fixes #2089.

R=ken2
CC=golang-dev
https://golang.org/cl/4828046
2011-07-28 12:31:16 -04:00
Russ Cox
890bdc5339 gc: top-level closure bug
Fixes #2055.

R=ken2
CC=golang-dev
https://golang.org/cl/4816059
2011-07-27 19:31:11 -04:00
Russ Cox
f91eb3c2f9 gc: composite literal double eval bug
Fixes #2086.

R=ken2
CC=golang-dev
https://golang.org/cl/4803055
2011-07-27 18:55:30 -04:00
Russ Cox
1bd4b6371a gc: use more Go-like names for methods
Fixes #991.

R=ken2
CC=golang-dev
https://golang.org/cl/4819049
2011-07-27 17:56:13 -04:00
Russ Cox
112267d55e gc: diagnose (x) := 0
Fixes #1756.

R=ken2
CC=golang-dev
https://golang.org/cl/4810057
2011-07-27 17:39:30 -04:00
Russ Cox
a84abbe508 gc: zero-width struct, zero-length array fixes
Fixes #1774.
Fixes #2095.
Fixes #2097.

R=ken2
CC=golang-dev
https://golang.org/cl/4826046
2011-07-27 16:47:45 -04:00
Russ Cox
dec8009fe8 gc: iota outside const
Fixes #1662.

R=ken2
CC=golang-dev
https://golang.org/cl/4828045
2011-07-27 14:45:27 -04:00
Russ Cox
49b70d01c0 gc: echo literal in error message
Fixes #1192.

R=ken2
CC=golang-dev
https://golang.org/cl/4794062
2011-07-27 14:36:21 -04:00
Russ Cox
12a5774cde gc, runtime: fix range+panic line number bugs
Fixes #1856.

R=ken2
CC=golang-dev
https://golang.org/cl/4810054
2011-07-26 00:52:46 -04:00
Russ Cox
cce10dacc6 gc: fix select line number
Fixes #1393.

R=ken2
CC=golang-dev
https://golang.org/cl/4811054
2011-07-26 00:52:17 -04:00
Luuk van Dijk
e8ff9a624f gc: fix closure bug
Fixes #2056.

R=rsc
CC=golang-dev
https://golang.org/cl/4709042
2011-07-14 18:13:39 +02:00
Russ Cox
6aaa86ff66 gc: avoid package name ambiguity in error messages
Fixes #2006.

R=ken2
CC=golang-dev
https://golang.org/cl/4643056
2011-06-27 18:44:30 -04:00
Robert Griesemer
712fb6dcd3 os.Error API: don't export os.ErrorString, use os.NewError consistently
This is a core API change.

1) gofix misc src
2) Manual adjustments to the following files under src/pkg:
   gob/decode.go
   rpc/client.go
   os/error.go
   io/io.go
   bufio/bufio.go
   http/request.go
   websocket/client.go
as well as:
   src/cmd/gofix/testdata/*.go.in (reverted)
   test/fixedbugs/bug243.go
3) Implemented gofix patch (oserrorstring.go) and test case (oserrorstring_test.go)

Compiles and runs all tests.

R=r, rsc, gri
CC=golang-dev
https://golang.org/cl/4607052
2011-06-22 10:52:47 -07:00
Russ Cox
7f4c5ea7d8 gc: implement goto restriction
Remove now-unnecessary zeroing of stack frames.

R=ken2
CC=golang-dev
https://golang.org/cl/4641044
2011-06-17 15:25:05 -04:00
Russ Cox
21e75da486 respect goto restrictions
R=gri
CC=golang-dev
https://golang.org/cl/4625044
2011-06-17 06:07:13 -04:00
Russ Cox
5d9dbe19a7 gc: work around goto bug
R=ken2
CC=golang-dev
https://golang.org/cl/4629042
2011-06-16 00:18:43 -04:00
Russ Cox
15dcdf751c gc: fix m[x], _ = y.(T)
Fixes #1900.

R=ken2
CC=golang-dev
https://golang.org/cl/4561053
2011-05-31 15:52:04 -04:00
Anthony Martin
67b4db9e9e gc: check parameter declarations in interface fields
Fixes #1663.
Fixes #1871.

R=rsc, lstoakes
CC=golang-dev
https://golang.org/cl/4530084
2011-05-31 13:41:32 -04:00
Anthony Martin
0b209b36b6 gc: relax assignability of method receivers
The spec was adjusted in commit df410d6a4842 to allow the
implicit assignment of strutures with unexported fields in
method receivers.  This change updates the compiler.

Also moved bug322 into fixedbugs and updated golden.out
to reflect the removal of the last known bug.

Fixes #1402.

R=golang-dev, gri, rsc
CC=golang-dev
https://golang.org/cl/4526069
2011-05-24 19:48:19 -04:00
Anthony Martin
f570d9d765 8g: fix conversion from float to uint64
The code for converting negative floats was
incorrectly loading an FP control word from
the stack without ever having stored it there.

Thanks to Lars Pensjö for reporting this bug.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/4515091
2011-05-16 22:14:56 -04:00
Lorenzo Stoakes
f58d911698 gc: fix type switch error message for invalid cases.
Fixes #1606.

R=rsc
CC=golang-dev
https://golang.org/cl/4532045
2011-05-11 23:41:59 -04:00
Russ Cox
3f335f80b4 gc: fix unsafe.Sizeof
Fixes #1608.
Fixes #1787.

R=ken2
CC=golang-dev
https://golang.org/cl/4530045
2011-05-10 17:00:15 -04:00
Russ Cox
8133cb3565 gc: preserve original expression for errors
Fixes #1722.

R=ken2
CC=golang-dev
https://golang.org/cl/4442099
2011-04-28 13:14:35 -04:00
Lorenzo Stoakes
b6f0632e93 gc: correctly handle fields of pointer type to recursive forward references
Previously, whether declaring a type which copied the structure of a type it was referenced in via a pointer field would work depended on whether you declared it before or after the type it copied, e.g. type T2 T1; type T1 struct { F *T2 } would work, however type T1 struct { F *T2 }; type T2 T1 wouldn't.

Fixes #667.

R=rsc
CC=golang-dev
https://golang.org/cl/4313064
2011-04-28 00:13:49 -04:00
Russ Cox
07abf1c732 fix tree for reflect rename
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/4435067
2011-04-25 13:39:36 -04:00
Russ Cox
3a1fdc655e gc: fix import width bug
Fixes #1705.

R=ken2
CC=golang-dev
https://golang.org/cl/4443060
2011-04-25 12:08:48 -04:00
Robert Hencke
883d68f885 gc: allow complex types to be receiver types
Fixes #1716.

R=golang-dev, rsc1, rsc
CC=golang-dev
https://golang.org/cl/4439068
2011-04-25 12:02:54 -04:00
Russ Cox
c0a895fc0a gc: fix conversion of user-defined string type to []byte
Fixes #1709.

R=ken2
CC=golang-dev
https://golang.org/cl/4438068
2011-04-23 10:55:32 -04:00
Russ Cox
815a1b84c7 gc: fix return variable named _
Fixes #1712.

R=ken2
CC=golang-dev
https://golang.org/cl/4445055
2011-04-23 10:54:19 -04:00
Russ Cox
7879d3118c gc: fix line number at EOF
Fixes #1474.

R=ken2
CC=golang-dev
https://golang.org/cl/4432061
2011-04-23 10:54:05 -04:00
Russ Cox
5ff3336490 gc: correct handling of unexported method names in embedded interfaces
go/types: update for export data format change
reflect: require package qualifiers to match during interface check
runtime: require package qualifiers to match during interface check
test: fixed bug324, adapt to be silent

Fixes #1550.
Issue 1536 remains open.

R=gri, ken2, r
CC=golang-dev
https://golang.org/cl/4442071
2011-04-21 08:14:50 -04:00
Russ Cox
ec735c4ec8 gc: fix error for +string
Fixes #1710.

R=ken2
CC=golang-dev
https://golang.org/cl/4444054
2011-04-20 16:12:47 -04:00
Russ Cox
beb64bbd6e gc: fix complex move again
R=ken2
CC=golang-dev
https://golang.org/cl/4443047
2011-04-18 13:22:31 -04:00
Russ Cox
3d36a81fcc undo 4439044
cannot use regalloc with floating point on 386.
will redo some other way.

R=ken2
CC=golang-dev
https://golang.org/cl/4439045
2011-04-15 19:17:16 -04:00
Russ Cox
a12d70f60d gc: fix complex move bug
R=ken2
CC=golang-dev
https://golang.org/cl/4439044
2011-04-15 16:16:33 -04:00
Russ Cox
de5616fbb4 gc: print of unsafe.Pointer
Got lost when I introduced TUNSAFEPTR.

R=ken2
CC=golang-dev
https://golang.org/cl/4442046
2011-04-15 16:16:20 -04:00
Russ Cox
68ed122bf9 bug327: document what's being tested
R=r
CC=golang-dev
https://golang.org/cl/4380043
2011-04-08 13:42:20 -04:00
Russ Cox
db5c5d6fa6 update go tree for reflect changes
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/4353043
2011-04-08 12:27:58 -04:00
Russ Cox
35c880b1e2 gc: bug327
Fixes #1674.

R=ken2
CC=golang-dev
https://golang.org/cl/4368057
2011-04-07 18:53:47 -04:00
Russ Cox
6b3357129a build: add all-qemu.bash, handful of arm fixes
R=r
CC=golang-dev
https://golang.org/cl/4313051
2011-03-27 23:39:42 -04:00
Ian Lance Taylor
dacd1cad77 test: match gccgo error messages for bug323.go.
bug323.go:18:3: error: reference to undefined field or method ‘Meth’
bug323.go:19:3: error: reference to undefined field or method ‘Meth2’

R=golang-dev, rsc1
CC=golang-dev
https://golang.org/cl/4280072
2011-03-27 20:38:28 -07:00
Ian Lance Taylor
4675e3332b test: match gccgo error messages for bug325.go.
bug325.go:13:10: error: invalid indirect of ‘unsafe.Pointer’
bug325.go:14:31: error: reference to field ‘foo’ in object which has no fields or methods

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/4313050
2011-03-27 12:10:50 -07:00
Ian Lance Taylor
2795b13156 gc: remove interim ... error which rejects valid code.
It's been six months.

R=rsc
CC=golang-dev
https://golang.org/cl/4289073
2011-03-25 18:31:55 -07:00
Ian Lance Taylor
4cb660aad8 test: match gccgo error messages for bug081.go.
bug081.go:9:9: error: expected type

R=rsc
CC=golang-dev
https://golang.org/cl/4280071
2011-03-25 15:28:53 -07:00
Ian Lance Taylor
47c1cef56b test: match gccgo error messages for bug016.go.
bug016.go:11:8: error: negative shift count

R=rsc, gri
CC=golang-dev
https://golang.org/cl/4312055
2011-03-25 13:31:30 -07:00
Ian Lance Taylor
237ae64146 test: match gccgo error messages for bug274.go.
bug274.go:23:3: error: missing statement after label
bug274.go:25:3: error: missing statement after label
bug274.go:28:3: error: label ‘L2’ defined and not used

R=rsc
CC=golang-dev
https://golang.org/cl/4273114
2011-03-25 11:32:32 -07:00
Robert Hencke
169e6d40e3 test: enable tests using v, ok := <-ch syntax
R=rsc, r
CC=golang-dev
https://golang.org/cl/4290059
2011-03-22 10:32:43 -07:00
Russ Cox
e72156b316 remove unused labels
R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/4274052
2011-03-15 14:05:07 -04:00
Russ Cox
4c052844dd gc: fix handling of return values named _
Fixes #1586.

R=ken2
CC=golang-dev
https://golang.org/cl/4244057
2011-03-07 19:36:17 -05:00
Russ Cox
5c2666c18c gc: unsafe.Pointer is not a pointer
Change unsafe.Pointer to be its own kind of
type, instead of making it equivalent to *any.
The change complicates import and export
but avoids the need to find all the places that
operate on pointers but should not operate on
unsafe.Pointer.

Fixes #1566. (a different way)
Fixes #1582.

R=ken2
CC=golang-dev
https://golang.org/cl/4264050
2011-03-07 15:10:01 -05:00
Russ Cox
7da86983a8 gc: bug325 / issue 1566
Fixes #1566.

R=ken2
CC=golang-dev
https://golang.org/cl/4259041
2011-02-28 17:16:44 -05:00
Robert Griesemer
ad8b0d915b bug324.go: test case for issue 1550
Also: renamed fixedbugs/bug322.go to fixedbugs/bug323.go
because we already have a bugs/bug322.go and bug322.dir.

R=rsc
CC=golang-dev
https://golang.org/cl/4219044
2011-02-24 19:29:25 -08:00
Russ Cox
814075dffb test: do not depend on implicit if condition
Deleted test/ken/robif.go because test/if.go is
the same program modulo formatting.

R=golang-dev, gri, r2
CC=golang-dev
https://golang.org/cl/4186068
2011-02-22 18:23:14 -05:00
Jeff R. Allen
3a2d64789b gc: make string const comparison unsigned
Make compile-time string const comparison match semantics
of runtime.cmpstring.

Fixes #1515.

R=rsc
CC=golang-dev, rog
https://golang.org/cl/4172049
2011-02-16 17:57:15 -05:00
Lorenzo Stoakes
b57ac97c27 gc: correct receiver in method missing error
Fixes #1324.

R=rsc1, r, rsc
CC=golang-dev
https://golang.org/cl/3435042
2011-02-11 17:47:58 -05:00
Eoghan Sherry
cf63e34b1d gc: correct rounding of denormal constants
Fixes #1463.

R=rsc
CC=golang-dev
https://golang.org/cl/4079060
2011-02-02 22:36:54 -05:00
Russ Cox
8a2891fc56 gc: select receive bug fix
Affects receive using := when new variable escapes to heap.

Fixes #1468.

R=ken2
CC=golang-dev
https://golang.org/cl/4119052
2011-02-02 18:34:09 -05:00
Russ Cox
f4e76d8309 replace non-blocking send, receive syntax with select
R=golang-dev, nigeltao, niemeyer, r
CC=golang-dev
https://golang.org/cl/4079053
2011-01-31 18:36:28 -05:00
Russ Cox
50fe459ce2 6g: fix uint64(uintptr(unsafe.Pointer(&x)))
Fixes #1417.

R=ken2
CC=golang-dev
https://golang.org/cl/4079042
2011-01-20 12:50:35 -05:00
Russ Cox
f2b5a07453 delete float, complex - code changes
also:
	cmplx -> complex
	float64(1.0) -> 1.0
	float64(1) -> 1.0

R=gri, r, gri1, r2
CC=golang-dev
https://golang.org/cl/3991043
2011-01-19 23:09:00 -05:00
Anthony Martin
661bcb773b gc: fix typed constant declarations
Fixes #1411.

R=rsc, gri, ejsherry
CC=golang-dev
https://golang.org/cl/4035042
2011-01-18 11:24:49 -05:00
Russ Cox
2281ca169c gc: fix &^=
Fixes #1394.

R=ken2
CC=golang-dev
https://golang.org/cl/3879041
2011-01-06 11:21:18 -05:00
Anthony Martin
94df1a067c gc: return constant floats for parts of complex constants
Fixes #1369.

R=rsc
CC=golang-dev
https://golang.org/cl/3731046
2011-01-05 13:12:30 -05:00
Patrick Gavlin
4e5a59591b gc: rewrite complex /= to l = l / r.
Fixes #1368.

R=rsc, ejsherry
CC=golang-dev
https://golang.org/cl/3811042
2011-01-04 13:14:17 -05:00
Russ Cox
0c54225b51 remove nacl
The recent linker changes broke NaCl support
a month ago, and there are no known users of it.

The NaCl code can always be recovered from the
repository history.

R=adg, r
CC=golang-dev
https://golang.org/cl/3671042
2010-12-15 11:49:23 -05:00
Russ Cox
dc9a3b2791 gc: align structs according to max alignment of fields
cc: same
runtime: test cc alignment (required moving #define of offsetof to runtime.h)
fix bug260

Fixes #482.
Fixes #609.

R=ken2, r
CC=golang-dev
https://golang.org/cl/3563042
2010-12-13 16:22:19 -05:00
Eoghan Sherry
cab83650d1 gc: skip undefined symbols in import .
Fixes #1284.

R=ken3, rsc
CC=golang-dev
https://golang.org/cl/3210041
2010-12-07 16:16:01 -05:00
Eoghan Sherry
6aa85d1cbe gc: fix method offsets of anonymous interfaces
Fixes #1290.

R=rsc
CC=golang-dev
https://golang.org/cl/3259043
2010-12-07 12:56:26 -05:00
Robert Griesemer
5a9ad8b9e3 go/ast: use token.Pos instead of token.Position; adjust all dependent code
Specifically:

	* lib/godoc:
	- provide file set (FSet) argument to formatters where needed

	* src/cmd:
	- cgo, ebnflint, godoc, gofmt, goinstall: provide file set (fset) where needed
	- godoc: remove local binary search with sort.Search (change by rsc),
	  extract file set for formatters

	* src/pkg:
	- exp/eval: remove embedded token.Position fields from nodes and replace
	  with named token.Pos fields; add corresponding Pos() accessor methods
	- go/token: added file.Line(), changed signature of File.Position()

	* test/fixedbugs/:
	- bug206.go: change test to not rely on token.Pos details

	* added various extra comments
	* Runs all.bash
	* gofmt formats all of src, misc w/o changes
	* godoc runs

	* performance:
	- The new version of godoc consumes about the same space after indexing
	  has completed, but indexing is half the speed. Significant space savings
	  are expected from smaller ASTs, but since they are thrown away after a
	  file has been indexed, this is not visible anymore. The slower indexing
	  time is due to the much more expensive computation of line information.
	  However, with the new compressed position information, indexing can be
	  rewritten and simplified. Furthermore, computing the line info can be
	  done more efficiently.

        New godoc, immediately after indexing completed (best of three runs):

	  PID COMMAND      %CPU   TIME   #TH #PRTS #MREGS RPRVT  RSHRD  RSIZE  VSIZE
	44381 godoc        0.0%  0:38.00   4    19    149  145M   184K   148M   176M

	2010/12/03 17:58:35 index updated (39.231s, 18505 unique words, 386387 spots)
	2010/12/03 17:58:35 bytes=90858456 footprint=199182584
	2010/12/03 17:58:36 bytes=47858568 footprint=167295224

	Old godoc, immediately after indexing completed (best of three runs):

	  PID COMMAND      %CPU   TIME   #TH #PRTS #MREGS RPRVT  RSHRD  RSIZE  VSIZE
	23167 godoc        0.0%  0:22.02   4    17    132  129M   184K   132M   173M

	2010/12/03 14:51:32 index updated (24.892s, 18765 unique words, 393830 spots)
	2010/12/03 14:51:32 bytes=66404528 footprint=163907832
	2010/12/03 14:51:32 bytes=46282224 footprint=163907832

	The different numbers for unique words/spots stem from the fact the the
	two workspaces are not exactly identical. The new godoc maintains a large
	file set data structure during indexing which (probably) is the reason
	for the larger heap (90858456 vs 66404528) before garbage collection.

R=rsc, r
CC=golang-dev
https://golang.org/cl/3050041
2010-12-06 14:23:18 -08:00
Russ Cox
0db8d3df4c gc: select receive with implicit conversion
Fixes #1172.

R=ken2
CC=golang-dev
https://golang.org/cl/2615041
2010-10-20 16:38:25 -04:00
Russ Cox
8599a83727 runtime: correct iteration of large map values
The hash_next_and_deref was a dreg from a
previous large value scheme.

Fixes #1163.

R=r, r2
CC=golang-dev
https://golang.org/cl/2369043
2010-10-06 11:54:41 -04:00
Russ Cox
a3c682267f gc: various bugs
Fixes #1016.
Fixes #1152.
Fixes #1153.

R=ken2
CC=golang-dev
https://golang.org/cl/2344042
2010-10-03 11:50:44 -04:00
Russ Cox
52d619cfdf gc: bug308
confused by using isddd for both ONAME and OCALL

Fixes #1136.

R=ken2
CC=golang-dev
https://golang.org/cl/2314043
2010-09-30 15:05:01 -04:00
Ian Lance Taylor
6866026c45 test: Add test which causes incorrect error from gccgo.
R=gri
CC=golang-dev
https://golang.org/cl/2220048
2010-09-24 17:07:42 -07:00
Russ Cox
2ee420fa5e ... changes
R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/2273042
2010-09-24 11:55:48 -04:00
Robert Griesemer
5667d82599 fix build
R=iant
CC=golang-dev, ken2
https://golang.org/cl/2182043
2010-09-15 17:00:00 -07:00
Russ Cox
c3900387db gc: bug306
Fixes #1040.

R=ken2
CC=golang-dev
https://golang.org/cl/2132047
2010-09-13 15:42:14 -04:00
Ian Lance Taylor
cc2157ed4f test: Recognize gccgo error messages.
bug299.go:16:2: error: expected field name
bug299.go:17:2: error: expected field name
bug299.go:18:3: error: expected field name
bug299.go:25:9: error: expected receiver name or type
bug299.go:26:10: error: expected receiver name or type
bug299.go:27:9: error: expected receiver name or type

R=rsc
CC=golang-dev
https://golang.org/cl/2150044
2010-09-08 13:58:09 -07:00
Ian Lance Taylor
2660161533 test: Match gccgo error messages.
bug298.go:10:2: error: expected declaration
bug298.go:10:25: error: expected ‘;’ or newline after top level declaration
bug298.go:10:25: error: expected declaration

R=rsc
CC=golang-dev
https://golang.org/cl/2156046
2010-09-08 13:57:12 -07:00
Ian Lance Taylor
ae2dc76335 test: Actually run bug296.
R=rsc
CC=golang-dev
https://golang.org/cl/2156045
2010-09-08 13:56:49 -07:00
Ian Lance Taylor
1331084c3d test: Match gccgo error messages.
bug284.go:33: error: invalid type conversion
bug284.go:36: error: invalid type conversion (cannot use type A2 as type A1)
bug284.go:37: error: invalid type conversion
bug284.go:38: error: invalid type conversion (cannot use type A1 as type A2)
bug284.go:56: error: invalid type conversion
bug284.go:59: error: invalid type conversion (cannot use type S2 as type S1)
bug284.go:60: error: invalid type conversion
bug284.go:61: error: invalid type conversion (cannot use type S1 as type S2)
bug284.go:71: error: invalid type conversion
bug284.go:74: error: invalid type conversion (cannot use type P2 as type P1)
bug284.go:75: error: invalid type conversion
bug284.go:76: error: invalid type conversion (cannot use type P1 as type P2)
bug284.go:96: error: invalid type conversion
bug284.go:99: error: invalid type conversion (cannot use type Q2 as type Q1)
bug284.go:101: error: invalid type conversion (cannot use type Q1 as type Q2)
bug284.go:111: error: invalid type conversion (different parameter types)
bug284.go:114: error: invalid type conversion (different parameter types)
bug284.go:115: error: invalid type conversion (different parameter types)
bug284.go:116: error: invalid type conversion (different parameter types)
bug284.go:134: error: invalid type conversion (incompatible type for method 'f' (different result types))
bug284.go:137: error: invalid type conversion (incompatible type for method 'f' (different result types))
bug284.go:138: error: invalid type conversion (incompatible type for method 'f' (different result types))
bug284.go:139: error: invalid type conversion (incompatible type for method 'f' (different result types))
bug284.go:149: error: invalid type conversion
bug284.go:152: error: invalid type conversion (cannot use type L2 as type L1)
bug284.go:153: error: invalid type conversion
bug284.go:154: error: invalid type conversion (cannot use type L1 as type L2)
bug284.go:164: error: invalid type conversion
bug284.go:167: error: invalid type conversion (cannot use type L2 as type L1)
bug284.go:168: error: invalid type conversion
bug284.go:169: error: invalid type conversion (cannot use type L1 as type L2)
bug284.go:179: error: invalid type conversion
bug284.go:182: error: invalid type conversion (cannot use type C2 as type C1)
bug284.go:183: error: invalid type conversion
bug284.go:184: error: invalid type conversion (cannot use type C1 as type C2)

R=rsc
CC=golang-dev
https://golang.org/cl/2136041
2010-09-01 21:05:31 -07:00
Ian Lance Taylor
c28525a137 test: Recognize gccgo error messages.
bug278.go:18: error: invalid left hand side of assignment
bug278.go:19: error: array is not addressable
bug278.go:21: error: invalid left hand side of assignment
bug278.go:22: error: invalid left hand side of assignment

R=rsc
CC=golang-dev
https://golang.org/cl/2122042
2010-09-01 21:04:57 -07:00
Ian Lance Taylor
426275d702 test: Use global variables to defeat gccgo optimizer.
The gccgo compiler is smart enough to not make something which
is not used.  Use global variables to defeat this
optimization.

R=rsc
CC=golang-dev
https://golang.org/cl/2129041
2010-09-01 13:40:20 -07:00
Ian Lance Taylor
9bd6b0afa4 test: Recognize gccgo error messages.
bug255.go:11: error: array bound truncated to integer
bug255.go:12: error: array bound is not numeric
bug255.go:13: error: array bound is not numeric
bug255.go:14: error: array bound is not constant
bug255.go:15: error: array bound overflows

R=rsc
CC=golang-dev
https://golang.org/cl/2091042
2010-08-31 17:38:11 -07:00
Ian Lance Taylor
7a05b0f235 test: Match gccgo error messages.
Another case where gccgo and gc report similar but not
identical errors for a recursive interface.

bug251.go:11: error: invalid recursive interface

R=rsc
CC=golang-dev
https://golang.org/cl/2094041
2010-08-31 15:48:04 -07:00
Ian Lance Taylor
09977734cd test: gccgo and gc print the error on different lines.
This introduces GC_ERROR to mark an error only issued by the
gc compiler.  GCCGO_ERROR already exists to mark errors only
issued by the gccgo compiler.  Obviously these should be used
sparingly.

bug195.go:9: error: interface contains embedded non-interface
bug195.go:12: error: interface contains embedded non-interface
bug195.go:15: error: interface contains embedded non-interface
bug195.go:18: error: invalid recursive interface
bug195.go:22: error: invalid recursive interface

R=rsc
CC=golang-dev
https://golang.org/cl/2040043
2010-08-31 14:12:23 -07:00
Ian Lance Taylor
5309fae1a3 test: don't assign address of array to slice.
R=rsc
CC=golang-dev
https://golang.org/cl/2084042
2010-08-31 07:34:01 -07:00
Ian Lance Taylor
58a25c6de7 test: Add testcase which crashes gccgo.
R=rsc
CC=golang-dev
https://golang.org/cl/1995050
2010-08-24 13:08:05 -07:00
Russ Cox
1d77ff5b6b 6g, 8g: handle slice by sub-word-sized index (uint8, int8, uint16, int16)
R=ken2
CC=golang-dev
https://golang.org/cl/1960042
2010-08-11 22:27:47 -07:00
Russ Cox
26dde76cee gopack: handle long lines in export data
Also, if the header is bad, exit with a non-zero status.

Other calls to Brdline in the tree, by category:

Reading symbol name from object file:
./cmd/5l/obj.c:486: 		name = Brdline(f, '\0');
./cmd/6l/obj.c:535: 		name = Brdline(f, '\0');
./cmd/8l/obj.c:564: 		name = Brdline(f, '\0');
./libmach/sym.c:292: 		cp = Brdline(bp, '\0');

Reading archive header line (fixed, short):
./cmd/gc/lex.c:287: 	if((a = Brdline(b, '\n')) == nil)
./cmd/gc/lex.c:303: 	if((p = Brdline(b, '\n')) == nil)

Reading object file header line (fixed, short):
./cmd/ld/lib.c:421: 	line = Brdline(f, '\n');

Reading undefined symbol list (unused code):
./cmd/ld/lib.c:773: 	while((l = Brdline(b, '\n')) != nil){

Implementing Brdstr:
./libbio/brdstr.c:36: 		p = Brdline(bp, delim);

The symbol names ones will cause a problem loudly if they
fail: they'll error out with symbol name too long.  This means
that you can't define an enormous struct without giving the
type a name and then stick it in an interface, because the
type's symbol name will be too long for the object file.
Since this will be a loud failure instead of a silent one,
I'm willing to wait until it comes up in practice.

R=r
CC=golang-dev
https://golang.org/cl/1982041
2010-08-11 22:17:20 -07:00
Russ Cox
a9a62eef6b gc: bug302
Fixed by http://code.google.com/p/go/source/detail?r=d1f41e20a90e
This just adds a test and checks the return value of Bprint.

R=ken2
CC=golang-dev
https://golang.org/cl/1949042
2010-08-10 17:39:38 -07:00
Russ Cox
585eae3bce gc: bug301
Fixes #990.

R=ken2
CC=golang-dev
https://golang.org/cl/1742055
2010-08-03 01:07:40 -07:00
Russ Cox
c6cb303a8a gc: bug299, bug300
R=ken2
CC=golang-dev
https://golang.org/cl/1731057
2010-08-03 00:53:32 -07:00
Russ Cox
f20c2e1cf5 gc: more crash avoidance
Fixes #961.
Fixes #962.

R=ken2
CC=golang-dev
https://golang.org/cl/1903043
2010-07-26 17:34:17 -07:00
Russ Cox
607eaea456 gc: fix smaller-than-pointer-sized receivers in interfaces
Fixes #812.

R=ken2
CC=golang-dev
https://golang.org/cl/1904041
2010-07-26 15:25:10 -07:00
Russ Cox
7b240e8135 gc: import dot shadowing bug
R=ken2
CC=golang-dev
https://golang.org/cl/1873047
2010-07-26 14:21:39 -07:00
Russ Cox
4c0de303ce gc: bug294
Fixes #800.

R=ken2
CC=golang-dev
https://golang.org/cl/1855043
2010-07-15 16:42:32 -07:00
Russ Cox
ece6a8c549 gc: bug293
Fixes #846.

R=ken2
CC=golang-dev
https://golang.org/cl/1862042
2010-07-15 16:14:06 -07:00
Russ Cox
cdb446feb5 gc: bug292
Fixes #843.

R=ken2
CC=golang-dev
https://golang.org/cl/1729051
2010-07-15 16:13:47 -07:00
Russ Cox
08a263a991 gc: bug291
Fixes #915.

R=ken2
CC=golang-dev
https://golang.org/cl/1856042
2010-07-15 15:17:42 -07:00
Russ Cox
691d765121 gc: bug274
R=ken2
CC=golang-dev
https://golang.org/cl/1742044
2010-07-15 15:05:56 -07:00
Russ Cox
17f90c68c6 gc: fix handling of types inside function bodies
Fixes #849.
Fixes #920.

R=ken2
CC=golang-dev
https://golang.org/cl/1841042
2010-07-15 14:25:50 -07:00
Robert Griesemer
bebd22f8e0 fix build
R=rsc
CC=golang-dev
https://golang.org/cl/1815042
2010-07-12 14:53:28 -07:00
Vinu Rajashekhar
89192ce4fe test/fixedbugs/bug243.go: instead of closing stdout,
remove the print statements.

This change is because of the port of gccgo to RTEMS.
These tests use the GCC DejaGNU framework. In some cases,
the tests need to be run on qemu where the status code
cannot be sent back to DejaGNU, so it prints the exit status
by putting a wrapper around the exit and abort calls.

This testcase closes the stdout, and hence prohibits DejaGNU
from knowing the status in such cases, and causes this test
to be wrongly declared as a failure.

R=rsc, iant
CC=golang-dev
https://golang.org/cl/1792042
2010-07-12 13:17:32 -07:00
Ian Lance Taylor
e03a50dd11 Test case that gccgo fails (crashes rather than printing error).
R=rsc
CC=Raj_, golang-dev
https://golang.org/cl/1740044
2010-07-12 06:34:36 -07:00
Russ Cox
7c9ed7946c 8g: out of register bug fix
Fixes #868.

R=ken2
CC=golang-dev
https://golang.org/cl/1695049
2010-06-30 20:45:50 -07:00
Russ Cox
8bd99ebff5 test: another listen on ":0" -> "127.0.0.1:0"
R=r
CC=golang-dev
https://golang.org/cl/1664043
2010-06-21 16:34:55 -07:00
Russ Cox
6672b40c09 remove uses of ... from tree, add one test
R=r
CC=golang-dev
https://golang.org/cl/1662041
2010-06-14 11:23:11 -07:00
Russ Cox
565b5dc076 gc: new typechecking rules
* Code for assignment, conversions now mirrors spec.
* Changed some snprint -> smprint.
* Renamed runtime functions to separate
  interface conversions from type assertions:
  convT2I, assertI2T, etc.
* Correct checking of \U sequences.

Fixes #840.
Fixes #830.
Fixes #778.

R=ken2
CC=golang-dev
https://golang.org/cl/1303042
2010-06-08 18:50:02 -07:00
Russ Cox
6aaef04469 misc cleanup: gofmt + &x -> x[0:] conversion
R=gri
CC=golang-dev
https://golang.org/cl/1620042
2010-06-08 17:51:57 -07:00
Russ Cox
6a060200cc 8g: out of register bug
Fixes #806.

R=ken2
CC=golang-dev
https://golang.org/cl/1281042
2010-05-24 17:22:51 -07:00
Russ Cox
8c2bc4419b gc: fix shift/reduce conflict in go.y export syntax
Fixes #771.

R=ken2
CC=golang-dev
https://golang.org/cl/1267042
2010-05-24 16:55:23 -07:00
Russ Cox
9fc9246bf3 gc: bug281 - bad overlap in stack copy
Fixes #807.

R=ken2
CC=golang-dev
https://golang.org/cl/1283041
2010-05-24 16:54:24 -07:00
Russ Cox
2e9b67afa6 gc: bug277 - new conversion syntax
R=ken2
CC=golang-dev
https://golang.org/cl/1220046
2010-05-24 15:25:30 -07:00
Russ Cox
43c0a46ac6 gc: bug280
Fixes #808.

R=ken2
CC=golang-dev
https://golang.org/cl/1273042
2010-05-24 15:25:09 -07:00
Russ Cox
5e253645d2 gc: bug278
Fixes #804.

R=ken2
CC=golang-dev
https://golang.org/cl/1224045
2010-05-24 14:22:54 -07:00
Russ Cox
80ac15ec12 gc: fix unsafe.Sizeof on ideal constants
R=ken2
CC=golang-dev
https://golang.org/cl/1280041
2010-05-24 14:18:15 -07:00
Robert Griesemer
e2b6022f35 issue 789: keep test case
R=rsc
CC=golang-dev
https://golang.org/cl/1242045
2010-05-21 14:53:54 -07:00
Russ Cox
709c5b2481 gc: handle use of builtin function outside function call
tweaks & tests of last bug fix too.

R=ken2
CC=golang-dev
https://golang.org/cl/1207044
2010-05-20 22:57:08 -07:00
Ken Thompson
333002bf53 clean up bug 275
R=rsc
CC=golang-dev
https://golang.org/cl/1224044
2010-05-20 21:01:59 -07:00
Russ Cox
32df678894 gc: bug264
Fixes #692.

R=ken2
CC=golang-dev
https://golang.org/cl/1092041
2010-05-03 17:51:48 -07:00
Russ Cox
b5f54db359 gc: bug267
R=ken2
CC=golang-dev
https://golang.org/cl/1067042
2010-05-03 15:29:59 -07:00
Russ Cox
6361f52fc4 gc: be pickier about slice, chan, array, and map sizes
Fixes #589.

R=ken2
CC=golang-dev
https://golang.org/cl/1032044
2010-05-01 13:15:42 -07:00
Russ Cox
c66b49845c 8g: bug272
Fixes #589.

R=ken2
CC=golang-dev
https://golang.org/cl/1043042
2010-04-30 14:04:34 -07:00
Russ Cox
253fd30e66 gc: bug271
Fixes #662.

R=ken2
CC=golang-dev
https://golang.org/cl/978043
2010-04-30 13:27:08 -07:00
Russ Cox
560283c880 gc: bug270
Fixes #746.

R=ken2
CC=golang-dev
https://golang.org/cl/1040042
2010-04-30 13:04:16 -07:00
Russ Cox
77817e08d5 gc: never include ( ) on singleton func return type
Fixes #749.

R=ken2
CC=golang-dev
https://golang.org/cl/963043
2010-04-29 16:07:14 -07:00
Russ Cox
10eb76b04e gc: bug268
Fixes #745.

R=ken2
CC=golang-dev
https://golang.org/cl/1008045
2010-04-29 15:52:27 -07:00
Russ Cox
c6138efbcb runtime: closures, defer bug fix for Native Client
Enable package tests for Native Client build.

R=r
CC=golang-dev
https://golang.org/cl/957042
2010-04-22 17:52:22 -07:00
Russ Cox
d9254d00f9 gc: zero unnamed return values on entry if func has defer
R=ken2
CC=golang-dev
https://golang.org/cl/891050
2010-04-12 14:28:27 -07:00
Russ Cox
fe7826858c gc: make sure main.main has correct type
R=ken2
CC=golang-dev
https://golang.org/cl/883049
2010-04-11 14:51:35 -07:00
Russ Cox
00f9f0c056 single argument panic
note that sortmain.go has been run through hg gofmt;
only the formatting of the day initializers changed.
i'm happy to revert that formatting if you'd prefer.

stop on error in doc/progs/run

R=r
CC=golang-dev
https://golang.org/cl/850041
2010-03-30 10:34:57 -07:00
Russ Cox
3908c16ffe gc: bug265
Fixes #700.

R=ken2
CC=golang-dev
https://golang.org/cl/839041
2010-03-29 15:27:59 -07:00
Russ Cox
d2cdb24786 gc: tests omitted from the last bug fix
R=ken2
CC=golang-dev
https://golang.org/cl/748041
2010-03-24 22:12:59 -07:00
Rob Pike
325cf8ef21 delete all uses of panicln by rewriting them using panic or,
in the tests, println+panic.
gofmt some tests too.

R=rsc
CC=golang-dev
https://golang.org/cl/741041
2010-03-24 16:46:53 -07:00
Russ Cox
4f89dcdf99 5g/6g/8g: fix double function call in slice
Fixes #654.

R=ken2
CC=golang-dev
https://golang.org/cl/310041
2010-03-08 14:19:28 -08:00
Russ Cox
ba50599e46 8g: make a[byte(x)] truncate x
R=ken2
CC=golang-dev
https://golang.org/cl/223069
2010-02-26 13:15:29 -08:00
Russ Cox
1734cb02e7 gc: recursive interface embedding
Fixes #287.

R=ken2
CC=golang-dev
https://golang.org/cl/215048
2010-02-18 11:15:36 -08:00
Russ Cox
fb5506600f 8g: respect ullman numbers in float comparison
Fixes #602.

R=ken2
CC=golang-dev
https://golang.org/cl/212045
2010-02-17 15:28:45 -08:00
Russ Cox
7b5789b584 gc: undo attempt at fixing recursive interface embedding
Fixes #582.

Update #287
Status: Accepted
Bug fix was too intrusive; undo and reopen issue.

R=ken2
CC=golang-dev
https://golang.org/cl/209044
2010-02-16 17:44:15 -08:00
Russ Cox
e7fc5c2789 gc: test & fix handling of very long string constants
R=ken2
CC=golang-dev
https://golang.org/cl/207106
2010-02-16 10:16:24 -08:00
Russ Cox
5ab8f00bf8 gc: diagnose invalid array bounds
Fixes #587.

R=ken2
CC=golang-dev
https://golang.org/cl/207085
2010-02-12 13:59:02 -08:00
Ian Lance Taylor
4b4c6ab02d Struct field ambiguity test.
gccgo gets this wrong at the moment.

R=rsc
CC=golang-dev
https://golang.org/cl/205044
2010-02-08 15:40:09 -08:00
Ian Lance Taylor
3c686bd23f Match gccgo error message.
bug251.go:11:2: error: invalid recursive interface

R=rsc
CC=golang-dev
https://golang.org/cl/204052
2010-02-05 20:56:20 -08:00
Ian Lance Taylor
db3ec4f239 Match gccgo error messages.
bug121.go:12:3: error: name list not allowed in interface type
bug121.go:16:2: error: expected signature or type name

semi1.go:10:76: error: unexpected semicolon or newline before ‘{’
semi1.go:10:5: error: reference to undefined name ‘x’
semi1.go:10:8: error: reference to undefined name ‘y’
semi1.go:12:3: error: reference to undefined name ‘z’

semi2.go:10:79: error: unexpected semicolon or newline before ‘{’
semi2.go:10:9: error: reference to undefined name ‘x’

semi3.go:10:79: error: unexpected semicolon or newline before ‘{’
semi3.go:10:6: error: reference to undefined name ‘x’
semi3.go:10:9: error: reference to undefined name ‘y’
semi3.go:10:12: error: reference to undefined name ‘z’
semi3.go:12:3: error: reference to undefined name ‘z’

semi4.go:11:2: error: unexpected semicolon or newline before ‘{’
semi4.go:10:6: error: reference to undefined name ‘x’
semi4.go:12:3: error: reference to undefined name ‘z’

semi5.go:10:1: error: unexpected semicolon or newline before ‘{’

semi7.go:11:2: error: unexpected semicolon or newline before ‘else’
semi7.go:10:5: error: reference to undefined name ‘x’

slice.go:9:11: error: missing lower bound in slice expression
slice.go:9:9: error: reference to undefined name ‘y’
slice.go:9:12: error: reference to undefined name ‘z’

R=rsc
CC=golang-dev
https://golang.org/cl/201061
2010-02-04 21:31:30 -08:00
Russ Cox
8bef7fdc39 bug252: make ... vs ...T crossing an error, at least for now
R=r
CC=golang-dev
https://golang.org/cl/199066
2010-02-02 15:00:13 -08:00
Russ Cox
44898c7b76 gc: bug250, bug251 - recursive interface types
Fixes #287.

R=ken2
CC=golang-dev
https://golang.org/cl/199057
2010-02-01 23:58:49 -08:00
Ian Lance Taylor
d00210f519 Match gccgo error messages.
bug249.go:10:5: error: incompatible type in initialization
bug249.go:26:5: error: incompatible type in initialization

R=rsc
CC=golang-dev
https://golang.org/cl/198058
2010-02-01 23:27:33 -08:00
Russ Cox
674458e1c4 gc: bug246
R=ken2
CC=golang-dev
https://golang.org/cl/198057
2010-02-01 23:05:15 -08:00
Russ Cox
0bd41e2ff0 gc: bug242
R=ken2
CC=golang-dev
https://golang.org/cl/198053
2010-02-01 22:18:51 -08:00
Ian Lance Taylor
9a65381b77 Fix for gccgo, which uses a package prefix.
R=rsc
CC=golang-dev
https://golang.org/cl/198046
2010-02-01 16:26:50 -08:00
Ian Lance Taylor
001d9917f4 Match gccgo error messages.
I have to admit that "cannot use type p.T as type p.T" is a
bit weak.  8g gives a similar error ("cannot use v1 (type p.T)
as type p.T in assignment").

bug3.go:37:5: error: incompatible type in initialization (incompatible type for method ‘M’ (different parameter types))
bug3.go:38:5: error: incompatible type in initialization (incompatible type for method ‘M’ (different parameter types))
bug3.go:43:5: error: incompatible type in initialization (incompatible type for method ‘M’ (different parameter types))
bug3.go:44:5: error: incompatible type in initialization (incompatible type for method ‘M’ (different parameter types))
bug3.go:49:5: error: incompatible types in assignment (cannot use type p.T as type p.T)
bug3.go:50:5: error: incompatible types in assignment (cannot use type p.T as type p.T)
bug3.go:55:5: error: incompatible types in assignment (incompatible type for method ‘M’ (different parameter types))
bug3.go:56:5: error: incompatible types in assignment (incompatible type for method ‘M’ (different parameter types))
bug3.go:57:6: error: incompatible types in assignment (incompatible type for method ‘M’ (different parameter types))
bug3.go:58:6: error: incompatible types in assignment (incompatible type for method ‘M’ (different parameter types))
bug3.go:59:5: error: incompatible types in assignment (incompatible type for method ‘M’ (different parameter types))
bug3.go:60:5: error: incompatible types in assignment (incompatible type for method ‘M’ (different parameter types))
bug3.go:61:6: error: incompatible types in assignment (incompatible type for method ‘M’ (different parameter types))
bug3.go:62:6: error: incompatible types in assignment (incompatible type for method ‘M’ (different parameter types))

R=rsc
CC=golang-dev
https://golang.org/cl/199044
2010-02-01 16:25:55 -08:00
Ian Lance Taylor
a91e524bc1 Match gccgo error messages.
bug238.go:11:7: error: invalid constant type
bug238.go:12:7: error: invalid constant type
bug238.go:13:7: error: invalid constant type
bug238.go:14:7: error: invalid constant type
bug238.go:15:7: error: invalid constant type
bug238.go:16:7: error: invalid constant type
bug238.go:17:7: error: invalid constant type

R=rsc
CC=golang-dev
https://golang.org/cl/194159
2010-01-30 11:38:06 -08:00
Ian Lance Taylor
f4d714ca2d Match gccgo error message.
bug231.go:20:4: error: incompatible types in assignment (type has no methods)

R=rsc
CC=golang-dev
https://golang.org/cl/194156
2010-01-30 11:31:06 -08:00
Ian Lance Taylor
5163d50c7d Recognize gccgo error messages.
bug228.go:11:25: error: invalid use of ‘...’
bug228.go:13:13: error: ‘...’ only permits one name
bug228.go:15:20: error: ‘...’ must be last parameter
bug228.go:17:7: error: expected type
bug228.go:19:8: error: expected type

R=rsc
CC=golang-dev
https://golang.org/cl/196077
2010-01-29 22:38:39 -08:00
Russ Cox
7abb4b3a96 gc: fix chan <- chan precedence.
also allow func() func().

R=ken2
CC=golang-dev
https://golang.org/cl/194078
2010-01-26 10:40:28 -08:00
Russ Cox
1912632019 runtime, type switch: eliminate package global name space assumption
bonus: type switch now detects multiple uses of identical interface types.
bonus: interface types are now order-independent, following the spec.

R=ken2
CC=golang-dev
https://golang.org/cl/194053
2010-01-25 18:23:20 -08:00
Russ Cox
3b1a0355b6 5l, 6l, 8l: accept only one object file
(package main; others are pulled in automatically)

R=ken2
CC=golang-dev
https://golang.org/cl/194069
2010-01-25 17:53:43 -08:00
Russ Cox
d1b14a6fb0 gc: bug247, reported by rob
R=ken2
CC=golang-dev
https://golang.org/cl/194051
2010-01-24 22:42:18 -08:00
Russ Cox
fe01d4c8a1 gc: const debug bool = false
R=ken2
CC=golang-dev
https://golang.org/cl/186232
2010-01-19 15:25:44 -08:00
Russ Cox
ff6e310b00 gc: bug245
Fixes #529.

R=ken2
CC=golang-dev
https://golang.org/cl/186215
2010-01-18 17:30:15 -08:00