aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@google.com>2011-09-21 23:05:39 +0000
committerIan Lance Taylor <ian@gcc.gnu.org>2011-09-21 23:05:39 +0000
commite9fcc7074890e0be0a9ec7b2d17972ceea5aead4 (patch)
tree2acf1e16abe40f8771b31004357e768d47be2d63 /gcc
parent2d778bb7ab273cc8e68c483cce1587d6d943c230 (diff)
downloadgcc-e9fcc7074890e0be0a9ec7b2d17972ceea5aead4.zip
gcc-e9fcc7074890e0be0a9ec7b2d17972ceea5aead4.tar.gz
gcc-e9fcc7074890e0be0a9ec7b2d17972ceea5aead4.tar.bz2
Update Go testsuite to release r60.
* go.test/go-test.exp (errchk): Add special case for bug332. (go-gc-tests): Add special cases for bug347 and bug348. Recognize some more test lines. From-SVN: r179063
Diffstat (limited to 'gcc')
-rw-r--r--gcc/testsuite/ChangeLog6
-rw-r--r--gcc/testsuite/go.test/go-test.exp25
-rw-r--r--gcc/testsuite/go.test/test/bench/regex-dna-parallel.go2
-rw-r--r--gcc/testsuite/go.test/test/bench/regex-dna.go2
-rw-r--r--gcc/testsuite/go.test/test/bench/timing.log226
-rw-r--r--gcc/testsuite/go.test/test/chan/select6.go34
-rw-r--r--gcc/testsuite/go.test/test/chan/zerosize.go16
-rw-r--r--gcc/testsuite/go.test/test/declbad.go2
-rw-r--r--gcc/testsuite/go.test/test/divide.go54
-rwxr-xr-xgcc/testsuite/go.test/test/errchk54
-rw-r--r--gcc/testsuite/go.test/test/fixedbugs/bug205.go2
-rw-r--r--gcc/testsuite/go.test/test/fixedbugs/bug228.go2
-rw-r--r--gcc/testsuite/go.test/test/fixedbugs/bug229.go2
-rw-r--r--gcc/testsuite/go.test/test/fixedbugs/bug231.go2
-rw-r--r--gcc/testsuite/go.test/test/fixedbugs/bug238.go1
-rw-r--r--gcc/testsuite/go.test/test/fixedbugs/bug273.go12
-rw-r--r--gcc/testsuite/go.test/test/fixedbugs/bug274.go3
-rw-r--r--gcc/testsuite/go.test/test/fixedbugs/bug297.go2
-rw-r--r--gcc/testsuite/go.test/test/fixedbugs/bug298.go2
-rw-r--r--gcc/testsuite/go.test/test/fixedbugs/bug322.dir/lib.go (renamed from gcc/testsuite/go.test/test/bugs/bug322.dir/lib.go)0
-rw-r--r--gcc/testsuite/go.test/test/fixedbugs/bug322.dir/main.go (renamed from gcc/testsuite/go.test/test/bugs/bug322.dir/main.go)7
-rw-r--r--gcc/testsuite/go.test/test/fixedbugs/bug322.go (renamed from gcc/testsuite/go.test/test/bugs/bug322.go)0
-rw-r--r--gcc/testsuite/go.test/test/fixedbugs/bug324.dir/main.go (renamed from gcc/testsuite/go.test/test/bugs/bug324.dir/main.go)7
-rw-r--r--gcc/testsuite/go.test/test/fixedbugs/bug324.dir/p.go (renamed from gcc/testsuite/go.test/test/bugs/bug324.dir/p.go)0
-rw-r--r--gcc/testsuite/go.test/test/fixedbugs/bug324.go (renamed from gcc/testsuite/go.test/test/bugs/bug324.go)2
-rw-r--r--gcc/testsuite/go.test/test/fixedbugs/bug327.go24
-rw-r--r--gcc/testsuite/go.test/test/fixedbugs/bug328.go14
-rw-r--r--gcc/testsuite/go.test/test/fixedbugs/bug329.go46
-rw-r--r--gcc/testsuite/go.test/test/fixedbugs/bug330.go13
-rw-r--r--gcc/testsuite/go.test/test/fixedbugs/bug331.go36
-rw-r--r--gcc/testsuite/go.test/test/fixedbugs/bug332.go17
-rw-r--r--gcc/testsuite/go.test/test/fixedbugs/bug333.go19
-rw-r--r--gcc/testsuite/go.test/test/fixedbugs/bug334.go31
-rw-r--r--gcc/testsuite/go.test/test/fixedbugs/bug335.dir/a.go9
-rw-r--r--gcc/testsuite/go.test/test/fixedbugs/bug335.dir/b.go11
-rw-r--r--gcc/testsuite/go.test/test/fixedbugs/bug335.go10
-rw-r--r--gcc/testsuite/go.test/test/fixedbugs/bug336.go86
-rw-r--r--gcc/testsuite/go.test/test/fixedbugs/bug337.go19
-rw-r--r--gcc/testsuite/go.test/test/fixedbugs/bug338.go22
-rw-r--r--gcc/testsuite/go.test/test/fixedbugs/bug339.go20
-rw-r--r--gcc/testsuite/go.test/test/fixedbugs/bug340.go17
-rw-r--r--gcc/testsuite/go.test/test/fixedbugs/bug341.go22
-rw-r--r--gcc/testsuite/go.test/test/fixedbugs/bug342.go24
-rw-r--r--gcc/testsuite/go.test/test/fixedbugs/bug343.go33
-rw-r--r--gcc/testsuite/go.test/test/fixedbugs/bug344.go24
-rw-r--r--gcc/testsuite/go.test/test/fixedbugs/bug345.dir/io.go15
-rw-r--r--gcc/testsuite/go.test/test/fixedbugs/bug345.dir/main.go28
-rw-r--r--gcc/testsuite/go.test/test/fixedbugs/bug345.go7
-rw-r--r--gcc/testsuite/go.test/test/fixedbugs/bug346.go19
-rw-r--r--gcc/testsuite/go.test/test/fixedbugs/bug347.go49
-rw-r--r--gcc/testsuite/go.test/test/fixedbugs/bug348.go46
-rw-r--r--gcc/testsuite/go.test/test/fixedbugs/bug349.go13
-rw-r--r--gcc/testsuite/go.test/test/fixedbugs/bug350.go15
-rw-r--r--gcc/testsuite/go.test/test/fixedbugs/bug351.go13
-rw-r--r--gcc/testsuite/go.test/test/fixedbugs/bug352.go19
-rw-r--r--gcc/testsuite/go.test/test/fixedbugs/bug353.go30
-rw-r--r--gcc/testsuite/go.test/test/fixedbugs/bug354.go26
-rw-r--r--gcc/testsuite/go.test/test/fixedbugs/bug355.go18
-rw-r--r--gcc/testsuite/go.test/test/fixedbugs/bug356.go41
-rw-r--r--gcc/testsuite/go.test/test/fixedbugs/bug357.go26
-rw-r--r--gcc/testsuite/go.test/test/fixedbugs/bug358.go26
-rw-r--r--gcc/testsuite/go.test/test/fixedbugs/bug359.go26
-rw-r--r--gcc/testsuite/go.test/test/fixedbugs/bug361.go15
-rw-r--r--gcc/testsuite/go.test/test/fixedbugs/bug362.go16
-rw-r--r--gcc/testsuite/go.test/test/fixedbugs/bug363.go21
-rw-r--r--gcc/testsuite/go.test/test/fixedbugs/bug364.go25
-rw-r--r--gcc/testsuite/go.test/test/fixedbugs/bug365.go22
-rw-r--r--gcc/testsuite/go.test/test/func6.go14
-rw-r--r--gcc/testsuite/go.test/test/func7.go29
-rw-r--r--gcc/testsuite/go.test/test/gc2.go42
-rw-r--r--gcc/testsuite/go.test/test/golden.out15
-rw-r--r--gcc/testsuite/go.test/test/goprint.go14
-rw-r--r--gcc/testsuite/go.test/test/goto.go535
-rw-r--r--gcc/testsuite/go.test/test/import1.go4
-rw-r--r--gcc/testsuite/go.test/test/initializerr.go2
-rw-r--r--gcc/testsuite/go.test/test/interface/explicit.go2
-rw-r--r--gcc/testsuite/go.test/test/interface/pointer.go1
-rw-r--r--gcc/testsuite/go.test/test/interface/private.go32
-rw-r--r--gcc/testsuite/go.test/test/interface/private1.go18
-rw-r--r--gcc/testsuite/go.test/test/malloc1.go1
-rw-r--r--gcc/testsuite/go.test/test/mallocrand.go1
-rw-r--r--gcc/testsuite/go.test/test/method2.go10
-rw-r--r--gcc/testsuite/go.test/test/nil.go142
-rw-r--r--gcc/testsuite/go.test/test/nul1.go6
-rw-r--r--gcc/testsuite/go.test/test/rename1.go2
-rwxr-xr-xgcc/testsuite/go.test/test/run33
-rw-r--r--gcc/testsuite/go.test/test/shift1.go36
-rw-r--r--gcc/testsuite/go.test/test/shift2.go42
-rw-r--r--gcc/testsuite/go.test/test/sizeof.go23
89 files changed, 2403 insertions, 79 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 71a0428..99436d1 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,9 @@
+2011-09-21 Ian Lance Taylor <iant@google.com>
+
+ * go.test/go-test.exp (errchk): Add special case for bug332.
+ (go-gc-tests): Add special cases for bug347 and bug348. Recognize
+ some more test lines.
+
2011-09-21 Uros Bizjak <ubizjak@gmail.com>
* g++.dg/other/i386-3.C: Remove duplicated dg-options.
diff --git a/gcc/testsuite/go.test/go-test.exp b/gcc/testsuite/go.test/go-test.exp
index 5068dd7..0e8f2a6 100644
--- a/gcc/testsuite/go.test/go-test.exp
+++ b/gcc/testsuite/go.test/go-test.exp
@@ -81,6 +81,12 @@ proc errchk { test opts } {
set index [string first "dg-error" $out_line]
regsub -all "\\\[\\.\\\]" $out_line "\\\\\[.\\\\\]" out_line
}
+ # Special case for bug332, in which the error message wants to
+ # match the file name, which is not what dg-error expects.
+ if [string match "*dg-error*bug332*" $out_line] {
+ set index [string first "dg-error" $out_line]
+ regsub -start $index "bug332" $out_line "undefined type" out_line
+ }
puts $fdout $out_line
}
close $fdin
@@ -258,6 +264,13 @@ proc go-gc-tests { } {
}
}
+ if { [string match "*bug347*" $test] \
+ || [string match "*bug348*" $test] } {
+ # These bugs rely on runtime.Caller which currently fails.
+ untested $name
+ continue
+ }
+
set fd [open $test r]
set lines_ok 1
@@ -451,15 +464,23 @@ proc go-gc-tests { } {
$test_line] \
|| [string match \
"// \$G \$D/\$F.dir/p1.go && \$G \$D/\$F.dir/p2.go" \
+ $test_line] \
+ || [string match \
+ "// \$G \$D/\$F.dir/b.go && \$G \$D/\$F.dir/a.go" \
$test_line] } {
if { [string match \
+ "// \$G \$D/\$F.dir/bug0.go && errchk \$G \$D/\$F.dir/bug1.go" \
+ $test_line] } {
+ set name1 "bug0.go"
+ set name2 "bug1.go"
+ } elseif { [string match \
"// \$G \$D/\$F.dir/p1.go && \$G \$D/\$F.dir/p2.go" \
$test_line] } {
set name1 "p1.go"
set name2 "p2.go"
} else {
- set name1 "bug0.go"
- set name2 "bug1.go"
+ set name1 "b.go"
+ set name2 "a.go"
}
set hold_runtests $runtests
set runtests "go-test.exp"
diff --git a/gcc/testsuite/go.test/test/bench/regex-dna-parallel.go b/gcc/testsuite/go.test/test/bench/regex-dna-parallel.go
index e8e62b8..1335e4d 100644
--- a/gcc/testsuite/go.test/test/bench/regex-dna-parallel.go
+++ b/gcc/testsuite/go.test/test/bench/regex-dna-parallel.go
@@ -89,7 +89,7 @@ func countMatches(pat string, bytes []byte) int {
func main() {
runtime.GOMAXPROCS(4)
- bytes, err := ioutil.ReadFile("/dev/stdin")
+ bytes, err := ioutil.ReadAll(os.Stdin)
if err != nil {
fmt.Fprintf(os.Stderr, "can't read input: %s\n", err)
os.Exit(2)
diff --git a/gcc/testsuite/go.test/test/bench/regex-dna.go b/gcc/testsuite/go.test/test/bench/regex-dna.go
index dc31db7..042d7f2 100644
--- a/gcc/testsuite/go.test/test/bench/regex-dna.go
+++ b/gcc/testsuite/go.test/test/bench/regex-dna.go
@@ -87,7 +87,7 @@ func countMatches(pat string, bytes []byte) int {
}
func main() {
- bytes, err := ioutil.ReadFile("/dev/stdin")
+ bytes, err := ioutil.ReadAll(os.Stdin)
if err != nil {
fmt.Fprintf(os.Stderr, "can't read input: %s\n", err)
os.Exit(2)
diff --git a/gcc/testsuite/go.test/test/bench/timing.log b/gcc/testsuite/go.test/test/bench/timing.log
index a967f27..2541a76 100644
--- a/gcc/testsuite/go.test/test/bench/timing.log
+++ b/gcc/testsuite/go.test/test/bench/timing.log
@@ -674,3 +674,229 @@ threadring 50000000
gcc -O2 threadring.c 30.50u 258.05s 325.72r
gccgo -O2 threadring.go 92.87u 748.39s 728.46r
gc threadring 38.03u 0.01s 38.04r
+
+# Apr 15, 2011
+# Move to new machine, Intel Xeon E5520@2.27GHz.
+# (Was Opteron(tm) Processor 8214 HE)
+
+fasta -n 25000000
+OLD:
+ gcc -O2 fasta.c 3.39u 0.04s 3.42r
+ gccgo -O2 fasta.go 3.52u 0.00s 3.52r
+ gc fasta 3.63u 0.04s 3.67r
+ gc_B fasta 3.66u 0.00s 3.66r
+NEW:
+ gcc -O2 fasta.c 1.45u 0.02s 1.47r
+ gccgo -O2 fasta.go 1.51u 0.01s 1.51r
+ gc fasta 2.04u 0.00s 2.04r
+ gc_B fasta 2.05u 0.00s 2.04r
+
+reverse-complement < output-of-fasta-25000000
+OLD:
+ gcc -O2 reverse-complement.c 1.87u 1.51s 7.02r
+ gccgo -O2 reverse-complement.go 1.56u 0.54s 3.37r
+ gc reverse-complement 1.73u 0.36s 2.08r
+ gc_B reverse-complement 1.75u 0.37s 2.12r
+NEW:
+ gcc -O2 reverse-complement.c 1.20u 0.47s 12.96r
+ gccgo -O2 reverse-complement.go 0.88u 0.14s 1.01r
+ gc reverse-complement 1.13u 0.17s 1.30r
+ gc_B reverse-complement 1.11u 0.09s 1.20r
+
+nbody -n 50000000
+OLD:
+ gcc -O2 -lm nbody.c 21.90u 0.00s 21.92r
+ gccgo -O2 nbody.go 23.12u 0.03s 23.19r
+ gc nbody 29.07u 0.00s 29.07r
+ gc_B nbody 31.84u 0.00s 31.85r
+NEW:
+ gcc -O2 -lm nbody.c 13.01u 0.00s 13.03r
+ gccgo -O2 nbody.go 13.35u 0.00s 13.37r
+ gc nbody 21.78u 0.00s 21.82r
+ gc_B nbody 21.72u 0.00s 21.76r
+
+binary-tree 15 # too slow to use 20
+OLD:
+ gcc -O2 binary-tree.c -lm 0.83u 0.02s 0.84r
+ gccgo -O2 binary-tree.go 2.61u 0.02s 2.62r
+ gccgo -O2 binary-tree-freelist.go 0.32u 0.01s 0.32r
+ gc binary-tree 3.93u 0.04s 3.97r
+ gc binary-tree-freelist 0.47u 0.03s 0.50r
+NEW:
+ gcc -O2 binary-tree.c -lm 0.60u 0.00s 0.59r
+ gccgo -O2 binary-tree.go 1.53u 0.00s 1.52r
+ gccgo -O2 binary-tree-freelist.go 0.01u 0.00s 0.00r
+ gc binary-tree 1.93u 0.02s 1.95r
+ gc binary-tree-freelist 0.32u 0.01s 0.32r
+
+fannkuch 12
+OLD:
+ gcc -O2 fannkuch.c 57.64u 0.00s 57.64r
+ gccgo -O2 fannkuch.go 65.56u 0.01s 65.65r
+ gccgo -O2 fannkuch-parallel.go 179.12u 0.00s 49.82r
+ gc fannkuch 126.39u 0.00s 126.39r
+ gc fannkuch-parallel 172.49u 0.02s 45.44r
+ gc_B fannkuch 89.30u 0.00s 89.28r
+NEW:
+ gcc -O2 fannkuch.c 45.17u 0.00s 45.26r
+ gccgo -O2 fannkuch.go 53.63u 0.00s 53.73r
+ gccgo -O2 fannkuch-parallel.go 216.72u 0.00s 58.42r
+ gc fannkuch 108.21u 0.00s 108.44r
+ gc fannkuch-parallel 227.20u 0.00s 57.27r
+ gc_B fannkuch 56.14u 0.00s 56.26r
+
+regex-dna 100000
+OLD:
+ gcc -O2 regex-dna.c -lpcre 0.77u 0.01s 0.78r
+ gccgo -O2 regex-dna.go 10.15u 0.02s 10.23r
+ gccgo -O2 regex-dna-parallel.go 33.81u 3.22s 11.62r
+ gc regex-dna 6.52u 0.04s 6.56r
+ gc regex-dna-parallel 6.84u 0.03s 2.70r
+ gc_B regex-dna 6.83u 0.01s 6.84r
+NEW:
+ gcc -O2 regex-dna.c -lpcre 0.47u 0.00s 0.47r
+ gccgo -O2 regex-dna.go 6.00u 0.00s 6.00r
+ gccgo -O2 regex-dna-parallel.go 44.54u 1.57s 6.51r
+ gc regex-dna 5.41u 0.01s 5.42r
+ gc regex-dna-parallel 5.62u 0.01s 2.20r
+ gc_B regex-dna 5.50u 0.00s 5.50r
+
+spectral-norm 5500
+OLD:
+ gcc -O2 spectral-norm.c -lm 12.29u 0.00s 12.28r
+ gccgo -O2 spectral-norm.go 11.56u 0.00s 11.55r
+ gc spectral-norm 23.98u 0.00s 24.00r
+ gc_B spectral-norm 24.62u 0.00s 24.65r
+NEW:
+ gcc -O2 spectral-norm.c -lm 15.79u 0.00s 15.82r
+ gccgo -O2 spectral-norm.go 15.32u 0.00s 15.35r
+ gc spectral-norm 19.62u 0.01s 19.67r
+ gc_B spectral-norm 19.62u 0.00s 19.66r
+
+k-nucleotide 1000000
+OLD:
+ gcc -O2 k-nucleotide.c 9.82u 0.06s 9.87r
+ gccgo -O2 k-nucleotide.go 8.30u 0.02s 8.32r
+ gccgo -O2 k-nucleotide-parallel.go 8.84u 0.05s 3.02r
+ gc k-nucleotide 15.38u 0.07s 15.44r
+ gc k-nucleotide-parallel 16.40u 0.03s 5.93r
+ gc_B k-nucleotide 15.19u 0.05s 15.23r
+NEW:
+ gcc -O2 -k-nucleotide.c 4.88u 0.03s 4.92r
+ gccgo -O2 k-nucleotide.go 5.94u 0.01s 5.96r
+ gccgo -O2 k-nucleotide-parallel.go 6.44u 0.03s 1.47r
+ gc k-nucleotide 9.61u 0.01s 9.63r
+ gc k-nucleotide-parallel 9.70u 0.00s 3.39r
+ gc_B k-nucleotide 9.19u 0.03s 9.23r
+
+mandelbrot 16000
+OLD:
+ gcc -O2 mandelbrot.c 54.54u 0.00s 54.56r
+ gccgo -O2 mandelbrot.go 59.63u 0.03s 59.67r
+ gc mandelbrot 64.82u 0.00s 64.83r
+ gc_B mandelbrot 64.84u 0.00s 64.91r
+NEW:
+ gcc -O2 mandelbrot.c 36.07u 0.01s 36.15r
+ gccgo -O2 mandelbrot.go 43.57u 0.00s 43.66r
+ gc mandelbrot 60.66u 0.00s 60.79r
+ gc_B mandelbrot 60.90u 0.00s 61.03r
+
+meteor 2098
+OLD:
+ gcc -O2 meteor-contest.c 0.11u 0.00s 0.10r
+ gccgo -O2 meteor-contest.go 0.10u 0.01s 0.10r
+ gc meteor-contest 0.18u 0.00s 0.17r
+ gc_B meteor-contest 0.17u 0.00s 0.16r
+NEW:
+ gcc -O2 meteor-contest.c 0.10u 0.00s 0.09r
+ gccgo -O2 meteor-contest.go 0.10u 0.00s 0.09r
+ gc meteor-contest 0.14u 0.00s 0.14r
+ gc_B meteor-contest 0.13u 0.00s 0.13r
+
+pidigits 10000
+OLD:
+ gcc -O2 pidigits.c -lgmp 2.22u 0.00s 2.21r
+ gccgo -O2 pidigits.go 13.39u 0.00s 13.40r
+ gc pidigits 6.42u 0.04s 6.45r
+ gc_B pidigits 6.45u 0.02s 6.47r
+NEW:
+ gcc -O2 pidigits.c -lgmp 2.27u 0.00s 2.29r
+ gccgo -O2 pidigits.go 9.21u 0.00s 9.22r
+ gc pidigits 3.60u 0.00s 3.60r
+ gc_B pidigits 3.56u 0.02s 3.58r
+
+threadring 50000000
+OLD:
+ gcc -O2 threadring.c -lpthread 34.51u 267.95s 336.12r
+ gccgo -O2 threadring.go 103.51u 588.57s 627.16r
+ gc threadring 54.68u 0.00s 54.73r
+NEW:
+ gcc -O2 threadring.c 32.00u 259.39s 369.74r
+ gccgo -O2 threadring.go 133.06u 546.02s 595.33r
+ gc threadring 16.75u 0.02s 16.80r
+
+chameneos 6000000
+OLD:
+ gcc -O2 chameneosredux.c -lpthread 12.65u 31.02s 13.33r
+ gccgo -O2 chameneosredux.go 47.04u 302.84s 252.29r
+ gc chameneosredux 14.14u 0.00s 14.14r
+NEW:
+ gcc -O2 chameneosredux.c -lpthread 8.05u 63.43s 11.16r
+ gccgo -O2 chameneosredux.go 82.95u 304.37s 207.64r
+ gc chameneosredux 9.42u 0.00s 9.43r
+
+# May 13, 2011
+# after gc update to inline append when possible - 35% faster
+
+regex-dna 100000
+ gc regex-dna 3.94u 0.00s 3.95r
+ gc regex-dna-parallel 4.15u 0.01s 1.63r
+ gc_B regex-dna 4.01u 0.01s 4.02r
+
+# Aug 4, 2011
+# After various updates to locking code and some runtime changes.
+# Slowdowns believed due to slower (but more correct) memmove.
+
+fannkuch 12
+ gccgo -O2 fannkuch.go 51.59u 0.00s 51.69r # -4%
+ gccgo -O2 fannkuch-parallel.go 253.17u 0.00s 64.67r # -11%
+ gc fannkuch 103.14u 0.00s 103.36r # -5%
+ gc fannkuch-parallel 189.63u 0.00s 49.37r # +9%
+ gc_B fannkuch 49.19u 0.00s 49.29r # -14%
+
+regex-dna 100000
+ gc regex-dna 3.78u 0.00s 3.78r # -43%
+ gc regex-dna-parallel 3.84u 0.02s 1.48r # -49%
+ gc_B regex-dna 3.62u 0.00s 3.63r # -52%
+
+k-nucleotide 1000000
+ gc k-nucleotide 12.23u 0.02s 12.27r # +27%
+ gc k-nucleotide-parallel 12.76u 0.02s 4.37r # +29%
+ gc_B k-nucleotide 12.18u 0.01s 12.21r # +33%
+
+threadring 50000000
+ gc threadring 17.49u 0.00s 17.53r # +4%
+
+chameneos 6000000
+ gc chameneosredux 7.61u 0.00s 7.63r # -24%
+
+Aug 9, 2011
+# After custom algorithms for 1- 2- 4- 8-byte scalars.
+
+fannkuch 12
+ gc fannkuch-parallel 157.17u 0.00s 41.08r # -17%
+
+k-nucleotide 1000000
+ gc k-nucleotide 8.72u 0.03s 8.76r # -39%
+ gc k-nucleotide-parallel 8.79u 0.01s 3.14r # -39%
+ gc_B k-nucleotide 8.65u 0.03s 8.69r # -39%
+
+pidigits 10000
+ gc pidigits 3.71u 0.02s 3.73r # +4%
+ gc_B pidigits 3.73u 0.00s 3.73r # +4%
+
+threadring 50000000
+ gc threadring 14.51u 0.00s 14.54r # -17%
+
+chameneos 6000000
+ gc chameneosredux 7.41u 0.00s 7.42r # -3%
diff --git a/gcc/testsuite/go.test/test/chan/select6.go b/gcc/testsuite/go.test/test/chan/select6.go
new file mode 100644
index 0000000..2ba6810
--- /dev/null
+++ b/gcc/testsuite/go.test/test/chan/select6.go
@@ -0,0 +1,34 @@
+// $G $D/$F.go && $L $F.$A && ./$A.out
+
+// Copyright 2011 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// Issue 2075
+// A bug in select corrupts channel queues of failed cases
+// if there are multiple waiters on those channels and the
+// select is the last in the queue. If further waits are made
+// on the channel without draining it first then those waiters
+// will never wake up. In the code below c1 is such a channel.
+
+package main
+
+func main() {
+ c1 := make(chan bool)
+ c2 := make(chan bool)
+ c3 := make(chan bool)
+ go func() { <-c1 }()
+ go func() {
+ select {
+ case <-c1:
+ panic("dummy")
+ case <-c2:
+ c3 <- true
+ }
+ <-c1
+ }()
+ go func() { c2 <- true }()
+ <-c3
+ c1 <- true
+ c1 <- true
+}
diff --git a/gcc/testsuite/go.test/test/chan/zerosize.go b/gcc/testsuite/go.test/test/chan/zerosize.go
new file mode 100644
index 0000000..617c9da
--- /dev/null
+++ b/gcc/testsuite/go.test/test/chan/zerosize.go
@@ -0,0 +1,16 @@
+// $G $D/$F.go && $L $F.$A && ./$A.out
+
+// Copyright 2011 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// Making channels of a zero-sized type should not panic.
+
+package main
+
+func main() {
+ _ = make(chan [0]byte)
+ _ = make(chan [0]byte, 1)
+ _ = make(chan struct{})
+ _ = make(chan struct{}, 1)
+}
diff --git a/gcc/testsuite/go.test/test/declbad.go b/gcc/testsuite/go.test/test/declbad.go
index 5e5e145..09f1dfb 100644
--- a/gcc/testsuite/go.test/test/declbad.go
+++ b/gcc/testsuite/go.test/test/declbad.go
@@ -40,7 +40,7 @@ func main() {
{
// single redeclaration
i, f, s := f3()
- i := f1() // ERROR "redeclared|no new|incompatible"
+ i := 1 // ERROR "redeclared|no new|incompatible"
_, _, _ = i, f, s
}
// double redeclaration
diff --git a/gcc/testsuite/go.test/test/divide.go b/gcc/testsuite/go.test/test/divide.go
new file mode 100644
index 0000000..5c0f450
--- /dev/null
+++ b/gcc/testsuite/go.test/test/divide.go
@@ -0,0 +1,54 @@
+// $G $D/$F.go && $L $F.$A && ./$A.out
+
+// Copyright 2011 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// divide corner cases
+
+package main
+
+import "fmt"
+
+func f8(x, y, q, r int8) {
+ if t := x / y; t != q {
+ fmt.Printf("%d/%d = %d, want %d\n", x, y, t, q)
+ }
+ if t := x % y; t != r {
+ fmt.Printf("%d%%%d = %d, want %d\n", x, y, t, r)
+ }
+}
+
+func f16(x, y, q, r int16) {
+ if t := x / y; t != q {
+ fmt.Printf("%d/%d = %d, want %d\n", x, y, t, q)
+ }
+ if t := x % y; t != r {
+ fmt.Printf("%d%%%d = %d, want %d\n", x, y, t, r)
+ }
+}
+
+func f32(x, y, q, r int32) {
+ if t := x / y; t != q {
+ fmt.Printf("%d/%d = %d, want %d\n", x, y, t, q)
+ }
+ if t := x % y; t != r {
+ fmt.Printf("%d%%%d = %d, want %d\n", x, y, t, r)
+ }
+}
+
+func f64(x, y, q, r int64) {
+ if t := x / y; t != q {
+ fmt.Printf("%d/%d = %d, want %d\n", x, y, t, q)
+ }
+ if t := x % y; t != r {
+ fmt.Printf("%d%%%d = %d, want %d\n", x, y, t, r)
+ }
+}
+
+func main() {
+ f8(-1<<7, -1, -1<<7, 0)
+ f16(-1<<15, -1, -1<<15, 0)
+ f32(-1<<31, -1, -1<<31, 0)
+ f64(-1<<63, -1, -1<<63, 0)
+}
diff --git a/gcc/testsuite/go.test/test/errchk b/gcc/testsuite/go.test/test/errchk
index fbb021c..6b00570 100755
--- a/gcc/testsuite/go.test/test/errchk
+++ b/gcc/testsuite/go.test/test/errchk
@@ -17,6 +17,13 @@
use POSIX;
+my $exitcode = 1;
+
+if(@ARGV >= 1 && $ARGV[0] eq "-0") {
+ $exitcode = 0;
+ shift;
+}
+
if(@ARGV < 1) {
print STDERR "Usage: errchk COMPILER [OPTS] SOURCEFILES\n";
exit 1;
@@ -47,12 +54,18 @@ $out = join('', <CMD>);
close CMD;
-if($? == 0) {
+if($exitcode != 0 && $? == 0) {
print STDERR "BUG: errchk: command succeeded unexpectedly\n";
print STDERR @out;
exit 0;
}
+if($exitcode == 0 && $? != 0) {
+ print STDERR "BUG: errchk: command failed unexpectedly\n";
+ print STDERR @out;
+ exit 0;
+}
+
if(!WIFEXITED($?)) {
print STDERR "BUG: errchk: compiler crashed\n";
print STDERR @out, "\n";
@@ -75,25 +88,46 @@ sub chk {
$line++;
next if $src =~ m|////|; # double comment disables ERROR
next unless $src =~ m|// (GC_)?ERROR (.*)|;
- $regexp = $2;
- if($regexp !~ /^"([^"]*)"/) {
+ my $all = $2;
+ if($all !~ /^"([^"]*)"/) {
print STDERR "$file:$line: malformed regexp\n";
next;
}
- $regexp = $1;
-
@errmsg = grep { /$file:$line[:[]/ } @out;
@out = grep { !/$file:$line[:[]/ } @out;
if(@errmsg == 0) {
bug();
- print STDERR "errchk: $file:$line: missing expected error: '$regexp'\n";
+ print STDERR "errchk: $file:$line: missing expected error: '$all'\n";
next;
}
- @match = grep { /$regexp/ } @errmsg;
- if(@match == 0) {
+ foreach my $regexp ($all =~ /"([^"]*)"/g) {
+ # Turn relative line number in message into absolute line number.
+ if($regexp =~ /LINE(([+-])([0-9]+))?/) {
+ my $n = $line;
+ if(defined($1)) {
+ if($2 eq "+") {
+ $n += int($3);
+ } else {
+ $n -= int($3);
+ }
+ }
+ $regexp = "$`$file:$n$'";
+ }
+
+ @match = grep { /$regexp/ } @errmsg;
+ if(@match == 0) {
+ bug();
+ print STDERR "errchk: $file:$line: error messages do not match '$regexp'\n";
+ next;
+ }
+ @errmsg = grep { !/$regexp/ } @errmsg;
+ }
+ if(@errmsg != 0) {
bug();
- print STDERR "errchk: $file:$line: error message does not match '$regexp'\n";
- next;
+ print STDERR "errchk: $file:$line: unmatched error messages:\n";
+ foreach my $l (@errmsg) {
+ print STDERR "> $l";
+ }
}
}
}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/bug205.go b/gcc/testsuite/go.test/test/fixedbugs/bug205.go
index 4262ec1..e12be72 100644
--- a/gcc/testsuite/go.test/test/fixedbugs/bug205.go
+++ b/gcc/testsuite/go.test/test/fixedbugs/bug205.go
@@ -12,7 +12,7 @@ var m map[string]int;
func main() {
println(t["hi"]); // ERROR "integer"
- println(s["hi"]); // ERROR "integer"
+ println(s["hi"]); // ERROR "integer" "to type uint"
println(m[0]); // ERROR "map index"
}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/bug228.go b/gcc/testsuite/go.test/test/fixedbugs/bug228.go
index 81bc908..da335db 100644
--- a/gcc/testsuite/go.test/test/fixedbugs/bug228.go
+++ b/gcc/testsuite/go.test/test/fixedbugs/bug228.go
@@ -8,7 +8,7 @@ package main
func f(x int, y ...int) // ok
-func g(x int, y float) (...) // ERROR "[.][.][.]"
+func g(x int, y float) (...) // ERROR "[.][.][.]" "final argument"
func h(x, y ...int) // ERROR "[.][.][.]"
diff --git a/gcc/testsuite/go.test/test/fixedbugs/bug229.go b/gcc/testsuite/go.test/test/fixedbugs/bug229.go
index fe0f0d8..6c9de9b 100644
--- a/gcc/testsuite/go.test/test/fixedbugs/bug229.go
+++ b/gcc/testsuite/go.test/test/fixedbugs/bug229.go
@@ -16,5 +16,5 @@ func main() {
t.ch = nil // ERROR "unexported"
- println(testing.anyLowercaseName("asdf")) // ERROR "unexported"
+ println(testing.anyLowercaseName("asdf")) // ERROR "unexported" "undefined: testing.anyLowercaseName"
}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/bug231.go b/gcc/testsuite/go.test/test/fixedbugs/bug231.go
index 91996d3..9500e58 100644
--- a/gcc/testsuite/go.test/test/fixedbugs/bug231.go
+++ b/gcc/testsuite/go.test/test/fixedbugs/bug231.go
@@ -17,6 +17,6 @@ func main() {
var i I
i = m
- i = t // ERROR "not a method|has no methods"
+ i = t // ERROR "not a method|has no methods" "does not implement I"
_ = i
}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/bug238.go b/gcc/testsuite/go.test/test/fixedbugs/bug238.go
index 7e8660d..4d5a905 100644
--- a/gcc/testsuite/go.test/test/fixedbugs/bug238.go
+++ b/gcc/testsuite/go.test/test/fixedbugs/bug238.go
@@ -19,4 +19,3 @@ const h bool = false
const i int = 2
const j float64 = 5
-func main() { println(a, b, c, d, e, f, g) }
diff --git a/gcc/testsuite/go.test/test/fixedbugs/bug273.go b/gcc/testsuite/go.test/test/fixedbugs/bug273.go
index 816f69e..dd5aaa7 100644
--- a/gcc/testsuite/go.test/test/fixedbugs/bug273.go
+++ b/gcc/testsuite/go.test/test/fixedbugs/bug273.go
@@ -47,15 +47,6 @@ func bigcap() {
g1 = make([]int, 10, big)
}
-const (
- addrBits = 8*uint(unsafe.Sizeof((*byte)(nil)))
- sh = addrBits/2 - 2
-)
-var g2 [][1<<sh][1<<sh]byte
-func overflow() {
- g2 = make([][1<<sh][1<<sh]byte, 64)
-}
-
var g3 map[int]int
func badmapcap() {
g3 = make(map[int]int, minus1)
@@ -74,6 +65,8 @@ func bigchancap() {
g4 = make(chan int, big)
}
+const addrBits = unsafe.Sizeof((*byte)(nil))
+
var g5 chan [1<<15]byte
func overflowchan() {
if addrBits == 32 {
@@ -92,7 +85,6 @@ func main() {
shouldfail(badcap, "badcap")
shouldfail(badcap1, "badcap1")
shouldfail(bigcap, "bigcap")
- shouldfail(overflow, "overflow")
shouldfail(badmapcap, "badmapcap")
shouldfail(bigmapcap, "bigmapcap")
shouldfail(badchancap, "badchancap")
diff --git a/gcc/testsuite/go.test/test/fixedbugs/bug274.go b/gcc/testsuite/go.test/test/fixedbugs/bug274.go
index 348aed4..198544c 100644
--- a/gcc/testsuite/go.test/test/fixedbugs/bug274.go
+++ b/gcc/testsuite/go.test/test/fixedbugs/bug274.go
@@ -25,6 +25,7 @@ func main() {
L1: // ERROR "statement"
default:
// correct since no semicolon is required before a '}'
- L2: // GCCGO_ERROR "not used"
+ goto L2
+ L2:
}
}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/bug297.go b/gcc/testsuite/go.test/test/fixedbugs/bug297.go
index ba02942..8767cdf 100644
--- a/gcc/testsuite/go.test/test/fixedbugs/bug297.go
+++ b/gcc/testsuite/go.test/test/fixedbugs/bug297.go
@@ -11,5 +11,5 @@ package main
type ByteSize float64
const (
_ = iota; // ignore first value by assigning to blank identifier
- KB ByteSize = 1<<(10*X) // ERROR "undefined"
+ KB ByteSize = 1<<(10*X) // ERROR "undefined" "as type ByteSize"
)
diff --git a/gcc/testsuite/go.test/test/fixedbugs/bug298.go b/gcc/testsuite/go.test/test/fixedbugs/bug298.go
index fe4a99a..c16c3f9 100644
--- a/gcc/testsuite/go.test/test/fixedbugs/bug298.go
+++ b/gcc/testsuite/go.test/test/fixedbugs/bug298.go
@@ -7,5 +7,5 @@
package ddd
func Sum() int
- for i := range []int{} { return i } // ERROR "return outside function|expected"
+ for i := range []int{} { return i } // ERROR "statement outside function|expected"
diff --git a/gcc/testsuite/go.test/test/bugs/bug322.dir/lib.go b/gcc/testsuite/go.test/test/fixedbugs/bug322.dir/lib.go
index 0de56d3..0de56d3 100644
--- a/gcc/testsuite/go.test/test/bugs/bug322.dir/lib.go
+++ b/gcc/testsuite/go.test/test/fixedbugs/bug322.dir/lib.go
diff --git a/gcc/testsuite/go.test/test/bugs/bug322.dir/main.go b/gcc/testsuite/go.test/test/fixedbugs/bug322.dir/main.go
index 0ab5b32..f403c7d 100644
--- a/gcc/testsuite/go.test/test/bugs/bug322.dir/main.go
+++ b/gcc/testsuite/go.test/test/fixedbugs/bug322.dir/main.go
@@ -38,10 +38,3 @@ func main() {
var pi2 PI = pt
pi2.PM()
}
-
-/*
-These should not be errors anymore:
-
-bug322.dir/main.go:19: implicit assignment of unexported field 'x' of lib.T in method receiver
-bug322.dir/main.go:32: implicit assignment of unexported field 'x' of lib.T in method receiver
-*/
diff --git a/gcc/testsuite/go.test/test/bugs/bug322.go b/gcc/testsuite/go.test/test/fixedbugs/bug322.go
index ad0e62d..ad0e62d 100644
--- a/gcc/testsuite/go.test/test/bugs/bug322.go
+++ b/gcc/testsuite/go.test/test/fixedbugs/bug322.go
diff --git a/gcc/testsuite/go.test/test/bugs/bug324.dir/main.go b/gcc/testsuite/go.test/test/fixedbugs/bug324.dir/main.go
index 4c1a18d..3ab61f3 100644
--- a/gcc/testsuite/go.test/test/bugs/bug324.dir/main.go
+++ b/gcc/testsuite/go.test/test/fixedbugs/bug324.dir/main.go
@@ -14,7 +14,7 @@ type Exported interface {
type Implementation struct{}
-func (p *Implementation) private() { println("main.Implementation.private()") }
+func (p *Implementation) private() {}
func main() {
@@ -40,7 +40,12 @@ func main() {
// x = px
// this assignment unexpectedly compiles and then executes
+ defer func() {
+ recover()
+ }()
x = px.(Exported)
+
+ println("should not get this far")
// this is a legitimate call, but because of the previous assignment,
// it invokes the method private in p!
diff --git a/gcc/testsuite/go.test/test/bugs/bug324.dir/p.go b/gcc/testsuite/go.test/test/fixedbugs/bug324.dir/p.go
index d1e3b99..d1e3b99 100644
--- a/gcc/testsuite/go.test/test/bugs/bug324.dir/p.go
+++ b/gcc/testsuite/go.test/test/fixedbugs/bug324.dir/p.go
diff --git a/gcc/testsuite/go.test/test/bugs/bug324.go b/gcc/testsuite/go.test/test/fixedbugs/bug324.go
index e188515..3da7563 100644
--- a/gcc/testsuite/go.test/test/bugs/bug324.go
+++ b/gcc/testsuite/go.test/test/fixedbugs/bug324.go
@@ -1,4 +1,4 @@
-// $G $D/$F.dir/p.go && $G $D/$F.dir/main.go && $L main.$A && ! ./$A.out || echo BUG: should fail
+// $G $D/$F.dir/p.go && $G $D/$F.dir/main.go && $L main.$A && ./$A.out
// Copyright 2011 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
diff --git a/gcc/testsuite/go.test/test/fixedbugs/bug327.go b/gcc/testsuite/go.test/test/fixedbugs/bug327.go
new file mode 100644
index 0000000..4ba5f60
--- /dev/null
+++ b/gcc/testsuite/go.test/test/fixedbugs/bug327.go
@@ -0,0 +1,24 @@
+// $G $D/$F.go && $L $F.$A && ./$A.out
+
+// Copyright 2011 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// Conversion between identical interfaces.
+// Issue 1647.
+
+// The compiler used to not realize this was a no-op,
+// so it generated a call to the non-existent function runtime.convE2E.
+
+package main
+
+type (
+ a interface{}
+ b interface{}
+)
+
+func main() {
+ x := a(1)
+ z := b(x)
+ _ = z
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/bug328.go b/gcc/testsuite/go.test/test/fixedbugs/bug328.go
new file mode 100644
index 0000000..64041f4
--- /dev/null
+++ b/gcc/testsuite/go.test/test/fixedbugs/bug328.go
@@ -0,0 +1,14 @@
+// $G $D/$F.go && $L $F.$A && ./$A.out
+
+// Copyright 2011 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package main
+
+import "unsafe"
+
+func main() {
+ var p unsafe.Pointer
+ println(p)
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/bug329.go b/gcc/testsuite/go.test/test/fixedbugs/bug329.go
new file mode 100644
index 0000000..0b7074d
--- /dev/null
+++ b/gcc/testsuite/go.test/test/fixedbugs/bug329.go
@@ -0,0 +1,46 @@
+// $G $D/$F.go && $L $F.$A && ./$A.out
+
+// Copyright 2011 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package main
+
+type Value struct {
+ X interface{}
+ Y int
+}
+
+type Struct struct {
+ X complex128
+}
+
+const magic = 1 + 2i
+
+func (Value) Complex(x complex128) {
+ if x != magic {
+ println(x)
+ panic("bad complex magic")
+ }
+}
+
+func f(x *byte, y, z int) complex128 {
+ return magic
+}
+
+func (Value) Struct(x Struct) {
+ if x.X != magic {
+ println(x.X)
+ panic("bad struct magic")
+ }
+}
+
+func f1(x *byte, y, z int) Struct {
+ return Struct{magic}
+}
+
+func main() {
+ var v Value
+ v.Struct(f1(nil, 0, 0)) // ok
+ v.Complex(f(nil, 0, 0)) // used to fail
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/bug330.go b/gcc/testsuite/go.test/test/fixedbugs/bug330.go
new file mode 100644
index 0000000..114492a
--- /dev/null
+++ b/gcc/testsuite/go.test/test/fixedbugs/bug330.go
@@ -0,0 +1,13 @@
+// errchk $G -e $D/$F.go
+
+// Copyright 2011 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package main
+
+func main() {
+ x := ""
+ x = +"hello" // ERROR "invalid operation.*string|expected numeric"
+ x = +x // ERROR "invalid operation.*string|expected numeric"
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/bug331.go b/gcc/testsuite/go.test/test/fixedbugs/bug331.go
new file mode 100644
index 0000000..28aee1d
--- /dev/null
+++ b/gcc/testsuite/go.test/test/fixedbugs/bug331.go
@@ -0,0 +1,36 @@
+// $G $D/$F.go && $L $F.$A && ./$A.out || echo BUG: bug331
+
+// Copyright 2011 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package main
+
+import "os"
+
+func f() (_ string, x float64, err os.Error) {
+ return
+}
+
+func g() (_ string, x float64, err os.Error) {
+ return "hello", 3.14, os.EOF
+}
+
+var _ func() (string, float64, os.Error) = f
+var _ func() (string, float64, os.Error) = g
+
+func main() {
+ x, y, z := g()
+ if x != "hello" || y != 3.14 || z != os.EOF {
+ println("wrong", x, len(x), y, z)
+ }
+}
+
+/*
+issue 1712
+
+bug331.go:12: cannot use "hello" (type string) as type float64 in assignment
+bug331.go:12: cannot use 0 (type float64) as type os.Error in assignment:
+ float64 does not implement os.Error (missing String method)
+bug331.go:12: error in shape across RETURN
+*/
diff --git a/gcc/testsuite/go.test/test/fixedbugs/bug332.go b/gcc/testsuite/go.test/test/fixedbugs/bug332.go
new file mode 100644
index 0000000..be79286
--- /dev/null
+++ b/gcc/testsuite/go.test/test/fixedbugs/bug332.go
@@ -0,0 +1,17 @@
+// errchk $G $D/$F.go
+
+// Copyright 2011 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package main
+
+// type T int
+
+func main() {}
+
+// issue 1474
+
+// important: no newline on end of next line.
+// 6g used to print <epoch> instead of bug332.go:111
+func (t *T) F() {} // ERROR "bug332" \ No newline at end of file
diff --git a/gcc/testsuite/go.test/test/fixedbugs/bug333.go b/gcc/testsuite/go.test/test/fixedbugs/bug333.go
new file mode 100644
index 0000000..515c1f3
--- /dev/null
+++ b/gcc/testsuite/go.test/test/fixedbugs/bug333.go
@@ -0,0 +1,19 @@
+// $G $D/$F.go && $L $F.$A && ./$A.out
+
+// Copyright 2011 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// Issue 1709
+
+package main
+
+func main() {
+ type Ts string
+ var ts Ts
+ _ = []byte(ts)
+}
+
+/*
+bug333.go:14: cannot use ts (type Ts) as type string in function argument
+*/
diff --git a/gcc/testsuite/go.test/test/fixedbugs/bug334.go b/gcc/testsuite/go.test/test/fixedbugs/bug334.go
new file mode 100644
index 0000000..870c9ae
--- /dev/null
+++ b/gcc/testsuite/go.test/test/fixedbugs/bug334.go
@@ -0,0 +1,31 @@
+// $G $D/$F.go || echo BUG: bug334
+
+// Copyright 2011 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// Issue 1716
+
+package main
+
+type (
+ cplx64 complex64
+ cplx128 complex128
+)
+
+func (c cplx64) Foo() {}
+func (c cplx128) Foo() {}
+
+func main() {
+ var c64 cplx128
+ var c128 cplx64
+ c64.Foo()
+ c128.Foo()
+}
+
+/*
+bug334.go:16: invalid receiver type cplx64
+bug334.go:17: invalid receiver type cplx128
+bug334.go:22: c64.Foo undefined (type cplx128 has no field or method Foo)
+bug334.go:23: c128.Foo undefined (type cplx64 has no field or method Foo)
+*/
diff --git a/gcc/testsuite/go.test/test/fixedbugs/bug335.dir/a.go b/gcc/testsuite/go.test/test/fixedbugs/bug335.dir/a.go
new file mode 100644
index 0000000..5a8112a
--- /dev/null
+++ b/gcc/testsuite/go.test/test/fixedbugs/bug335.dir/a.go
@@ -0,0 +1,9 @@
+// Copyright 2011 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package a
+
+import "./b"
+
+var Bar = b.Foo
diff --git a/gcc/testsuite/go.test/test/fixedbugs/bug335.dir/b.go b/gcc/testsuite/go.test/test/fixedbugs/bug335.dir/b.go
new file mode 100644
index 0000000..7428c2a
--- /dev/null
+++ b/gcc/testsuite/go.test/test/fixedbugs/bug335.dir/b.go
@@ -0,0 +1,11 @@
+// Copyright 2011 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package b
+
+type T interface{}
+
+func f() T { return nil }
+
+var Foo T = f()
diff --git a/gcc/testsuite/go.test/test/fixedbugs/bug335.go b/gcc/testsuite/go.test/test/fixedbugs/bug335.go
new file mode 100644
index 0000000..915b746
--- /dev/null
+++ b/gcc/testsuite/go.test/test/fixedbugs/bug335.go
@@ -0,0 +1,10 @@
+// $G $D/$F.dir/b.go && $G $D/$F.dir/a.go
+// rm -f a.$A b.$A
+
+// Copyright 2011 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// Issue 1705.
+
+unused (see script at top of file)
diff --git a/gcc/testsuite/go.test/test/fixedbugs/bug336.go b/gcc/testsuite/go.test/test/fixedbugs/bug336.go
new file mode 100644
index 0000000..8de3689
--- /dev/null
+++ b/gcc/testsuite/go.test/test/fixedbugs/bug336.go
@@ -0,0 +1,86 @@
+// $G $D/$F.go && $L $F.$A && ./$A.out
+
+// Copyright 2011 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package main
+
+type T1 struct {
+ Next *T2
+}
+
+type T2 T1
+
+type T3 struct {
+ Next *T4
+}
+
+type T4 T5
+type T5 T6
+type T6 T7
+type T7 T8
+type T8 T9
+type T9 T3
+
+type T10 struct {
+ x struct {
+ y ***struct {
+ z *struct {
+ Next *T11
+ }
+ }
+ }
+}
+
+type T11 T10
+
+type T12 struct {
+ F1 *T15
+ F2 *T13
+ F3 *T16
+}
+
+type T13 T14
+type T14 T15
+type T15 T16
+type T16 T17
+type T17 T12
+
+// issue 1672
+type T18 *[10]T19
+type T19 T18
+
+func main() {
+ _ = &T1{&T2{}}
+ _ = &T2{&T2{}}
+ _ = &T3{&T4{}}
+ _ = &T4{&T4{}}
+ _ = &T5{&T4{}}
+ _ = &T6{&T4{}}
+ _ = &T7{&T4{}}
+ _ = &T8{&T4{}}
+ _ = &T9{&T4{}}
+ _ = &T12{&T15{}, &T13{}, &T16{}}
+
+ var (
+ tn struct{ Next *T11 }
+ tz struct{ z *struct{ Next *T11 } }
+ tpz *struct{ z *struct{ Next *T11 } }
+ tppz **struct{ z *struct{ Next *T11 } }
+ tpppz ***struct{ z *struct{ Next *T11 } }
+ ty struct {
+ y ***struct{ z *struct{ Next *T11 } }
+ }
+ )
+ tn.Next = &T11{}
+ tz.z = &tn
+ tpz = &tz
+ tppz = &tpz
+ tpppz = &tppz
+ ty.y = tpppz
+ _ = &T10{ty}
+
+ t19s := &[10]T19{}
+ _ = T18(t19s)
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/bug337.go b/gcc/testsuite/go.test/test/fixedbugs/bug337.go
new file mode 100644
index 0000000..ca9b4b4
--- /dev/null
+++ b/gcc/testsuite/go.test/test/fixedbugs/bug337.go
@@ -0,0 +1,19 @@
+// errchk $G $D/$F.go
+
+// Copyright 2011 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// Issue 1722.
+
+// Check that the error messages says
+// bug337.go:16: len("foo") not used
+// and not
+// bug337.go:16: 3 not used
+
+package main
+
+func main() {
+ len("foo") // ERROR "len|value computed is not used"
+}
+
diff --git a/gcc/testsuite/go.test/test/fixedbugs/bug338.go b/gcc/testsuite/go.test/test/fixedbugs/bug338.go
new file mode 100644
index 0000000..c368a7f
--- /dev/null
+++ b/gcc/testsuite/go.test/test/fixedbugs/bug338.go
@@ -0,0 +1,22 @@
+// $G $D/$F.go
+
+// Copyright 2011 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// Issue 1787.
+
+package main
+
+import "unsafe"
+
+const x = unsafe.Sizeof([8]byte{})
+
+func main() {
+ var b [x]int
+ _ = b
+}
+
+/*
+bug338.go:14: array bound must be non-negative
+*/
diff --git a/gcc/testsuite/go.test/test/fixedbugs/bug339.go b/gcc/testsuite/go.test/test/fixedbugs/bug339.go
new file mode 100644
index 0000000..eac7c5e
--- /dev/null
+++ b/gcc/testsuite/go.test/test/fixedbugs/bug339.go
@@ -0,0 +1,20 @@
+// $G $D/$F.go && $L $F.$A && ./$A.out
+
+// Copyright 2011 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// Issue 1608.
+// Size used to be -1000000000.
+
+package main
+
+import "unsafe"
+
+func main() {
+ var a interface{} = 0
+ size := unsafe.Sizeof(a)
+ if size != 2*unsafe.Sizeof((*int)(nil)) {
+ println("wrong size: ", size)
+ }
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/bug340.go b/gcc/testsuite/go.test/test/fixedbugs/bug340.go
new file mode 100644
index 0000000..461cc6c
--- /dev/null
+++ b/gcc/testsuite/go.test/test/fixedbugs/bug340.go
@@ -0,0 +1,17 @@
+// errchk $G $D/$F.go
+
+// Copyright 2011 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// Issue 1606.
+
+package main
+
+func main() {
+ var x interface{}
+ switch t := x.(type) { // ERROR "0 is not a type"
+ case 0:
+ t.x = 1 // ERROR "type interface \{ \}"
+ }
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/bug341.go b/gcc/testsuite/go.test/test/fixedbugs/bug341.go
new file mode 100644
index 0000000..8ee52e1
--- /dev/null
+++ b/gcc/testsuite/go.test/test/fixedbugs/bug341.go
@@ -0,0 +1,22 @@
+// $G $D/$F.go && $L $F.$A && ./$A.out || echo BUG: bug341
+
+// Copyright 2011 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// Used to panic because 8g was generating incorrect
+// code for converting a negative float to a uint64.
+
+package main
+
+func main() {
+ var x float32 = -2.5
+
+ _ = uint64(x)
+ _ = float32(0)
+}
+/*
+panic: runtime error: floating point error
+
+[signal 0x8 code=0x6 addr=0x8048c64 pc=0x8048c64]
+*/
diff --git a/gcc/testsuite/go.test/test/fixedbugs/bug342.go b/gcc/testsuite/go.test/test/fixedbugs/bug342.go
new file mode 100644
index 0000000..0852cdd
--- /dev/null
+++ b/gcc/testsuite/go.test/test/fixedbugs/bug342.go
@@ -0,0 +1,24 @@
+// errchk $G $D/$F.go
+
+// Copyright 2011 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// Issue 1871.
+
+package p
+
+type a interface {
+ foo(x int) (x int) // ERROR "redeclared|redefinition"
+}
+
+var b interface {
+ bar(y int) (y int) // ERROR "redeclared|redefinition"
+}
+
+/*
+Previously:
+
+bug.go:1 x redclared in this block
+ previous declaration at bug.go:1
+*/
diff --git a/gcc/testsuite/go.test/test/fixedbugs/bug343.go b/gcc/testsuite/go.test/test/fixedbugs/bug343.go
new file mode 100644
index 0000000..efc87e3
--- /dev/null
+++ b/gcc/testsuite/go.test/test/fixedbugs/bug343.go
@@ -0,0 +1,33 @@
+// $G $D/$F.go && $L $F.$A && ./$A.out || echo BUG: bug343
+
+// Copyright 2011 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// issue 1900
+
+package main
+
+func getArgs(data map[string]interface{}, keys ...string) map[string]string {
+ ret := map[string]string{}
+ var ok bool
+ for _, k := range keys {
+ ret[k], ok = data[k].(string)
+ if !ok {}
+ }
+ return ret
+}
+
+func main() {
+ x := getArgs(map[string]interface{}{"x":"y"}, "x")
+ if x["x"] != "y" {
+ println("BUG bug343", x)
+ }
+}
+
+
+/*
+typecheck [1008592b0]
+. INDREG a(1) l(15) x(24) tc(2) runtime.ret G0 string
+bug343.go:15: internal compiler error: typecheck INDREG
+*/
diff --git a/gcc/testsuite/go.test/test/fixedbugs/bug344.go b/gcc/testsuite/go.test/test/fixedbugs/bug344.go
new file mode 100644
index 0000000..ce953f7
--- /dev/null
+++ b/gcc/testsuite/go.test/test/fixedbugs/bug344.go
@@ -0,0 +1,24 @@
+// errchk $G -e $D/$F.go
+
+// Copyright 2011 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package main
+
+import "fmt"
+
+func main() {
+ // invalid use of goto.
+ // do whatever you like, just don't crash.
+ i := 42
+ a := []*int{&i, &i, &i, &i}
+ x := a[0]
+ goto start // ERROR "jumps into block"
+ z := 1
+ _ = z
+ for _, x = range a { // GCCGO_ERROR "block"
+ start:
+ fmt.Sprint(*x)
+ }
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/bug345.dir/io.go b/gcc/testsuite/go.test/test/fixedbugs/bug345.dir/io.go
new file mode 100644
index 0000000..1d695c3
--- /dev/null
+++ b/gcc/testsuite/go.test/test/fixedbugs/bug345.dir/io.go
@@ -0,0 +1,15 @@
+// Copyright 2011 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package io
+
+type Writer interface {
+ WrongWrite()
+}
+
+type SectionReader struct {
+ X int
+}
+
+func SR(*SectionReader) {}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/bug345.dir/main.go b/gcc/testsuite/go.test/test/fixedbugs/bug345.dir/main.go
new file mode 100644
index 0000000..5bdc713
--- /dev/null
+++ b/gcc/testsuite/go.test/test/fixedbugs/bug345.dir/main.go
@@ -0,0 +1,28 @@
+// Copyright 2011 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package main
+
+import (
+ "bufio"
+ "./io"
+ goio "io"
+)
+
+func main() {
+ // The errors here complain that io.X != io.X
+ // for different values of io so they should be
+ // showing the full import path, which for the
+ // "./io" import is really ..../go/test/io.
+ // For example:
+ //
+ // main.go:25: cannot use w (type "/Users/rsc/g/go/test/fixedbugs/bug345.dir/io".Writer) as type "io".Writer in function argument:
+ // io.Writer does not implement io.Writer (missing Write method)
+ // main.go:27: cannot use &x (type *"io".SectionReader) as type *"/Users/rsc/g/go/test/fixedbugs/bug345.dir/io".SectionReader in function argument
+
+ var w io.Writer
+ bufio.NewWriter(w) // ERROR "test/io"
+ var x goio.SectionReader
+ io.SR(&x) // ERROR "test/io"
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/bug345.go b/gcc/testsuite/go.test/test/fixedbugs/bug345.go
new file mode 100644
index 0000000..874710c
--- /dev/null
+++ b/gcc/testsuite/go.test/test/fixedbugs/bug345.go
@@ -0,0 +1,7 @@
+// $G $D/$F.dir/io.go && errchk $G -e $D/$F.dir/main.go
+
+// Copyright 2011 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package ignored
diff --git a/gcc/testsuite/go.test/test/fixedbugs/bug346.go b/gcc/testsuite/go.test/test/fixedbugs/bug346.go
new file mode 100644
index 0000000..31284c3
--- /dev/null
+++ b/gcc/testsuite/go.test/test/fixedbugs/bug346.go
@@ -0,0 +1,19 @@
+// $G $D/$F.go && $L $F.$A && ./$A.out || echo BUG: issue2056
+
+// Copyright 2011 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package main
+
+import "os"
+
+func main() {
+ x := 4
+ a, b, c, d := func(i int) (p int, q int, r int, s int) { return 1, i, 3, x }(2)
+
+ if a != 1 || b != 2 || c != 3 || d != 4 {
+ println("abcd: expected 1 2 3 4 got", a, b, c, d)
+ os.Exit(1)
+ }
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/bug347.go b/gcc/testsuite/go.test/test/fixedbugs/bug347.go
new file mode 100644
index 0000000..5532cee
--- /dev/null
+++ b/gcc/testsuite/go.test/test/fixedbugs/bug347.go
@@ -0,0 +1,49 @@
+// $G $D/$F.go && $L $F.$A && ./$A.out
+
+// Copyright 2011 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package main
+
+import (
+ "runtime"
+ "strings"
+)
+
+var t *struct {
+ c chan int
+}
+
+var c chan int
+
+func f() {
+ select {
+ case <-t.c: // THIS IS LINE 22
+ break
+ case <-c:
+ break
+ }
+}
+
+func main() {
+ defer func() {
+ recover()
+ for i := 0;; i++ {
+ pc, file, line, ok := runtime.Caller(i)
+ if !ok {
+ print("BUG: bug347: cannot find caller\n")
+ return
+ }
+ if !strings.Contains(file, "bug347.go") || runtime.FuncForPC(pc).Name() != "main.f" {
+ // walk past runtime frames
+ continue
+ }
+ if line != 22 {
+ print("BUG: bug347: panic at ", file, ":", line, " in ", runtime.FuncForPC(pc).Name(), "\n")
+ }
+ return
+ }
+ }()
+ f()
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/bug348.go b/gcc/testsuite/go.test/test/fixedbugs/bug348.go
new file mode 100644
index 0000000..1a539aa
--- /dev/null
+++ b/gcc/testsuite/go.test/test/fixedbugs/bug348.go
@@ -0,0 +1,46 @@
+// $G $D/$F.go && $L $F.$A && ./$A.out
+
+// Copyright 2011 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package main
+
+import (
+ "runtime"
+ "strings"
+)
+
+func f() {
+ var x *string
+
+ for _, i := range *x { // THIS IS LINE 17
+ println(i)
+ }
+}
+
+func g() {
+}
+
+func main() {
+ defer func() {
+ for i := 0;; i++ {
+ pc, file, line, ok := runtime.Caller(i)
+ if !ok {
+ print("BUG: bug348: cannot find caller\n")
+ return
+ }
+ if !strings.Contains(file, "bug348.go") || runtime.FuncForPC(pc).Name() != "main.f" {
+ // walk past runtime frames
+ continue
+ }
+ if line != 17 {
+ print("BUG: bug348: panic at ", file, ":", line, " in ", runtime.FuncForPC(pc).Name(), "\n")
+ return
+ }
+ recover()
+ return
+ }
+ }()
+ f()
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/bug349.go b/gcc/testsuite/go.test/test/fixedbugs/bug349.go
new file mode 100644
index 0000000..e7612ed
--- /dev/null
+++ b/gcc/testsuite/go.test/test/fixedbugs/bug349.go
@@ -0,0 +1,13 @@
+// errchk $G $D/$F.go
+
+// Copyright 2011 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// issue 1192 - detail in error
+
+package main
+
+func foo() (a, b, c int) {
+ return 0, 1 2.01 // ERROR "unexpected literal 2.01|expected ';' or '}' or newline|not enough arguments to return"
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/bug350.go b/gcc/testsuite/go.test/test/fixedbugs/bug350.go
new file mode 100644
index 0000000..aac2949
--- /dev/null
+++ b/gcc/testsuite/go.test/test/fixedbugs/bug350.go
@@ -0,0 +1,15 @@
+// errchk $G $D/$F.go
+
+// Copyright 2011 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package main
+
+type T int
+
+func (T) m() {}
+func (T) m() {} // ERROR "T[.]m redeclared"
+
+func (*T) p() {}
+func (*T) p() {} // ERROR "[(][*]T[)][.]p redeclared"
diff --git a/gcc/testsuite/go.test/test/fixedbugs/bug351.go b/gcc/testsuite/go.test/test/fixedbugs/bug351.go
new file mode 100644
index 0000000..2f631bb
--- /dev/null
+++ b/gcc/testsuite/go.test/test/fixedbugs/bug351.go
@@ -0,0 +1,13 @@
+// errchk $G $D/$F.go
+
+// Copyright 2011 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package main
+
+var x int
+
+func main() {
+ (x) := 0 // ERROR "non-name [(]x[)]"
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/bug352.go b/gcc/testsuite/go.test/test/fixedbugs/bug352.go
new file mode 100644
index 0000000..62fd006
--- /dev/null
+++ b/gcc/testsuite/go.test/test/fixedbugs/bug352.go
@@ -0,0 +1,19 @@
+// $G $D/$F.go && $L $F.$A && ./$A.out || echo BUG: bug352
+
+// Copyright 2011 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package main
+
+var x [10][0]byte
+var y = make([]struct{}, 10)
+
+func main() {
+ if &x[1] != &x[2] {
+ println("BUG: bug352 [0]byte")
+ }
+ if &y[1] != &y[2] {
+ println("BUG: bug352 struct{}")
+ }
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/bug353.go b/gcc/testsuite/go.test/test/fixedbugs/bug353.go
new file mode 100644
index 0000000..b59d97f
--- /dev/null
+++ b/gcc/testsuite/go.test/test/fixedbugs/bug353.go
@@ -0,0 +1,30 @@
+// errchk $G $D/$F.go
+
+// Copyright 2011 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// issue 2089 - internal compiler error
+
+package main
+
+import (
+ "io"
+ "os"
+)
+
+func echo(fd io.ReadWriterCloser) { // ERROR "undefined.*io.ReadWriterCloser"
+ var buf [1024]byte
+ for {
+ n, err := fd.Read(buf)
+ if err != nil {
+ break
+ }
+ fd.Write(buf[0:n])
+ }
+}
+
+func main() {
+ fd, _ := os.Open("a.txt")
+ echo(fd)
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/bug354.go b/gcc/testsuite/go.test/test/fixedbugs/bug354.go
new file mode 100644
index 0000000..1f6a6dc
--- /dev/null
+++ b/gcc/testsuite/go.test/test/fixedbugs/bug354.go
@@ -0,0 +1,26 @@
+// $G $D/$F.go || echo BUG: bug354
+
+// Copyright 2011 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// issue 2086
+// was calling makeclosure twice on the closure
+
+package main
+
+import (
+ "os"
+)
+
+type Inner struct {
+ F func() os.Error
+}
+
+type Outer struct {
+ Inners []Inner
+}
+
+// calls makeclosure twice on same closure
+
+var Foo = Outer{[]Inner{Inner{func() os.Error{ return nil }}}}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/bug355.go b/gcc/testsuite/go.test/test/fixedbugs/bug355.go
new file mode 100644
index 0000000..a9cf016
--- /dev/null
+++ b/gcc/testsuite/go.test/test/fixedbugs/bug355.go
@@ -0,0 +1,18 @@
+// $G $D/$F.go && $L $F.$A && ./$A.out
+
+// Copyright 2011 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package main
+
+var f = func() int {
+ type S int
+ return 42
+}
+
+func main() {
+ if f() != 42 {
+ panic("BUG: bug355")
+ }
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/bug356.go b/gcc/testsuite/go.test/test/fixedbugs/bug356.go
new file mode 100644
index 0000000..d21f0cf
--- /dev/null
+++ b/gcc/testsuite/go.test/test/fixedbugs/bug356.go
@@ -0,0 +1,41 @@
+// $G $D/$F.go && $L $F.$A && ./$A.out || echo BUG: bug344
+
+// Copyright 2011 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// issue 1808
+
+package main
+
+func main() {
+ var i uint64
+ var x int = 12345
+
+ if y := x << (i&5); y != 12345<<0 {
+ println("BUG bug344", y)
+ return
+ }
+
+ i++
+ if y := x << (i&5); y != 12345<<1 {
+ println("BUG bug344a", y)
+ }
+
+ i = 70
+ if y := x << i; y != 0 {
+ println("BUG bug344b", y)
+ }
+
+ i = 1<<32
+ if y := x << i; y != 0 {
+ println("BUG bug344c", y)
+ }
+}
+
+
+/*
+typecheck [1008592b0]
+. INDREG a(1) l(15) x(24) tc(2) runtime.ret G0 string
+bug343.go:15: internal compiler error: typecheck INDREG
+*/
diff --git a/gcc/testsuite/go.test/test/fixedbugs/bug357.go b/gcc/testsuite/go.test/test/fixedbugs/bug357.go
new file mode 100644
index 0000000..448d982
--- /dev/null
+++ b/gcc/testsuite/go.test/test/fixedbugs/bug357.go
@@ -0,0 +1,26 @@
+// errchk $G $D/$F.go
+
+// Copyright 2011 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// issue 1993.
+// error used to have last line number in file
+
+package main
+
+func bla1() bool {
+ return false
+}
+
+func bla5() bool {
+ _ = 1
+ false // ERROR "false not used|value computed is not used"
+ _ = 2
+ return false
+}
+
+func main() {
+ x := bla1()
+ _ = x
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/bug358.go b/gcc/testsuite/go.test/test/fixedbugs/bug358.go
new file mode 100644
index 0000000..f43709b
--- /dev/null
+++ b/gcc/testsuite/go.test/test/fixedbugs/bug358.go
@@ -0,0 +1,26 @@
+// errchk $G $D/$F.go
+
+// Copyright 2011 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// issue 1979
+// used to get internal compiler error too
+
+package main
+
+import (
+ "http"
+ "io/ioutil" // GCCGO_ERROR "imported and not used"
+ "os"
+)
+
+func makeHandler(fn func(http.ResponseWriter, *http.Request, string)) http.HandlerFunc {
+ return func(w http.ResponseWriter, r *http.Request) // ERROR "syntax error|invalid use of type"
+}
+
+type Page struct {
+ Title string
+ Body []byte
+}
+
diff --git a/gcc/testsuite/go.test/test/fixedbugs/bug359.go b/gcc/testsuite/go.test/test/fixedbugs/bug359.go
new file mode 100644
index 0000000..3701499
--- /dev/null
+++ b/gcc/testsuite/go.test/test/fixedbugs/bug359.go
@@ -0,0 +1,26 @@
+// errchk $G $D/$F.go
+
+// Copyright 2011 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// issue 1910
+// error on wrong line
+
+package main
+
+import "container/list"
+
+type Painting struct {
+ fragments list.List // private
+}
+
+func (p Painting) Foo() {
+ for e := p.fragments; e.Front() != nil; { // ERROR "unexported field|hidden field"
+ }
+}
+
+// from comment 4 of issue 1910
+type Foo interface {
+ Run(a int) (a int) // ERROR "a redeclared|redefinition|previous"
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/bug361.go b/gcc/testsuite/go.test/test/fixedbugs/bug361.go
new file mode 100644
index 0000000..d2a64bc
--- /dev/null
+++ b/gcc/testsuite/go.test/test/fixedbugs/bug361.go
@@ -0,0 +1,15 @@
+// $G $D/$F.go || echo BUG: bug360
+
+// Copyright 2011 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// issue 1908
+// unreasonable width used to be internal fatal error
+
+package test
+
+func main() {
+ buf := [1<<30]byte{}
+ _ = buf[:]
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/bug362.go b/gcc/testsuite/go.test/test/fixedbugs/bug362.go
new file mode 100644
index 0000000..f38572c
--- /dev/null
+++ b/gcc/testsuite/go.test/test/fixedbugs/bug362.go
@@ -0,0 +1,16 @@
+// errchk $G $D/$F.go
+
+// Copyright 2011 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// issue 1662
+// iota inside var
+
+package main
+
+var (
+ a = iota // ERROR "undefined: iota|iota is only defined in const"
+ b = iota // ERROR "undefined: iota|iota is only defined in const"
+ c = iota // ERROR "undefined: iota|iota is only defined in const"
+)
diff --git a/gcc/testsuite/go.test/test/fixedbugs/bug363.go b/gcc/testsuite/go.test/test/fixedbugs/bug363.go
new file mode 100644
index 0000000..04fcfe1
--- /dev/null
+++ b/gcc/testsuite/go.test/test/fixedbugs/bug363.go
@@ -0,0 +1,21 @@
+// errchk $G $D/$F.go
+
+// Copyright 2011 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// issue 1664
+
+package main
+
+func main() {
+ var i uint = 33
+ var a = (1<<i) + 4.5 // ERROR "shift of type float64|invalid.*shift"
+ println(a)
+
+ var b = (1<<i) + 4.0 // ERROR "shift of type float64|invalid.*shift"
+ println(b)
+
+ var c int64 = (1<<i) + 4.0 // ok - it's all int64
+ println(b)
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/bug364.go b/gcc/testsuite/go.test/test/fixedbugs/bug364.go
new file mode 100644
index 0000000..a174534
--- /dev/null
+++ b/gcc/testsuite/go.test/test/fixedbugs/bug364.go
@@ -0,0 +1,25 @@
+package main
+
+import "fmt"
+
+var s string
+
+func accum(args ...interface{}) {
+ s += fmt.Sprintln(args...)
+}
+
+func f(){
+ v := 0.0
+ for i := 0; i < 3; i++ {
+ v += 0.1
+ defer accum(v)
+ }
+}
+
+func main() {
+ f()
+ if s != "0.30000000000000004\n0.2\n0.1\n" {
+ println("BUG: defer")
+ print(s)
+ }
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/bug365.go b/gcc/testsuite/go.test/test/fixedbugs/bug365.go
new file mode 100644
index 0000000..ce69505
--- /dev/null
+++ b/gcc/testsuite/go.test/test/fixedbugs/bug365.go
@@ -0,0 +1,22 @@
+// errchk $G $D/$F.go
+
+// Copyright 2011 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// check that compiler doesn't stop reading struct def
+// after first unknown type.
+
+// Fixes issue 2110.
+
+package main
+
+type S struct {
+ err os.Error // ERROR "undefined|expected package"
+ Num int
+}
+
+func main() {
+ s := S{}
+ _ = s.Num // no error here please
+}
diff --git a/gcc/testsuite/go.test/test/func6.go b/gcc/testsuite/go.test/test/func6.go
new file mode 100644
index 0000000..1356b6a
--- /dev/null
+++ b/gcc/testsuite/go.test/test/func6.go
@@ -0,0 +1,14 @@
+// $G $D/$F.go
+
+// Copyright 2011 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package main
+
+func main() {
+ if func() bool { return true }() {} // 6g used to say this was a syntax error
+ if (func() bool { return true })() {}
+ if (func() bool { return true }()) {}
+}
+
diff --git a/gcc/testsuite/go.test/test/func7.go b/gcc/testsuite/go.test/test/func7.go
new file mode 100644
index 0000000..e38b008
--- /dev/null
+++ b/gcc/testsuite/go.test/test/func7.go
@@ -0,0 +1,29 @@
+// $G $D/$F.go && $L $F.$A && ./$A.out
+
+// Copyright 2011 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package main
+
+var calledf = false
+
+func f() int {
+ calledf = true
+ return 1
+}
+
+func g() int {
+ if !calledf {
+ println("BUG: func7 - called g before f")
+ }
+ return 0
+}
+
+func main() {
+ // 6g, 8g, 5g all used to evaluate g() before f().
+ if f() < g() {
+ panic("wrong answer")
+ }
+}
+
diff --git a/gcc/testsuite/go.test/test/gc2.go b/gcc/testsuite/go.test/test/gc2.go
new file mode 100644
index 0000000..c54d807
--- /dev/null
+++ b/gcc/testsuite/go.test/test/gc2.go
@@ -0,0 +1,42 @@
+// $G $D/$F.go && $L $F.$A && ./$A.out
+
+// Copyright 2011 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// Check that buffered channels are garbage collected properly.
+// An interesting case because they have finalizers and used to
+// have self loops that kept them from being collected.
+// (Cyclic data with finalizers is never finalized, nor collected.)
+
+package main
+
+import (
+ "fmt"
+ "os"
+ "runtime"
+)
+
+func main() {
+ const N = 10000
+ st := runtime.MemStats
+ for i := 0; i < N; i++ {
+ c := make(chan int, 10)
+ _ = c
+ if i%100 == 0 {
+ for j := 0; j < 4; j++ {
+ runtime.GC()
+ runtime.Gosched()
+ runtime.GC()
+ runtime.Gosched()
+ }
+ }
+ }
+
+ runtime.UpdateMemStats()
+ obj := runtime.MemStats.HeapObjects - st.HeapObjects
+ if obj > N/5 {
+ fmt.Println("too many objects left:", obj)
+ os.Exit(1)
+ }
+}
diff --git a/gcc/testsuite/go.test/test/golden.out b/gcc/testsuite/go.test/test/golden.out
index cc699d4..655ceda 100644
--- a/gcc/testsuite/go.test/test/golden.out
+++ b/gcc/testsuite/go.test/test/golden.out
@@ -21,6 +21,9 @@ panic: runtime error: hash of unhashable type []int
printing: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
42 true false true +1.500000e+000 world 0x0 [0/0]0x0 0x0 0x0 255
+=========== ./goprint.go
+42 true false true +1.500000e+000 world 0x0 [0/0]0x0 0x0 0x0 255
+
=========== ./helloworld.go
hello, world
@@ -157,13 +160,7 @@ panic: interface conversion: interface is int, not int32
panic: interface conversion: interface is main.T, not main.T
-== bugs/
+=========== fixedbugs/bug328.go
+0x0
-=========== bugs/bug322.go
-bugs/bug322.dir/main.go:19: implicit assignment of unexported field 'x' of lib.T in method receiver
-bugs/bug322.dir/main.go:22: implicit assignment of unexported field 'x' of lib.T in assignment
-bugs/bug322.dir/main.go:31: implicit assignment of unexported field 'x' of lib.T in method receiver
-BUG: fails incorrectly
-
-=========== bugs/bug324.go
-BUG: errchk: command succeeded unexpectedly
+== bugs/
diff --git a/gcc/testsuite/go.test/test/goprint.go b/gcc/testsuite/go.test/test/goprint.go
new file mode 100644
index 0000000..c0e34c7
--- /dev/null
+++ b/gcc/testsuite/go.test/test/goprint.go
@@ -0,0 +1,14 @@
+// $G $D/$F.go && $L $F.$A && ./$A.out
+
+// Copyright 2011 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package main
+
+import "time"
+
+func main() {
+ go println(42, true, false, true, 1.5, "world", (chan int)(nil), []int(nil), (map[string]int)(nil), (func())(nil), byte(255))
+ time.Sleep(1e6)
+}
diff --git a/gcc/testsuite/go.test/test/goto.go b/gcc/testsuite/go.test/test/goto.go
new file mode 100644
index 0000000..1fccb31
--- /dev/null
+++ b/gcc/testsuite/go.test/test/goto.go
@@ -0,0 +1,535 @@
+// errchk $G -e $D/$F.go
+
+// Copyright 2011 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// Each test is in a separate function just so that if the
+// compiler stops processing after one error, we don't
+// lose other ones.
+
+package main
+
+var (
+ i, n int
+ x []int
+ c chan int
+ m map[int]int
+ s string
+)
+
+// goto after declaration okay
+func _() {
+ x := 1
+ goto L
+L:
+ _ = x
+}
+
+// goto before declaration okay
+func _() {
+ goto L
+L:
+ x := 1
+ _ = x
+}
+
+// goto across declaration not okay
+func _() {
+ goto L // ERROR "goto L jumps over declaration of x at LINE+1|goto jumps over declaration"
+ x := 1 // GCCGO_ERROR "defined here"
+ _ = x
+L:
+}
+
+// goto across declaration in inner scope okay
+func _() {
+ goto L
+ {
+ x := 1
+ _ = x
+ }
+L:
+}
+
+// goto across declaration after inner scope not okay
+func _() {
+ goto L // ERROR "goto L jumps over declaration of x at LINE+5|goto jumps over declaration"
+ {
+ x := 1
+ _ = x
+ }
+ x := 1 // GCCGO_ERROR "defined here"
+ _ = x
+L:
+}
+
+// goto across declaration in reverse okay
+func _() {
+L:
+ x := 1
+ _ = x
+ goto L
+}
+
+// error shows first offending variable
+func _() {
+ goto L // ERROR "goto L jumps over declaration of x at LINE+1|goto jumps over declaration"
+ x := 1 // GCCGO_ERROR "defined here"
+ _ = x
+ y := 1
+ _ = y
+L:
+}
+
+// goto not okay even if code path is dead
+func _() {
+ goto L // ERROR "goto L jumps over declaration of x at LINE+1|goto jumps over declaration"
+ x := 1 // GCCGO_ERROR "defined here"
+ _ = x
+ y := 1
+ _ = y
+ return
+L:
+}
+
+// goto into outer block okay
+func _() {
+ {
+ goto L
+ }
+L:
+}
+
+// goto backward into outer block okay
+func _() {
+L:
+ {
+ goto L
+ }
+}
+
+// goto into inner block not okay
+func _() {
+ goto L // ERROR "goto L jumps into block starting at LINE+1|goto jumps into block"
+ { // GCCGO_ERROR "block starts here"
+ L:
+ }
+}
+
+// goto backward into inner block still not okay
+func _() {
+ { // GCCGO_ERROR "block starts here"
+ L:
+ }
+ goto L // ERROR "goto L jumps into block starting at LINE-3|goto jumps into block"
+}
+
+// error shows first (outermost) offending block
+func _() {
+ goto L // ERROR "goto L jumps into block starting at LINE+1|goto jumps into block"
+ {
+ {
+ { // GCCGO_ERROR "block starts here"
+ L:
+ }
+ }
+ }
+}
+
+// error prefers block diagnostic over declaration diagnostic
+func _() {
+ goto L // ERROR "goto L jumps into block starting at LINE+3|goto jumps into block"
+ x := 1
+ _ = x
+ { // GCCGO_ERROR "block starts here"
+ L:
+ }
+}
+
+// many kinds of blocks, all invalid to jump into or among,
+// but valid to jump out of
+
+// if
+
+func _() {
+L:
+ if true {
+ goto L
+ }
+}
+
+func _() {
+L:
+ if true {
+ goto L
+ } else {
+ }
+}
+
+func _() {
+L:
+ if false {
+ } else {
+ goto L
+ }
+}
+
+func _() {
+ goto L // ERROR "goto L jumps into block starting at LINE+1|goto jumps into block"
+ if true { // GCCGO_ERROR "block starts here"
+ L:
+ }
+}
+
+func _() {
+ goto L // ERROR "goto L jumps into block starting at LINE+1|goto jumps into block"
+ if true { // GCCGO_ERROR "block starts here"
+ L:
+ } else {
+ }
+}
+
+func _() {
+ goto L // ERROR "goto L jumps into block starting at LINE+1|goto jumps into block"
+ if true {
+ } else { // GCCGO_ERROR "block starts here"
+ L:
+ }
+}
+
+func _() {
+ if false { // GCCGO_ERROR "block starts here"
+ L:
+ } else {
+ goto L // ERROR "goto L jumps into block starting at LINE-3|goto jumps into block"
+ }
+}
+
+func _() {
+ if true {
+ goto L // ERROR "goto L jumps into block starting at LINE+1|goto jumps into block"
+ } else { // GCCGO_ERROR "block starts here"
+ L:
+ }
+}
+
+func _() {
+ if true {
+ goto L // ERROR "goto L jumps into block starting at LINE+1|goto jumps into block"
+ } else if false { // GCCGO_ERROR "block starts here"
+ L:
+ }
+}
+
+func _() {
+ if true {
+ goto L // ERROR "goto L jumps into block starting at LINE+1|goto jumps into block"
+ } else if false { // GCCGO_ERROR "block starts here"
+ L:
+ } else {
+ }
+}
+
+func _() {
+ // This one is tricky. There is an implicit scope
+ // starting at the second if statement, and it contains
+ // the final else, so the outermost offending scope
+ // really is LINE+1 (like in the previous test),
+ // even though it looks like it might be LINE+3 instead.
+ if true {
+ goto L // ERROR "goto L jumps into block starting at LINE+1|goto jumps into block"
+ } else if false {
+ } else { // GCCGO_ERROR "block starts here"
+ L:
+ }
+}
+
+/* Want to enable these tests but gofmt mangles them. Issue 1972.
+
+func _() {
+ // This one is okay, because the else is in the
+ // implicit whole-if block and has no inner block
+ // (no { }) around it.
+ if true {
+ goto L
+ } else
+ L:
+}
+
+func _() {
+ // Still not okay.
+ if true { //// GCCGO_ERROR "block starts here"
+ L:
+ } else
+ goto L //// ERROR "goto L jumps into block starting at LINE-3|goto jumps into block"
+}
+
+*/
+
+// for
+
+func _() {
+ for {
+ goto L
+ }
+L:
+}
+
+func _() {
+ for {
+ goto L
+ L:
+ }
+}
+
+func _() {
+ for { // GCCGO_ERROR "block starts here"
+ L:
+ }
+ goto L // ERROR "goto L jumps into block starting at LINE-3|goto jumps into block"
+}
+
+func _() {
+ for { // GCCGO_ERROR "block starts here"
+ goto L
+ L1:
+ }
+L:
+ goto L1 // ERROR "goto L1 jumps into block starting at LINE-5|goto jumps into block"
+}
+
+func _() {
+ for i < n { // GCCGO_ERROR "block starts here"
+ L:
+ }
+ goto L // ERROR "goto L jumps into block starting at LINE-3|goto jumps into block"
+}
+
+func _() {
+ for i = 0; i < n; i++ { // GCCGO_ERROR "block starts here"
+ L:
+ }
+ goto L // ERROR "goto L jumps into block starting at LINE-3|goto jumps into block"
+}
+
+func _() {
+ for i = range x { // GCCGO_ERROR "block starts here"
+ L:
+ }
+ goto L // ERROR "goto L jumps into block starting at LINE-3|goto jumps into block"
+}
+
+func _() {
+ for i = range c { // GCCGO_ERROR "block starts here"
+ L:
+ }
+ goto L // ERROR "goto L jumps into block starting at LINE-3|goto jumps into block"
+}
+
+func _() {
+ for i = range m { // GCCGO_ERROR "block starts here"
+ L:
+ }
+ goto L // ERROR "goto L jumps into block starting at LINE-3|goto jumps into block"
+}
+
+func _() {
+ for i = range s { // GCCGO_ERROR "block starts here"
+ L:
+ }
+ goto L // ERROR "goto L jumps into block starting at LINE-3|goto jumps into block"
+}
+
+// switch
+
+func _() {
+L:
+ switch i {
+ case 0:
+ goto L
+ }
+}
+
+func _() {
+L:
+ switch i {
+ case 0:
+
+ default:
+ goto L
+ }
+}
+
+func _() {
+ switch i {
+ case 0:
+
+ default:
+ L:
+ goto L
+ }
+}
+
+func _() {
+ switch i {
+ case 0:
+
+ default:
+ goto L
+ L:
+ }
+}
+
+func _() {
+ switch i {
+ case 0:
+ goto L
+ L:
+ ;
+ default:
+ }
+}
+
+func _() {
+ goto L // ERROR "goto L jumps into block starting at LINE+1|goto jumps into block"
+ switch i {
+ case 0:
+ L: // GCCGO_ERROR "block starts here"
+ }
+}
+
+func _() {
+ goto L // ERROR "goto L jumps into block starting at LINE+1|goto jumps into block"
+ switch i {
+ case 0:
+ L: // GCCGO_ERROR "block starts here"
+ ;
+ default:
+ }
+}
+
+func _() {
+ goto L // ERROR "goto L jumps into block starting at LINE+1|goto jumps into block"
+ switch i {
+ case 0:
+ default:
+ L: // GCCGO_ERROR "block starts here"
+ }
+}
+
+func _() {
+ switch i {
+ default:
+ goto L // ERROR "goto L jumps into block starting at LINE+1|goto jumps into block"
+ case 0:
+ L: // GCCGO_ERROR "block starts here"
+ }
+}
+
+func _() {
+ switch i {
+ case 0:
+ L: // GCCGO_ERROR "block starts here"
+ ;
+ default:
+ goto L // ERROR "goto L jumps into block starting at LINE-4|goto jumps into block"
+ }
+}
+
+// select
+// different from switch. the statement has no implicit block around it.
+
+func _() {
+L:
+ select {
+ case <-c:
+ goto L
+ }
+}
+
+func _() {
+L:
+ select {
+ case c <- 1:
+
+ default:
+ goto L
+ }
+}
+
+func _() {
+ select {
+ case <-c:
+
+ default:
+ L:
+ goto L
+ }
+}
+
+func _() {
+ select {
+ case c <- 1:
+
+ default:
+ goto L
+ L:
+ }
+}
+
+func _() {
+ select {
+ case <-c:
+ goto L
+ L:
+ ;
+ default:
+ }
+}
+
+func _() {
+ goto L // ERROR "goto L jumps into block starting at LINE+2|goto jumps into block"
+ select {
+ case c <- 1:
+ L: // GCCGO_ERROR "block starts here"
+ }
+}
+
+func _() {
+ goto L // ERROR "goto L jumps into block starting at LINE+2|goto jumps into block"
+ select {
+ case c <- 1:
+ L: // GCCGO_ERROR "block starts here"
+ ;
+ default:
+ }
+}
+
+func _() {
+ goto L // ERROR "goto L jumps into block starting at LINE+3|goto jumps into block"
+ select {
+ case <-c:
+ default:
+ L: // GCCGO_ERROR "block starts here"
+ }
+}
+
+func _() {
+ select {
+ default:
+ goto L // ERROR "goto L jumps into block starting at LINE+1|goto jumps into block"
+ case <-c:
+ L: // GCCGO_ERROR "block starts here"
+ }
+}
+
+func _() {
+ select {
+ case <-c:
+ L: // GCCGO_ERROR "block starts here"
+ ;
+ default:
+ goto L // ERROR "goto L jumps into block starting at LINE-4|goto jumps into block"
+ }
+}
diff --git a/gcc/testsuite/go.test/test/import1.go b/gcc/testsuite/go.test/test/import1.go
index 8bb2a94..ebd704e 100644
--- a/gcc/testsuite/go.test/test/import1.go
+++ b/gcc/testsuite/go.test/test/import1.go
@@ -9,9 +9,9 @@
package main
import "bufio" // GCCGO_ERROR "previous|not used"
-import bufio "os" // ERROR "redeclared|redefinition|incompatible"
+import bufio "os" // ERROR "redeclared|redefinition|incompatible" "imported and not used"
import (
"fmt" // GCCGO_ERROR "previous|not used"
- fmt "math" // ERROR "redeclared|redefinition|incompatible"
+ fmt "math" // ERROR "redeclared|redefinition|incompatible" "imported and not used"
)
diff --git a/gcc/testsuite/go.test/test/initializerr.go b/gcc/testsuite/go.test/test/initializerr.go
index 37f8a60..e7f8b0e 100644
--- a/gcc/testsuite/go.test/test/initializerr.go
+++ b/gcc/testsuite/go.test/test/initializerr.go
@@ -17,7 +17,7 @@ type T struct {
var x = 1
var a1 = S { 0, X: 1 } // ERROR "mixture|undefined"
var a2 = S { Y: 3, Z: 2, Y: 3 } // ERROR "duplicate"
-var a3 = T { 1, 2, 3, 4, 5, 6 } // ERROR "convert|too many"
+var a3 = T { S{}, 2, 3, 4, 5, 6 } // ERROR "convert|too many"
var a4 = [5]byte{ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 } // ERROR "index|too many"
var a5 = []byte { x: 2 } // ERROR "index"
diff --git a/gcc/testsuite/go.test/test/interface/explicit.go b/gcc/testsuite/go.test/test/interface/explicit.go
index b6a582f..daae59b 100644
--- a/gcc/testsuite/go.test/test/interface/explicit.go
+++ b/gcc/testsuite/go.test/test/interface/explicit.go
@@ -48,7 +48,7 @@ func main() {
i2 = I2(i) // ERROR "invalid|missing N method"
e = E(t) // ok
- t = T(e) // ERROR "need explicit|need type assertion|incompatible"
+ t = T(e) // ERROR "need explicit|need type assertion|incompatible" "as type [*]T"
}
type M interface {
diff --git a/gcc/testsuite/go.test/test/interface/pointer.go b/gcc/testsuite/go.test/test/interface/pointer.go
index e628b55..f1e363c 100644
--- a/gcc/testsuite/go.test/test/interface/pointer.go
+++ b/gcc/testsuite/go.test/test/interface/pointer.go
@@ -33,4 +33,5 @@ func main() {
print("call addinst\n")
var x Inst = AddInst(new(Start)) // ERROR "pointer to interface"
print("return from addinst\n")
+ var y *Inst = new(Start) // ERROR "pointer to interface|incompatible type"
}
diff --git a/gcc/testsuite/go.test/test/interface/private.go b/gcc/testsuite/go.test/test/interface/private.go
new file mode 100644
index 0000000..37890c9
--- /dev/null
+++ b/gcc/testsuite/go.test/test/interface/private.go
@@ -0,0 +1,32 @@
+// $G $D/${F}1.go && errchk $G $D/$F.go
+
+// Copyright 2011 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package main
+
+import "./private1"
+
+type Exported interface {
+ private()
+}
+
+type Implementation struct{}
+
+func (p *Implementation) private() {}
+
+func main() {
+ var x Exported
+ x = new(Implementation)
+ x.private()
+
+ var px p.Exported
+ px = p.X
+
+ px.private() // ERROR "private"
+
+ px = new(Implementation) // ERROR "private"
+
+ x = px // ERROR "private"
+}
diff --git a/gcc/testsuite/go.test/test/interface/private1.go b/gcc/testsuite/go.test/test/interface/private1.go
new file mode 100644
index 0000000..3173fbe
--- /dev/null
+++ b/gcc/testsuite/go.test/test/interface/private1.go
@@ -0,0 +1,18 @@
+// true # used by private.go
+
+// Copyright 2011 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package p
+
+type Exported interface {
+ private()
+}
+
+type Implementation struct{}
+
+func (p *Implementation) private() {}
+
+var X = new(Implementation)
+
diff --git a/gcc/testsuite/go.test/test/malloc1.go b/gcc/testsuite/go.test/test/malloc1.go
index 1469764..61f1797 100644
--- a/gcc/testsuite/go.test/test/malloc1.go
+++ b/gcc/testsuite/go.test/test/malloc1.go
@@ -18,6 +18,7 @@ var chatty = flag.Bool("v", false, "chatty")
func main() {
runtime.Free(runtime.Alloc(1))
+ runtime.UpdateMemStats()
if *chatty {
fmt.Printf("%+v %v\n", runtime.MemStats, uint64(0))
}
diff --git a/gcc/testsuite/go.test/test/mallocrand.go b/gcc/testsuite/go.test/test/mallocrand.go
index e6b422e..f014b44 100644
--- a/gcc/testsuite/go.test/test/mallocrand.go
+++ b/gcc/testsuite/go.test/test/mallocrand.go
@@ -21,6 +21,7 @@ var footprint uint64
var allocated uint64
func bigger() {
+ runtime.UpdateMemStats()
if f := runtime.MemStats.Sys; footprint < f {
footprint = f
if *chatty {
diff --git a/gcc/testsuite/go.test/test/method2.go b/gcc/testsuite/go.test/test/method2.go
index a72536e..039779e 100644
--- a/gcc/testsuite/go.test/test/method2.go
+++ b/gcc/testsuite/go.test/test/method2.go
@@ -12,8 +12,14 @@ type T struct {
type P *T
type P1 *T
-func (p P) val() int { return 1 } // ERROR "receiver"
-func (p *P1) val() int { return 1 } // ERROR "receiver"
+func (p P) val() int { return 1 } // ERROR "receiver.* pointer|invalid pointer or interface receiver"
+func (p *P1) val() int { return 1 } // ERROR "receiver.* pointer|invalid pointer or interface receiver"
+
+type I interface{}
+type I1 interface{}
+
+func (p I) val() int { return 1 } // ERROR "receiver.*interface|invalid pointer or interface receiver"
+func (p *I1) val() int { return 1 } // ERROR "receiver.*interface|invalid pointer or interface receiver"
type Val interface {
val() int
diff --git a/gcc/testsuite/go.test/test/nil.go b/gcc/testsuite/go.test/test/nil.go
index 4f4c755..30cc270 100644
--- a/gcc/testsuite/go.test/test/nil.go
+++ b/gcc/testsuite/go.test/test/nil.go
@@ -6,6 +6,11 @@
package main
+import (
+ "fmt"
+ "time"
+)
+
type T struct {
i int
}
@@ -33,4 +38,141 @@ func main() {
ta[0] = nil
_, _, _, _, _, _, _, _ = i, f, s, m, c, t, in, ta
+
+ arraytest()
+ chantest()
+ maptest()
+ slicetest()
+}
+
+func shouldPanic(f func()) {
+ defer func() {
+ if recover() == nil {
+ panic("not panicking")
+ }
+ }()
+ f()
+}
+
+func shouldBlock(f func()) {
+ go func() {
+ f()
+ panic("did not block")
+ }()
+ time.Sleep(1e7)
+}
+
+// nil array pointer
+
+func arraytest() {
+ var p *[10]int
+
+ // Looping over indices is fine.
+ s := 0
+ for i := range p {
+ s += i
+ }
+ if s != 45 {
+ panic(s)
+ }
+
+ s = 0
+ for i := 0; i < len(p); i++ {
+ s += i
+ }
+ if s != 45 {
+ panic(s)
+ }
+
+ // Looping over values is not.
+ shouldPanic(func() {
+ for i, v := range p {
+ s += i + v
+ }
+ })
+
+ shouldPanic(func() {
+ for i := 0; i < len(p); i++ {
+ s += p[i]
+ }
+ })
+}
+
+// nil channel
+// select tests already handle select on nil channel
+
+func chantest() {
+ var ch chan int
+
+ // nil channel is never ready
+ shouldBlock(func() {
+ ch <- 1
+ })
+ shouldBlock(func() {
+ <-ch
+ })
+ shouldBlock(func() {
+ x, ok := <-ch
+ println(x, ok)
+ })
+
+ if len(ch) != 0 {
+ panic(len(ch))
+ }
+ if cap(ch) != 0 {
+ panic(cap(ch))
+ }
+}
+
+// nil map
+
+func maptest() {
+ var m map[int]int
+
+ // nil map appears empty
+ if len(m) != 0 {
+ panic(len(m))
+ }
+ if m[1] != 0 {
+ panic(m[1])
+ }
+ if x, ok := m[1]; x != 0 || ok {
+ panic(fmt.Sprint(x, ok))
+ }
+
+ for k, v := range m {
+ panic(k)
+ panic(v)
+ }
+
+ // but cannot be written to
+ shouldPanic(func() {
+ m[2] = 3
+ })
+ shouldPanic(func() {
+ m[2] = 0, false
+ })
+}
+
+// nil slice
+
+func slicetest() {
+ var x []int
+
+ // nil slice is just a 0-element slice.
+ if len(x) != 0 {
+ panic(len(x))
+ }
+ if cap(x) != 0 {
+ panic(cap(x))
+ }
+
+ // no 0-element slices can be read from or written to
+ var s int
+ shouldPanic(func() {
+ s += x[1]
+ })
+ shouldPanic(func() {
+ x[2] = s
+ })
}
diff --git a/gcc/testsuite/go.test/test/nul1.go b/gcc/testsuite/go.test/test/nul1.go
index 9cf5112..142d4de 100644
--- a/gcc/testsuite/go.test/test/nul1.go
+++ b/gcc/testsuite/go.test/test/nul1.go
@@ -39,7 +39,7 @@ var y = ` + "`in raw string \x00 foo`" + ` // ERROR "NUL"
/* in other comment ` + "\x00" + ` */ // ERROR "NUL"
-/* in source code */ ` + "\x00" + `// ERROR "NUL"
+/* in source code */ ` + "\x00" + `// ERROR "NUL" "illegal character"
var xx = "in string ` + "\xc2\xff" + `" // ERROR "UTF-8"
@@ -50,9 +50,9 @@ var yy = ` + "`in raw string \xff foo`" + ` // ERROR "UTF-8"
/* in other comment ` + "\xe0\x00\x00" + ` */ // ERROR "UTF-8|NUL"
/* in variable name */
-var z` + "\xc1\x81" + ` int // ERROR "UTF-8"
+var z` + "\xc1\x81" + ` int // ERROR "UTF-8" "invalid identifier character"
-/* in source code */ ` + "\xc2A" + `// ERROR "UTF-8"
+/* in source code */ ` + "var \xc2A int" + `// ERROR "UTF-8" "invalid identifier character"
`)
}
diff --git a/gcc/testsuite/go.test/test/rename1.go b/gcc/testsuite/go.test/test/rename1.go
index f239999..3e78bfc 100644
--- a/gcc/testsuite/go.test/test/rename1.go
+++ b/gcc/testsuite/go.test/test/rename1.go
@@ -10,7 +10,7 @@ func main() {
var n byte // ERROR "not a type|expected type"
var y = float(0) // ERROR "cannot call|expected function"
const (
- a = 1 + iota // ERROR "string|incompatible types"
+ a = 1 + iota // ERROR "string|incompatible types" "convert iota"
)
}
diff --git a/gcc/testsuite/go.test/test/run b/gcc/testsuite/go.test/test/run
index 28d0caa..bc31d2f7 100755
--- a/gcc/testsuite/go.test/test/run
+++ b/gcc/testsuite/go.test/test/run
@@ -5,6 +5,8 @@
eval $(gomake --no-print-directory -f ../src/Make.inc go-env)
+export E=
+
case X"$GOARCH" in
Xamd64)
export A=6
@@ -21,11 +23,6 @@ Xarm)
exit 1
esac
-case X"$GOOS" in
-Xnacl)
- export E=${GORUN:-$GOROOT/misc/nacl/naclrun}
-esac
-
export G=${A}g
export L=${A}l
export GOTRACEBACK=0
@@ -36,9 +33,9 @@ failed=0
PATH=/bin:/usr/bin:/usr/local/bin:${GOBIN:-$GOROOT/bin}:`pwd`
-RUNFILE=/tmp/gorun-$$-$USER
-TMP1FILE=/tmp/gotest1-$$-$USER
-TMP2FILE=/tmp/gotest2-$$-$USER
+RUNFILE="/tmp/gorun-$$-$USER"
+TMP1FILE="/tmp/gotest1-$$-$USER"
+TMP2FILE="/tmp/gotest2-$$-$USER"
# don't run the machine out of memory: limit individual processes to 4GB.
# on thresher, 3GB suffices to run the tests; with 2GB, peano fails.
@@ -67,20 +64,20 @@ do
fi
export F=$(basename $i .go)
export D=$dir
- sed '/^\/\//!q' $i | sed 's@//@@; $d' |sed 's|./\$A.out|$E &|g' >$RUNFILE
- if ! { time -p bash -c "bash $RUNFILE >$TMP1FILE 2>&1" ; } 2>$TMP2FILE
+ sed '/^\/\//!q' $i | sed 's@//@@; $d' |sed 's|./\$A.out|$E &|g' >"$RUNFILE"
+ if ! { time -p bash -c "bash '$RUNFILE' >'$TMP1FILE' 2>&1" ; } 2>"$TMP2FILE"
then
echo
echo "===========" $i
- cat $TMP1FILE
+ cat "$TMP1FILE"
echo >&2 fail: $i
echo "# $i # fail" >>pass.out
- elif test -s $TMP1FILE
+ elif test -s "$TMP1FILE"
then
echo
echo "===========" $i
- cat $TMP1FILE
- if grep -q '^BUG' $TMP1FILE
+ cat "$TMP1FILE"
+ if grep -q '^BUG' "$TMP1FILE"
then
if [ $dir != bugs ]
then
@@ -96,12 +93,13 @@ do
else
echo $i >>pass.out
fi
- echo $(awk 'NR==1{print $2}' $TMP2FILE) $D/$F >>times.out
+ echo $(awk 'NR==1{print $2}' "$TMP2FILE") $D/$F >>times.out
+ rm -f $F.$A $A.out
) done
done | # clean up some stack noise
egrep -v '^(r[0-9a-z]+|[cfg]s) +0x' |
sed '/tmp.*Bus error/s/.*Bus/Bus/; /tmp.*Trace.BPT/s/.*Trace/Trace/
- s!'$RUNFILE'!$RUNFILE!g
+ s!'"$RUNFILE"'!$RUNFILE!g
s/^PC=0x[0-9a-f]*/pc: xxx/
s/^pc: 0x[0-9a-f]*/pc: xxx/
s/PC=0x[0-9a-f]*/PC=xxx/
@@ -109,11 +107,10 @@ done | # clean up some stack noise
/^Trace\/BPT trap/d
/RUNFILE/ s/line 1: *[0-9]*/line 1: PID/
/^\$RUNFILE: line 1: PID Trace\/breakpoint trap/d
- /Fault in NaCl untrusted code/d
/Segmentation fault/d
/^qemu: uncaught target signal 11 (Segmentation fault) - exiting/d' > run.out
-rm -f $RUNFILE $TMP1FILE $TMP2FILE *.$A *.a $A.out
+rm -f "$RUNFILE" "$TMP1FILE" "$TMP2FILE" *.$A *.a $A.out
diffmsg=""
if ! diff $golden run.out
then
diff --git a/gcc/testsuite/go.test/test/shift1.go b/gcc/testsuite/go.test/test/shift1.go
new file mode 100644
index 0000000..c197eef
--- /dev/null
+++ b/gcc/testsuite/go.test/test/shift1.go
@@ -0,0 +1,36 @@
+// errchk $G -e $D/$F.go
+
+// Copyright 2011 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// Issue 1708, illegal cases.
+
+package p
+
+func f(x int) int { return 0 }
+func g(x interface{}) int { return 0 }
+func h(x float64) int { return 0 }
+
+// from the spec
+var (
+ s uint = 33
+ u = 1.0 << s // ERROR "invalid operation|shift of non-integer operand"
+ v float32 = 1 << s // ERROR "invalid" "as type float32"
+)
+
+// non-constant shift expressions
+var (
+ e1 = g(2.0 << s) // ERROR "invalid" "as type interface"
+ f1 = h(2 << s) // ERROR "invalid" "as type float64"
+ g1 int64 = 1.1 << s // ERROR "truncated"
+)
+
+// constant shift expressions
+const c uint = 65
+
+var (
+ a2 int = 1.0 << c // ERROR "overflow"
+ b2 = 1.0 << c // ERROR "overflow"
+ d2 = f(1.0 << c) // ERROR "overflow"
+)
diff --git a/gcc/testsuite/go.test/test/shift2.go b/gcc/testsuite/go.test/test/shift2.go
new file mode 100644
index 0000000..ec4c7ad
--- /dev/null
+++ b/gcc/testsuite/go.test/test/shift2.go
@@ -0,0 +1,42 @@
+// $G $D/$F.go || echo BUG: shift2
+
+// Copyright 2011 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// Issue 1708, legal cases.
+
+package p
+
+func f(x int) int { return 0 }
+func g(x interface{}) int { return 0 }
+func h(x float64) int { return 0 }
+
+// from the spec
+var (
+ s uint = 33
+ i = 1 << s // 1 has type int
+ j int32 = 1 << s // 1 has type int32; j == 0
+ k = uint64(1 << s) // 1 has type uint64; k == 1<<33
+ m int = 1.0 << s // legal: 1.0 has type int
+ w int64 = 1.0 << 33 // legal: 1.0<<33 is a constant shift expression
+)
+
+// non-constant shift expressions
+var (
+ a1 int = 2.0 << s // typeof(2.0) is int in this context => legal shift
+ d1 = f(2.0 << s) // typeof(2.0) is int in this context => legal shift
+)
+
+// constant shift expressions
+const c uint = 5
+
+var (
+ a2 int = 2.0 << c // a2 == 64 (type int)
+ b2 = 2.0 << c // b2 == 64 (untyped integer)
+ _ = f(b2) // verify b2 has type int
+ c2 float64 = 2 << c // c2 == 64.0 (type float64)
+ d2 = f(2.0 << c) // == f(64)
+ e2 = g(2.0 << c) // == g(int(64))
+ f2 = h(2 << c) // == h(float64(64.0))
+)
diff --git a/gcc/testsuite/go.test/test/sizeof.go b/gcc/testsuite/go.test/test/sizeof.go
new file mode 100644
index 0000000..544e4c5
--- /dev/null
+++ b/gcc/testsuite/go.test/test/sizeof.go
@@ -0,0 +1,23 @@
+// $G $D/$F.go
+
+// Copyright 2011 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package main
+
+import "unsafe"
+
+type T struct {
+ X int
+}
+
+var t T
+
+func isUintptr(uintptr) {}
+
+func main() {
+ isUintptr(unsafe.Sizeof(t))
+ isUintptr(unsafe.Alignof(t))
+ isUintptr(unsafe.Offsetof(t.X))
+}