test: add new Go tests from source repo
authorIan Lance Taylor <iant@golang.org>
Thu, 17 Dec 2020 03:43:20 +0000 (19:43 -0800)
committerIan Lance Taylor <iant@golang.org>
Thu, 17 Dec 2020 03:43:20 +0000 (19:43 -0800)
505 files changed:
gcc/testsuite/go.test/test/fixedbugs/gcc61204.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/gcc61244.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/gcc61246.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/gcc61248.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/gcc61253.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/gcc61254.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/gcc61255.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/gcc61258.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/gcc61264.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/gcc61265.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/gcc61273.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/gcc65755.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue20029.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue20097.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue20145.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue20185.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue20227.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue20333.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue20335.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue20415.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue20529.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue20530.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue20602.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue20682.dir/p.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue20682.dir/q.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue20682.dir/r.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue20682.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue20739.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue20749.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue20780.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue20811.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue20812.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue20813.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue21048.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue21120.dir/a.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue21120.dir/b.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue21120.dir/main.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue21120.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue21221.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue21256.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue21273.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue21317.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue21576.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue21655.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue21770.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue21808.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue21808.out [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue21879.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue21879.out [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue21882.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue21887.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue21887.out [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue21963.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue21979.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue21988.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue22063.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue22076.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue22083.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue22198.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue22200.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue22200b.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue22326.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue22326.out [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue22327.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue22429.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue22458.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue22605.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue22660.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue22683.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue22683.out [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue22781.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue22794.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue22822.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue22881.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue22904.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue22921.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue22941.dir/a.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue22941.dir/b.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue22941.dir/main.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue22941.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue22962.dir/a.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue22962.dir/b.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue22962.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue23093.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue23116.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue23179.dir/a.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue23179.dir/b.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue23179.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue23298.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue23305.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue23311.dir/main.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue23311.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue23414.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue23504.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue23521.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue23522.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue23545.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue23546.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue23586.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue23719.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue23732.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue23734.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue23780.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue23781.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue23812.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue23823.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue24120.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue24173.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue24187.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue24419.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue24449.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue24470.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue24488.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue24503.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue24547.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue24760.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue24763.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue24799.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue24801.dir/a.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue24801.dir/main.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue24801.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue24817.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue24937.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue24939.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue25006.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue25101.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue25322.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue25322.out [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue25507.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue25516.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue25727.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue25741.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue25776.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue25897a.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue25897b.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue25958.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue25984.dir/p.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue25984.dir/q.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue25984.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue26024.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue26043.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue26097.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue26105.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue26116.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue26120.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue26153.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue26248.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue26341.dir/a.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue26341.dir/b.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue26341.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue26407.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue26411.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue26416.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue26438.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue26495.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue26616.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue26855.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue27143.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue27232.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue27267.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue27278.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue27289.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue27356.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue27695.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue27695b.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue27695c.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue27718.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue27829.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue27938.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue27961.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue28055.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue28058.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue28078.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue28079a.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue28079b.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue28079c.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue28268.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue28390.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue28390.out [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue28430.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue28445.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue28450.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue28616.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue28688.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue28797.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue29013a.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue29013b.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue29190.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue29215.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue29218.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue29220.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue29264.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue29304.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue29312.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue29329.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue29350.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue29362.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue29362b.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue29389.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue29402.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue29562.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue29610.dir/a.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue29610.dir/b.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue29610.dir/main.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue29610.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue29735.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue29855.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue29870.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue29870b.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue29943.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue30041.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue30061.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue30085.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue30087.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue30243.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue30430.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue30476.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue30566a.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue30566b.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue30606.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue30606b.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue30679.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue30709.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue30709.out [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue30862.dir/a.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue30862.dir/b.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue30862.dir/main.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue30862.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue30898.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue30907.dir/a.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue30907.dir/b.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue30907.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue30956.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue30956.out [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue30977.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue31010.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue31060.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue31252.dir/a.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue31252.dir/b.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue31252.dir/c.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue31252.dir/main.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue31252.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue31412a.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue31412b.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue31419.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue31573.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue31637.dir/a.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue31637.dir/b.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue31637.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue31777.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue31782.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue31782.out [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue31987.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue32175.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue32175.out [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue32288.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue32347.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue32454.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue32560.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue32595.dir/a.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue32595.dir/b.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue32595.dir/main.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue32595.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue32680.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue32680.out [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue32680b.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue32723.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue32778.dir/a.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue32778.dir/b.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue32778.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue32959.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue33020a.dir/a.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue33020a.dir/b.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue33020a.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue33275.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue33275_run.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue33308.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue33355.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue33386.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue33438.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue33460.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue33555.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue33724.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue33866.dir/a.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue33866.dir/b.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue33866.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue33903.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue34123.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue34395.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue34520.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue34968.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue35027.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue35073.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue35157.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue35291.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue35576.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue35576.out [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue35586.dir/a.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue35586.dir/b.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue35586.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue35652.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue36085.dir/a.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue36085.dir/b.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue36085.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue36259.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue36437.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue36516.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue36705.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue37246.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue37716.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue37753.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue37975.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue38093.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue38117.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue38356.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue38359.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue38690.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue38745.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue38746.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue38905.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue38916.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue39292.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue39459.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue39505.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue39505b.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue39541.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue39651.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue40367.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue40629.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue40746.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue40917.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue40954.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue41247.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue41440.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue41500.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue41575.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue41680.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue41736.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue41780.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue41872.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue42032.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue42058a.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue42058b.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue42075.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue42076.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue4215.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue42568.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue42587.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue42703.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue42727.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue42784.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue42876.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue43099.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue43111.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue43112.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue4365.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue5373.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue5793.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue6295.dir/p0.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue6295.dir/p1.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue6295.dir/p2.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue6295.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue6402.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue6403.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue6406.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue6703a.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue6703b.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue6703c.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue6703d.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue6703e.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue6703f.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue6703g.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue6703h.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue6703i.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue6703j.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue6703k.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue6703l.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue6703m.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue6703n.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue6703o.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue6703p.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue6703q.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue6703r.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue6703s.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue6703t.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue6703u.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue6703v.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue6703w.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue6703x.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue6703y.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue6703z.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue6772.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue6847.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue6866.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue6889.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue6902.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue6964.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue7023.dir/a.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue7023.dir/b.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue7023.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue7044.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue7050.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue7083.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue7129.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue7150.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue7153.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue7223.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue7272.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue7310.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue7316.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue7346.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue7366.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue7405.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue7419.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue7538a.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue7538b.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue7547.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue7550.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue7590.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue7648.dir/a.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue7648.dir/b.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue7648.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue7740.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue7742.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue7746.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue7760.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue7794.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue7863.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue7867.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue7884.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue7921.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue7944.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue7995.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue7995b.dir/x1.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue7995b.dir/x2.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue7995b.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue7996.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue7997.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue7998.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue8004.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue8011.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue8017.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue8028.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue8036.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue8039.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue8047.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue8047b.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue8048.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue8060.dir/a.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue8060.dir/b.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue8060.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue8073.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue8074.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue8076.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue8079.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue8132.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue8139.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue8154.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue8155.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue8158.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue8183.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue8280.dir/a.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue8280.dir/b.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue8280.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue8311.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue8325.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue8336.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue8347.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue8385.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue8438.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue8440.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue8475.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue8501.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue8613.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue8620.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue8745.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue8761.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue8836.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue8947.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue8961.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue9006.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue9017.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue9036.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue9076.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue9083.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue9110.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue9321.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue9355.dir/a.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue9355.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue9370.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue9432.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue9521.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue9537.dir/a.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue9537.dir/b.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue9537.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue9604.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue9604b.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue9608.dir/issue9608.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue9608.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue9634.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue9691.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue9731.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue9738.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue9862.go [new file with mode: 0644]
gcc/testsuite/go.test/test/fixedbugs/issue9862_run.go [new file with mode: 0644]

diff --git a/gcc/testsuite/go.test/test/fixedbugs/gcc61204.go b/gcc/testsuite/go.test/test/fixedbugs/gcc61204.go
new file mode 100644 (file)
index 0000000..e175f83
--- /dev/null
@@ -0,0 +1,17 @@
+// compile
+
+// Copyright 2014 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.
+
+// PR61204: Making temporaries for zero-sized types caused an ICE in gccgo.
+// This is a reduction of a program reported by GoSmith.
+
+package main
+
+func main() {
+       type t [0]int
+       var v t
+       v, _ = [0]int{}, 0
+       _ = v
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/gcc61244.go b/gcc/testsuite/go.test/test/fixedbugs/gcc61244.go
new file mode 100644 (file)
index 0000000..642bc61
--- /dev/null
@@ -0,0 +1,19 @@
+// compile
+
+// Copyright 2014 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.
+
+// PR61244: Type descriptors expressions were not traversed, causing an ICE
+// in gccgo when producing the backend representation.
+// This is a reduction of a program reported by GoSmith.
+
+package main
+
+const a = 0
+
+func main() {
+       switch i := (interface{})(a); i.(type) {
+       case [0]string:
+       }
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/gcc61246.go b/gcc/testsuite/go.test/test/fixedbugs/gcc61246.go
new file mode 100644 (file)
index 0000000..797d6c7
--- /dev/null
@@ -0,0 +1,17 @@
+// compile
+
+// Copyright 2014 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.
+
+// PR61246: Switch conditions could be untyped, causing an ICE when the
+// conditions were lowered into temporaries.
+// This is a reduction of a program reported by GoSmith.
+
+package main
+
+func main() {
+       switch 1 != 1 {
+       default:
+       }
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/gcc61248.go b/gcc/testsuite/go.test/test/fixedbugs/gcc61248.go
new file mode 100644 (file)
index 0000000..cb59c9f
--- /dev/null
@@ -0,0 +1,14 @@
+// compile
+
+// Copyright 2014 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.
+
+// PR61248: Transformations to recover calls made them fail typechecking in gccgo.
+
+package main
+
+func main() {
+       var f func(int, interface{})
+       go f(0, recover())
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/gcc61253.go b/gcc/testsuite/go.test/test/fixedbugs/gcc61253.go
new file mode 100644 (file)
index 0000000..696b26e
--- /dev/null
@@ -0,0 +1,20 @@
+// compile
+
+// Copyright 2014 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.
+
+// PR61253: gccgo incorrectly parsed the
+// `RecvStmt = ExpressionList "=" RecvExpr` production.
+
+package main
+
+func main() {
+       c := make(chan int)
+       v := new(int)
+       b := new(bool)
+       select {
+       case (*v), (*b) = <-c:
+       }
+
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/gcc61254.go b/gcc/testsuite/go.test/test/fixedbugs/gcc61254.go
new file mode 100644 (file)
index 0000000..82e666e
--- /dev/null
@@ -0,0 +1,13 @@
+// compile
+
+// Copyright 2014 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.
+
+// PR61254: gccgo failed to compile a slice expression with missing indices.
+
+package main
+
+func main() {
+       [][]int{}[:][0][0]++
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/gcc61255.go b/gcc/testsuite/go.test/test/fixedbugs/gcc61255.go
new file mode 100644 (file)
index 0000000..288fb54
--- /dev/null
@@ -0,0 +1,13 @@
+// compile
+
+// Copyright 2014 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.
+
+// PR61255: gccgo failed to compile IncDec statements on variadic functions.
+
+package main
+
+func main() {
+       append([]byte{}, 0)[0]++
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/gcc61258.go b/gcc/testsuite/go.test/test/fixedbugs/gcc61258.go
new file mode 100644 (file)
index 0000000..e4dcb33
--- /dev/null
@@ -0,0 +1,13 @@
+// run
+
+// Copyright 2014 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.
+
+// PR61258: gccgo crashed when deleting a zero-sized key from a map.
+
+package main
+
+func main() {
+       delete(make(map[[0]bool]int), [0]bool{})
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/gcc61264.go b/gcc/testsuite/go.test/test/fixedbugs/gcc61264.go
new file mode 100644 (file)
index 0000000..a4092f5
--- /dev/null
@@ -0,0 +1,13 @@
+// compile
+
+// Copyright 2014 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.
+
+// PR61264: IncDec statements involving composite literals caused in ICE in gccgo.
+
+package main
+
+func main() {
+        map[int]int{}[0]++
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/gcc61265.go b/gcc/testsuite/go.test/test/fixedbugs/gcc61265.go
new file mode 100644 (file)
index 0000000..be79233
--- /dev/null
@@ -0,0 +1,16 @@
+// compile
+
+// Copyright 2014 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.
+
+// PR61265: The gccgo middle-end failed to represent array composite literals
+// where the elements are zero-sized values.
+// This is a reduction of a program reported by GoSmith.
+
+package p
+
+var a = [1][0]int{B}[0]
+var B = [0]int{}
+var c = [1]struct{}{D}[0]
+var D = struct{}{}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/gcc61273.go b/gcc/testsuite/go.test/test/fixedbugs/gcc61273.go
new file mode 100644 (file)
index 0000000..ed78b1e
--- /dev/null
@@ -0,0 +1,16 @@
+// compile
+
+// Copyright 2014 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.
+
+// PR61273: gccgo failed to compile a SendStmt in the PostStmt of a ForClause
+// that involved predefined constants.
+
+package main
+
+func main() {
+       c := make(chan bool, 1)
+       for ; false; c <- false {
+       }
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/gcc65755.go b/gcc/testsuite/go.test/test/fixedbugs/gcc65755.go
new file mode 100644 (file)
index 0000000..1e5d116
--- /dev/null
@@ -0,0 +1,37 @@
+// run
+
+// Copyright 2015 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.
+
+// PR65755: Incorrect type descriptor for type defined within method.
+
+package main
+
+import "reflect"
+
+type S1 struct{}
+
+func (S1) Fix() string {
+       type s struct {
+               f int
+       }
+       return reflect.TypeOf(s{}).Field(0).Name
+}
+
+type S2 struct{}
+
+func (S2) Fix() string {
+       type s struct {
+               g bool
+       }
+       return reflect.TypeOf(s{}).Field(0).Name
+}
+
+func main() {
+       f1 := S1{}.Fix()
+       f2 := S2{}.Fix()
+       if f1 != "f" || f2 != "g" {
+               panic(f1 + f2)
+       }
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue20029.go b/gcc/testsuite/go.test/test/fixedbugs/issue20029.go
new file mode 100644 (file)
index 0000000..db3f8aa
--- /dev/null
@@ -0,0 +1,32 @@
+// run
+
+// Copyright 2017 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 20029: make sure we zero at VARKILLs of
+// ambiguously live variables.
+// The ambiguously live variable here is the hiter
+// for the inner range loop.
+
+package main
+
+import "runtime"
+
+func f(m map[int]int) {
+outer:
+       for i := 0; i < 10; i++ {
+               for k := range m {
+                       if k == 5 {
+                               continue outer
+                       }
+               }
+               runtime.GC()
+               break
+       }
+       runtime.GC()
+}
+func main() {
+       m := map[int]int{1: 2, 2: 3, 3: 4}
+       f(m)
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue20097.go b/gcc/testsuite/go.test/test/fixedbugs/issue20097.go
new file mode 100644 (file)
index 0000000..236a1bd
--- /dev/null
@@ -0,0 +1,18 @@
+// compile
+
+// Copyright 2017 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 20097: ensure that we CSE multiple Select ops with
+// the same underlying type
+
+package main
+
+type T int64
+
+func f(x, y int64) (int64, T) {
+       a := x / y
+       b := T(x) / T(y)
+       return a, b
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue20145.go b/gcc/testsuite/go.test/test/fixedbugs/issue20145.go
new file mode 100644 (file)
index 0000000..67ba5ae
--- /dev/null
@@ -0,0 +1,14 @@
+// compile
+
+// Copyright 2017 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 20145: some func types weren't dowidth-ed by the front end,
+// leading to races in the backend.
+
+package p
+
+func f() {
+       _ = (func())(nil)
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue20185.go b/gcc/testsuite/go.test/test/fixedbugs/issue20185.go
new file mode 100644 (file)
index 0000000..9065868
--- /dev/null
@@ -0,0 +1,25 @@
+// errorcheck
+
+// Copyright 2017 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 20185: type switching on untyped values (e.g. nil or consts)
+// caused an internal compiler error.
+
+package p
+
+func F() {
+       switch t := nil.(type) { // ERROR "cannot type switch on non-interface value"
+       default:
+               _ = t
+       }
+}
+
+const x = 1
+
+func G() {
+       switch t := x.(type) { // ERROR "cannot type switch on non-interface value|declared but not used"
+       default:
+       }
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue20227.go b/gcc/testsuite/go.test/test/fixedbugs/issue20227.go
new file mode 100644 (file)
index 0000000..f599231
--- /dev/null
@@ -0,0 +1,16 @@
+// errorcheck
+
+// Copyright 2017 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 20227: panic while constructing constant "1i/1e-600000000"
+
+package p
+
+var _ = 1 / 1e-600000000i  // ERROR "division by zero"
+var _ = 1i / 1e-600000000  // ERROR "division by zero"
+var _ = 1i / 1e-600000000i // ERROR "division by zero"
+
+var _ = 1 / (1e-600000000 + 1e-600000000i)  // ERROR "division by zero"
+var _ = 1i / (1e-600000000 + 1e-600000000i) // ERROR "division by zero"
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue20333.go b/gcc/testsuite/go.test/test/fixedbugs/issue20333.go
new file mode 100644 (file)
index 0000000..8202ab3
--- /dev/null
@@ -0,0 +1,15 @@
+// compile
+
+// Copyright 2017 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 20333: early checkwidth of [...] arrays led to compilation errors.
+
+package main
+
+import "fmt"
+
+func main() {
+       fmt.Println(&[...]string{"abc", "def", "ghi"})
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue20335.go b/gcc/testsuite/go.test/test/fixedbugs/issue20335.go
new file mode 100644 (file)
index 0000000..185c2f0
--- /dev/null
@@ -0,0 +1,19 @@
+// compile
+
+// Copyright 2017 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 20335: don't reorder loads with stores.
+// This test should fail on the ssacheck builder
+// without the fix in the CL that added this file.
+// TODO: check the generated assembly?
+
+package a
+
+import "sync/atomic"
+
+func f(p, q *int32) bool {
+       x := *q
+       return atomic.AddInt32(p, 1) == x
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue20415.go b/gcc/testsuite/go.test/test/fixedbugs/issue20415.go
new file mode 100644 (file)
index 0000000..9e7649f
--- /dev/null
@@ -0,0 +1,33 @@
+// errorcheck
+
+// Copyright 2017 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.
+
+// Make sure redeclaration errors report correct position.
+
+package p
+
+// 1
+var f byte
+
+var f interface{} // ERROR "previous declaration at issue20415.go:12|redefinition"
+
+func _(f int) {
+}
+
+// 2
+var g byte
+
+func _(g int) {
+}
+
+var g interface{} // ERROR "previous declaration at issue20415.go:20|redefinition"
+
+// 3
+func _(h int) {
+}
+
+var h byte
+
+var h interface{} // ERROR "previous declaration at issue20415.go:31|redefinition"
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue20529.go b/gcc/testsuite/go.test/test/fixedbugs/issue20529.go
new file mode 100644 (file)
index 0000000..eeaaf37
--- /dev/null
@@ -0,0 +1,21 @@
+// errorcheck
+
+// +build amd64
+
+// Copyright 2017 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 20529: Large stack frames caused compiler panics.
+// Only tested on amd64 because the test only makes sense
+// on a 64 bit system, and it is platform-agnostic,
+// so testing one suffices.
+
+package p
+
+import "runtime"
+
+func f() { // GC_ERROR "stack frame too large"
+       x := [][]int{1e9: []int{}}
+       runtime.KeepAlive(x)
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue20530.go b/gcc/testsuite/go.test/test/fixedbugs/issue20530.go
new file mode 100644 (file)
index 0000000..51f0bd8
--- /dev/null
@@ -0,0 +1,34 @@
+// run
+
+// Copyright 2017 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 a uint8
+
+//go:noinline
+func f() {
+       b := int8(func() int32 { return -1 }())
+       a = uint8(b)
+       if int32(a) != 255 {
+               // Failing case prints 'got 255 expected 255'
+               println("got", a, "expected 255")
+       }
+}
+
+//go:noinline
+func g() {
+       b := int8(func() uint32 { return 0xffffffff }())
+       a = uint8(b)
+       if int32(a) != 255 {
+               // Failing case prints 'got 255 expected 255'
+               println("got", a, "expected 255")
+       }
+}
+
+func main() {
+       f()
+       g()
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue20602.go b/gcc/testsuite/go.test/test/fixedbugs/issue20602.go
new file mode 100644 (file)
index 0000000..d4d513b
--- /dev/null
@@ -0,0 +1,14 @@
+// errorcheck
+
+// Copyright 2017 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.
+
+// Verify that the correct (not implicitly dereferenced)
+// type is reported in the error message.
+
+package p
+
+var p = &[1]complex128{0}
+var _ = real(p)  // ERROR "type \*\[1\]complex128|argument must have complex type"
+var _ = imag(p)         // ERROR "type \*\[1\]complex128|argument must have complex type"
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue20682.dir/p.go b/gcc/testsuite/go.test/test/fixedbugs/issue20682.dir/p.go
new file mode 100644 (file)
index 0000000..fc37136
--- /dev/null
@@ -0,0 +1,13 @@
+// Copyright 2017 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
+
+import "strings"
+
+type T struct{}
+
+func (T) M() {
+       strings.HasPrefix("", "")
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue20682.dir/q.go b/gcc/testsuite/go.test/test/fixedbugs/issue20682.dir/q.go
new file mode 100644 (file)
index 0000000..9554569
--- /dev/null
@@ -0,0 +1,13 @@
+// Copyright 2017 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 q
+
+import "./p"
+
+type T struct{}
+
+func (T) M() interface{} {
+       return &p.T{}
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue20682.dir/r.go b/gcc/testsuite/go.test/test/fixedbugs/issue20682.dir/r.go
new file mode 100644 (file)
index 0000000..73dfe1b
--- /dev/null
@@ -0,0 +1,11 @@
+// Copyright 2017 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 r
+
+import "./q"
+
+type T struct {
+       q.T
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue20682.go b/gcc/testsuite/go.test/test/fixedbugs/issue20682.go
new file mode 100644 (file)
index 0000000..8000a52
--- /dev/null
@@ -0,0 +1,7 @@
+// compiledir
+
+// Copyright 2017 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/issue20739.go b/gcc/testsuite/go.test/test/fixedbugs/issue20739.go
new file mode 100644 (file)
index 0000000..b71a25d
--- /dev/null
@@ -0,0 +1,16 @@
+// compile
+
+// Copyright 2017 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
+
+func F() {
+       var x struct {
+               x *int
+               w [1e9][1e9][1e9][0]*int
+               y *int
+       }
+       println(&x)
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue20749.go b/gcc/testsuite/go.test/test/fixedbugs/issue20749.go
new file mode 100644 (file)
index 0000000..de2d3ad
--- /dev/null
@@ -0,0 +1,15 @@
+// errorcheck
+
+// Copyright 2017 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
+
+// Verify that the compiler complains even if the array
+// has length 0.
+var a [0]int
+var _ = a[2:] // ERROR "invalid slice index 2|array index out of bounds"
+
+var b [1]int
+var _ = b[2:] // ERROR "invalid slice index 2|array index out of bounds"
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue20780.go b/gcc/testsuite/go.test/test/fixedbugs/issue20780.go
new file mode 100644 (file)
index 0000000..53c4f61
--- /dev/null
@@ -0,0 +1,19 @@
+// errorcheck
+
+// Copyright 2018 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.
+
+// We have a limit of 1GB for stack frames.
+// Make sure we include the callee args section.
+
+package main
+
+func f() { // GC_ERROR "stack frame too large"
+       var x [800e6]byte
+       g(x)
+       return
+}
+
+//go:noinline
+func g([800e6]byte) {}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue20811.go b/gcc/testsuite/go.test/test/fixedbugs/issue20811.go
new file mode 100644 (file)
index 0000000..96b61ec
--- /dev/null
@@ -0,0 +1,23 @@
+// run
+
+// Copyright 2017 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 20811: slice-in-bound check is lowered incorrectly on
+// amd64p32.
+
+package main
+
+func main() {
+       i := g()
+       _ = "x"[int32(i)]
+       j := g()
+       _ = "x"[:int32(j)]
+}
+
+//go:noinline
+func g() int64 {
+       return 4398046511104
+}
+
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue20812.go b/gcc/testsuite/go.test/test/fixedbugs/issue20812.go
new file mode 100644 (file)
index 0000000..d0df831
--- /dev/null
@@ -0,0 +1,15 @@
+// errorcheck
+
+// Copyright 2017 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
+
+func f() {
+       _ = int("1")      // ERROR "cannot convert|invalid type conversion"
+       _ = bool(0)       // ERROR "cannot convert|invalid type conversion"
+       _ = bool("false") // ERROR "cannot convert|invalid type conversion"
+       _ = int(false)    // ERROR "cannot convert|invalid type conversion"
+       _ = string(true)  // ERROR "cannot convert|invalid type conversion"
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue20813.go b/gcc/testsuite/go.test/test/fixedbugs/issue20813.go
new file mode 100644 (file)
index 0000000..b147a89
--- /dev/null
@@ -0,0 +1,11 @@
+// errorcheck
+
+// Copyright 2017 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
+
+func f() {
+       1 = 2 // ERROR "cannot assign to 1|invalid left hand side"
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue21048.go b/gcc/testsuite/go.test/test/fixedbugs/issue21048.go
new file mode 100644 (file)
index 0000000..e365a5e
--- /dev/null
@@ -0,0 +1,72 @@
+// run
+
+// Copyright 2017 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 21048: s390x merged address generation into stores
+// to unaligned global variables. This resulted in an illegal
+// instruction.
+
+package main
+
+type T struct {
+       _ [1]byte
+       a [2]byte // offset: 1
+       _ [3]byte
+       b [2]uint16 // offset: 6
+       _ [2]byte
+       c [2]uint32 // offset: 12
+       _ [2]byte
+       d [2]int16 // offset: 22
+       _ [2]byte
+       e [2]int32 // offset: 28
+}
+
+var Source, Sink T
+
+func newT() T {
+       return T{
+               a: [2]byte{1, 2},
+               b: [2]uint16{1, 2},
+               c: [2]uint32{1, 2},
+               d: [2]int16{1, 2},
+               e: [2]int32{1, 2},
+       }
+}
+
+//go:noinline
+func moves() {
+       Sink.a = Source.a
+       Sink.b = Source.b
+       Sink.c = Source.c
+       Sink.d = Source.d
+       Sink.e = Source.e
+}
+
+//go:noinline
+func loads() *T {
+       t := newT()
+       t.a = Source.a
+       t.b = Source.b
+       t.c = Source.c
+       t.d = Source.d
+       t.e = Source.e
+       return &t
+}
+
+//go:noinline
+func stores() {
+       t := newT()
+       Sink.a = t.a
+       Sink.b = t.b
+       Sink.c = t.c
+       Sink.d = t.d
+       Sink.e = t.e
+}
+
+func main() {
+       moves()
+       loads()
+       stores()
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue21120.dir/a.go b/gcc/testsuite/go.test/test/fixedbugs/issue21120.dir/a.go
new file mode 100644 (file)
index 0000000..f2ee252
--- /dev/null
@@ -0,0 +1,13 @@
+// Copyright 2017 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
+
+type S struct {
+       x int
+}
+
+func V() interface{} {
+       return S{0}
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue21120.dir/b.go b/gcc/testsuite/go.test/test/fixedbugs/issue21120.dir/b.go
new file mode 100644 (file)
index 0000000..b00bd53
--- /dev/null
@@ -0,0 +1,29 @@
+// Copyright 2017 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
+
+import "reflect"
+
+type X int
+
+func F1() string {
+       type x X
+
+       s := struct {
+               *x
+       }{nil}
+       v := reflect.TypeOf(s)
+       return v.Field(0).PkgPath
+}
+
+func F2() string {
+       type y X
+
+       s := struct {
+               *y
+       }{nil}
+       v := reflect.TypeOf(s)
+       return v.Field(0).PkgPath
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue21120.dir/main.go b/gcc/testsuite/go.test/test/fixedbugs/issue21120.dir/main.go
new file mode 100644 (file)
index 0000000..1f1ec30
--- /dev/null
@@ -0,0 +1,25 @@
+// Copyright 2017 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"
+       "os"
+
+       "./a"
+       "./b"
+)
+
+func main() {
+       // Make sure the reflect information for a.S is in the executable.
+       _ = a.V()
+
+       b1 := b.F1()
+       b2 := b.F2()
+       if b1 != b2 {
+               fmt.Printf("%q (from b.F1()) != %q (from b.F2())\n", b1, b2)
+               os.Exit(1)
+       }
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue21120.go b/gcc/testsuite/go.test/test/fixedbugs/issue21120.go
new file mode 100644 (file)
index 0000000..ea896ce
--- /dev/null
@@ -0,0 +1,11 @@
+// rundir
+
+// Copyright 2017 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.
+
+// The compiler was using an incomplete symbol name for reflect name data,
+// permitting an invalid merge in the linker, producing an incorrect
+// exported flag bit.
+
+package ignored
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue21221.go b/gcc/testsuite/go.test/test/fixedbugs/issue21221.go
new file mode 100644 (file)
index 0000000..bd5a4b5
--- /dev/null
@@ -0,0 +1,18 @@
+// run
+
+// Copyright 2018 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() {
+       if unsafe.Pointer(uintptr(0)) != unsafe.Pointer(nil) {
+               panic("fail")
+       }
+       if (*int)(unsafe.Pointer(uintptr(0))) != (*int)(nil) {
+               panic("fail")
+       }
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue21256.go b/gcc/testsuite/go.test/test/fixedbugs/issue21256.go
new file mode 100644 (file)
index 0000000..c845ec5
--- /dev/null
@@ -0,0 +1,9 @@
+// errorcheck
+
+// Copyright 2017 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 main = func() {} // ERROR "must be func|redefinition"
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue21273.go b/gcc/testsuite/go.test/test/fixedbugs/issue21273.go
new file mode 100644 (file)
index 0000000..77a1aba
--- /dev/null
@@ -0,0 +1,28 @@
+// errorcheck
+
+// Copyright 2017 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 T0 T0 // ERROR "invalid recursive type"
+type _ map[T0]int
+
+type T1 struct{ T1 } // ERROR "invalid recursive type"
+type _ map[T1]int
+
+func f() {
+       type T2 T2 // ERROR "invalid recursive type"
+       type _ map[T2]int
+}
+
+func g() {
+       type T3 struct{ T3 } // ERROR "invalid recursive type"
+       type _ map[T3]int
+}
+
+func h() {
+       type T4 struct{ m map[T4]int } // ERROR "invalid map key"
+       type _ map[T4]int              // GC_ERROR "invalid map key"
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue21317.go b/gcc/testsuite/go.test/test/fixedbugs/issue21317.go
new file mode 100644 (file)
index 0000000..f4ec422
--- /dev/null
@@ -0,0 +1,60 @@
+// run
+
+// Copyright 2017 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.
+
+// As of "Mon 6 Nov 2017", run.go doesn't yet have proper
+// column matching so instead match the output manually
+// by exec-ing
+
+package main
+
+import (
+       "fmt"
+       "io/ioutil"
+       "log"
+       "os"
+       "os/exec"
+       "runtime"
+       "strings"
+)
+
+func main() {
+       if runtime.Compiler != "gc" || runtime.GOOS == "js" {
+               return
+       }
+
+       f, err := ioutil.TempFile("", "issue21317.go")
+       if err != nil {
+               log.Fatal(err)
+       }
+       fmt.Fprintf(f, `
+package main
+
+import "fmt"
+
+func main() {
+        n, err := fmt.Println(1)
+}
+`)
+       f.Close()
+       defer os.RemoveAll(f.Name())
+
+       // compile and test output
+       cmd := exec.Command("go", "tool", "compile", f.Name())
+       out, err := cmd.CombinedOutput()
+       if err == nil {
+               log.Fatalf("expected cmd/compile to fail")
+       }
+       wantErrs := []string{
+               "7:9: n declared but not used",
+               "7:12: err declared but not used",
+       }
+       outStr := string(out)
+       for _, want := range wantErrs {
+               if !strings.Contains(outStr, want) {
+                       log.Fatalf("failed to match %q\noutput: %q", want, outStr)
+               }
+       }
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue21576.go b/gcc/testsuite/go.test/test/fixedbugs/issue21576.go
new file mode 100644 (file)
index 0000000..ae6161c
--- /dev/null
@@ -0,0 +1,63 @@
+// run
+
+// +build !nacl,!js
+
+// Copyright 2019 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.
+//
+// Ensure that deadlock detection can still
+// run even with an import of "_ os/signal".
+
+package main
+
+import (
+       "bytes"
+       "context"
+       "io/ioutil"
+       "log"
+       "os"
+       "os/exec"
+       "path/filepath"
+       "time"
+)
+
+const prog = `
+package main
+
+import _ "os/signal"
+
+func main() {
+  c := make(chan int)
+  c <- 1
+}
+`
+
+func main() {
+       dir, err := ioutil.TempDir("", "21576")
+       if err != nil {
+               log.Fatal(err)
+       }
+       defer os.RemoveAll(dir)
+
+       file := filepath.Join(dir, "main.go")
+       if err := ioutil.WriteFile(file, []byte(prog), 0655); err != nil {
+               log.Fatalf("Write error %v", err)
+       }
+
+       // Using a timeout of 1 minute in case other factors might slow
+       // down the start of "go run". See https://golang.org/issue/34836.
+       ctx, cancel := context.WithTimeout(context.Background(), time.Minute)
+       defer cancel()
+
+       cmd := exec.CommandContext(ctx, "go", "run", file)
+       output, err := cmd.CombinedOutput()
+       if err == nil {
+               log.Fatalf("Passed, expected an error")
+       }
+
+       want := []byte("fatal error: all goroutines are asleep - deadlock!")
+       if !bytes.Contains(output, want) {
+               log.Fatalf("Unmatched error message %q:\nin\n%s\nError: %v", want, output, err)
+       }
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue21655.go b/gcc/testsuite/go.test/test/fixedbugs/issue21655.go
new file mode 100644 (file)
index 0000000..66d4e3a
--- /dev/null
@@ -0,0 +1,62 @@
+// compile
+
+// Copyright 2017 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.
+
+// Make sure assembly offsets don't get too large.
+
+// To trigger issue21655, the index offset needs to be small
+// enough to fit into an int32 (to get rewritten to an ADDQconst)
+// but large enough to overflow an int32 after multiplying by the stride.
+
+package main
+
+func f1(a []int64, i int64) int64 {
+       return a[i+1<<30]
+}
+func f2(a []int32, i int64) int32 {
+       return a[i+1<<30]
+}
+func f3(a []int16, i int64) int16 {
+       return a[i+1<<30]
+}
+func f4(a []int8, i int64) int8 {
+       return a[i+1<<31]
+}
+func f5(a []float64, i int64) float64 {
+       return a[i+1<<30]
+}
+func f6(a []float32, i int64) float32 {
+       return a[i+1<<30]
+}
+
+// Note: Before the fix for issue 21655, f{1,2,5,6} made
+// the compiler crash. f3 silently generated the wrong
+// code, using an offset of -1<<31 instead of 1<<31.
+// (This is due to the assembler accepting offsets
+// like 0x80000000 and silently using them as
+// signed 32 bit offsets.)
+// f4 was ok, but testing it can't hurt.
+
+func f7(ss []*string, i int) string {
+       const offset = 3 << 29 // 3<<29 * 4 = 3<<31 = 1<<31 mod 1<<32.
+       if i > offset {
+               return *ss[i-offset]
+       }
+       return ""
+}
+func f8(ss []*string, i int) string {
+       const offset = 3<<29 + 10
+       if i > offset {
+               return *ss[i-offset]
+       }
+       return ""
+}
+func f9(ss []*string, i int) string {
+       const offset = 3<<29 - 10
+       if i > offset {
+               return *ss[i-offset]
+       }
+       return ""
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue21770.go b/gcc/testsuite/go.test/test/fixedbugs/issue21770.go
new file mode 100644 (file)
index 0000000..2f07d64
--- /dev/null
@@ -0,0 +1,20 @@
+// errorcheck
+
+// Copyright 2017 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 21770: gccgo incorrectly accepts "p.f = 0" where p is **struct
+
+package p
+
+type PP **struct{ f int }
+
+func f() {
+       // anonymous type
+       var p **struct{ f int }
+       p.f = 0 // ERROR "field"
+       // named type
+       var p2 PP
+       p2.f = 0 // ERROR "field"
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue21808.go b/gcc/testsuite/go.test/test/fixedbugs/issue21808.go
new file mode 100644 (file)
index 0000000..d146200
--- /dev/null
@@ -0,0 +1,17 @@
+// run
+
+// Copyright 2017 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.
+
+// Make sure println() prints a blank line.
+
+package main
+
+import "fmt"
+
+func main() {
+       fmt.Println("A")
+       println()
+       fmt.Println("B")
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue21808.out b/gcc/testsuite/go.test/test/fixedbugs/issue21808.out
new file mode 100644 (file)
index 0000000..655da03
--- /dev/null
@@ -0,0 +1,3 @@
+A
+
+B
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue21879.go b/gcc/testsuite/go.test/test/fixedbugs/issue21879.go
new file mode 100644 (file)
index 0000000..1029ca0
--- /dev/null
@@ -0,0 +1,37 @@
+// run
+
+// Copyright 2017 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"
+)
+
+func main() {
+       println(caller().frame.Function)
+
+       // Used to erroneously print "main.call.name" instead of
+       // "main.main".
+       println(caller().name())
+}
+
+func caller() call {
+       var pcs [3]uintptr
+       n := runtime.Callers(1, pcs[:])
+       frames := runtime.CallersFrames(pcs[:n])
+       frame, _ := frames.Next()
+       frame, _ = frames.Next()
+
+       return call{frame: frame}
+}
+
+type call struct {
+       frame runtime.Frame
+}
+
+func (c call) name() string {
+       return c.frame.Function
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue21879.out b/gcc/testsuite/go.test/test/fixedbugs/issue21879.out
new file mode 100644 (file)
index 0000000..066f1a8
--- /dev/null
@@ -0,0 +1,2 @@
+main.main
+main.main
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue21882.go b/gcc/testsuite/go.test/test/fixedbugs/issue21882.go
new file mode 100644 (file)
index 0000000..f77e046
--- /dev/null
@@ -0,0 +1,9 @@
+// errorcheck
+
+// Copyright 2017 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 T [2]T // ERROR "invalid recursive type"
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue21887.go b/gcc/testsuite/go.test/test/fixedbugs/issue21887.go
new file mode 100644 (file)
index 0000000..73c3f43
--- /dev/null
@@ -0,0 +1,25 @@
+// run
+
+// Copyright 2017 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 21887: println(^uint(0)) fails to compile
+
+package main
+
+import "strconv"
+
+func main() {
+       if strconv.IntSize == 32 {
+               println(^uint(0))
+       } else {
+               println(^uint32(0))
+       }
+
+       if strconv.IntSize == 64 {
+               println(^uint(0))
+       } else {
+               println(^uint64(0))
+       }
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue21887.out b/gcc/testsuite/go.test/test/fixedbugs/issue21887.out
new file mode 100644 (file)
index 0000000..664b67d
--- /dev/null
@@ -0,0 +1,2 @@
+4294967295
+18446744073709551615
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue21963.go b/gcc/testsuite/go.test/test/fixedbugs/issue21963.go
new file mode 100644 (file)
index 0000000..996bd63
--- /dev/null
@@ -0,0 +1,27 @@
+// run
+
+// Copyright 2017 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"
+       "runtime"
+)
+
+//go:noinline
+func f(x []int32, y *int8) int32 {
+       c := int32(int16(*y))
+       runtime.GC()
+       return x[0] * c
+}
+
+func main() {
+       var x = [1]int32{5}
+       var y int8 = -1
+       if got, want := f(x[:], &y), int32(-5); got != want {
+               panic(fmt.Sprintf("wanted %d, got %d", want, got))
+       }
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue21979.go b/gcc/testsuite/go.test/test/fixedbugs/issue21979.go
new file mode 100644 (file)
index 0000000..addf786
--- /dev/null
@@ -0,0 +1,46 @@
+// errorcheck
+
+// Copyright 2019 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
+
+func f() {
+       _ = bool("")      // ERROR "cannot convert .. \(type untyped string\) to type bool|invalid type conversion"
+       _ = bool(1)       // ERROR "cannot convert 1 \(type untyped int\) to type bool|invalid type conversion"
+       _ = bool(1.0)     // ERROR "cannot convert 1 \(type untyped float\) to type bool|invalid type conversion"
+       _ = bool(-4 + 2i) // ERROR "cannot convert -4 \+ 2i \(type untyped complex\) to type bool|invalid type conversion"
+
+       _ = string(true) // ERROR "cannot convert true \(type untyped bool\) to type string|invalid type conversion"
+       _ = string(-1)
+       _ = string(1.0)     // ERROR "cannot convert 1 \(type untyped float\) to type string|invalid type conversion"
+       _ = string(-4 + 2i) // ERROR "cannot convert -4 \+ 2i \(type untyped complex\) to type string|invalid type conversion"
+
+       _ = int("")   // ERROR "cannot convert .. \(type untyped string\) to type int|invalid type conversion"
+       _ = int(true) // ERROR "cannot convert true \(type untyped bool\) to type int|invalid type conversion"
+       _ = int(-1)
+       _ = int(1)
+       _ = int(1.0)
+       _ = int(-4 + 2i) // ERROR "truncated to integer"
+
+       _ = uint("")   // ERROR "cannot convert .. \(type untyped string\) to type uint|invalid type conversion"
+       _ = uint(true) // ERROR "cannot convert true \(type untyped bool\) to type uint|invalid type conversion"
+       _ = uint(-1)   // ERROR "constant -1 overflows uint|integer constant overflow"
+       _ = uint(1)
+       _ = uint(1.0)
+       _ = uint(-4 + 2i) // ERROR "constant -4 overflows uint" "truncated to integer"
+
+       _ = float64("")   // ERROR "cannot convert .. \(type untyped string\) to type float64|invalid type conversion"
+       _ = float64(true) // ERROR "cannot convert true \(type untyped bool\) to type float64|invalid type conversion"
+       _ = float64(-1)
+       _ = float64(1)
+       _ = float64(1.0)
+       _ = float64(-4 + 2i) // ERROR "truncated to"
+
+       _ = complex128("")   // ERROR "cannot convert .. \(type untyped string\) to type complex128|invalid type conversion"
+       _ = complex128(true) // ERROR "cannot convert true \(type untyped bool\) to type complex128|invalid type conversion"
+       _ = complex128(-1)
+       _ = complex128(1)
+       _ = complex128(1.0)
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue21988.go b/gcc/testsuite/go.test/test/fixedbugs/issue21988.go
new file mode 100644 (file)
index 0000000..4dbf06e
--- /dev/null
@@ -0,0 +1,17 @@
+// errorcheck
+
+// Copyright 2017 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 21988: panic on switch case with invalid value
+
+package p
+
+const X = Wrong(0) // ERROR "undefined: Wrong|undefined name .*Wrong"
+
+func _() {
+       switch 0 {
+       case X:
+       }
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue22063.go b/gcc/testsuite/go.test/test/fixedbugs/issue22063.go
new file mode 100644 (file)
index 0000000..8d84047
--- /dev/null
@@ -0,0 +1,17 @@
+// errorcheck
+
+// Copyright 2017 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 22063: panic on interface switch case with invalid name
+
+package p
+
+const X = Wrong(0) // ERROR "undefined: Wrong|reference to undefined name .*Wrong"
+
+func _() {
+       switch interface{}(nil) {
+       case X:
+       }
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue22076.go b/gcc/testsuite/go.test/test/fixedbugs/issue22076.go
new file mode 100644 (file)
index 0000000..5d628b9
--- /dev/null
@@ -0,0 +1,25 @@
+// compile
+
+// Copyright 2017 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 22076: Couldn't use ":=" to declare names that refer to
+// dot-imported symbols.
+
+package p
+
+import . "bytes"
+
+var _ Reader // use "bytes" import
+
+func _() {
+       Buffer := 0
+       _ = Buffer
+}
+
+func _() {
+       for Buffer := range []int{} {
+               _ = Buffer
+       }
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue22083.go b/gcc/testsuite/go.test/test/fixedbugs/issue22083.go
new file mode 100644 (file)
index 0000000..a385102
--- /dev/null
@@ -0,0 +1,41 @@
+// run
+
+// Copyright 2017 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.
+
+// The compiler was panicking on the wrong line number, where
+// the panic was occurring in an inlined call.
+
+package main
+
+import (
+       "runtime/debug"
+       "strings"
+)
+
+type Wrapper struct {
+       a []int
+}
+
+func (w Wrapper) Get(i int) int {
+       return w.a[i]
+}
+
+func main() {
+       defer func() {
+               e := recover()
+               if e == nil {
+                       panic("bounds check didn't fail")
+               }
+               stk := string(debug.Stack())
+               if !strings.Contains(stk, "issue22083.go:40") {
+                       panic("wrong stack trace: " + stk)
+               }
+       }()
+       foo := Wrapper{a: []int{0, 1, 2}}
+       _ = foo.Get(0)
+       _ = foo.Get(1)
+       _ = foo.Get(2)
+       _ = foo.Get(3) // stack trace should mention this line
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue22198.go b/gcc/testsuite/go.test/test/fixedbugs/issue22198.go
new file mode 100644 (file)
index 0000000..c874c1c
--- /dev/null
@@ -0,0 +1,18 @@
+// compile
+
+// Copyright 2017 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 issue22198
+
+func f(a *bool, b bool) {
+       if b {
+               return
+       }
+       c := '\n'
+       if b {
+               c = ' '
+       }
+       *a = c == '\n'
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue22200.go b/gcc/testsuite/go.test/test/fixedbugs/issue22200.go
new file mode 100644 (file)
index 0000000..37440d9
--- /dev/null
@@ -0,0 +1,20 @@
+// errorcheck
+
+// Copyright 2017 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
+
+func f1(x *[1<<30 - 1e6]byte) byte {
+       for _, b := range *x {
+               return b
+       }
+       return 0
+}
+func f2(x *[1<<30 + 1e6]byte) byte { // GC_ERROR "stack frame too large"
+       for _, b := range *x {
+               return b
+       }
+       return 0
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue22200b.go b/gcc/testsuite/go.test/test/fixedbugs/issue22200b.go
new file mode 100644 (file)
index 0000000..ce20923
--- /dev/null
@@ -0,0 +1,28 @@
+// errorcheck
+
+// Copyright 2017 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.
+
+// +build !386,!amd64p32,!arm,!mips,!mipsle
+
+package p
+
+func f3(x *[1 << 31]byte) byte { // GC_ERROR "stack frame too large"
+       for _, b := range *x {
+               return b
+       }
+       return 0
+}
+func f4(x *[1 << 32]byte) byte { // GC_ERROR "stack frame too large"
+       for _, b := range *x {
+               return b
+       }
+       return 0
+}
+func f5(x *[1 << 33]byte) byte { // GC_ERROR "stack frame too large"
+       for _, b := range *x {
+               return b
+       }
+       return 0
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue22326.go b/gcc/testsuite/go.test/test/fixedbugs/issue22326.go
new file mode 100644 (file)
index 0000000..a675655
--- /dev/null
@@ -0,0 +1,25 @@
+// run
+
+// Copyright 2019 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 (
+       _ = d
+       _ = f("_", c, b)
+       a = f("a")
+       b = f("b")
+       c = f("c")
+       d = f("d")
+)
+
+func f(s string, rest ...int) int {
+       print(s)
+       return 0
+}
+
+func main() {
+       println()
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue22326.out b/gcc/testsuite/go.test/test/fixedbugs/issue22326.out
new file mode 100644 (file)
index 0000000..f020438
--- /dev/null
@@ -0,0 +1 @@
+abc_d
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue22327.go b/gcc/testsuite/go.test/test/fixedbugs/issue22327.go
new file mode 100644 (file)
index 0000000..7b21d83
--- /dev/null
@@ -0,0 +1,18 @@
+// compile
+
+// Copyright 2018 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.
+
+// Using a multi-result function as an argument to
+// append should compile successfully. Previously there
+// was a missing *int -> interface{} conversion that caused
+// the compiler to ICE.
+
+package p
+
+func f() ([]interface{}, *int) {
+       return nil, nil
+}
+
+var _ = append(f())
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue22429.go b/gcc/testsuite/go.test/test/fixedbugs/issue22429.go
new file mode 100644 (file)
index 0000000..289b434
--- /dev/null
@@ -0,0 +1,18 @@
+// compile
+
+// Copyright 2017 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.
+
+// Make sure SSA->assembly pass can handle SP as an index register.
+
+package p
+
+type T struct {
+       a,b,c,d float32
+}
+
+func f(a *[8]T, i,j,k int) float32 {
+       b := *a
+       return b[i].a + b[j].b + b[k].c
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue22458.go b/gcc/testsuite/go.test/test/fixedbugs/issue22458.go
new file mode 100644 (file)
index 0000000..5c89929
--- /dev/null
@@ -0,0 +1,26 @@
+// compile
+
+// Copyright 2017 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.
+
+// Make sure KeepAlive introduces a use of the spilled variable.
+
+package main
+
+import "runtime"
+
+type node struct {
+        next *node
+}
+
+var x bool
+
+func main() {
+        var head *node
+        for x {
+                head = &node{head}
+        }
+
+        runtime.KeepAlive(head)
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue22605.go b/gcc/testsuite/go.test/test/fixedbugs/issue22605.go
new file mode 100644 (file)
index 0000000..9e726f3
--- /dev/null
@@ -0,0 +1,26 @@
+// run
+
+// Copyright 2017 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.
+
+// We were picking up a special noalg type from typelinks.
+
+package main
+
+import "reflect"
+
+func f(m map[string]int) int {
+       return m["a"]
+}
+
+func g(m map[[8]string]int) int {
+       t := reflect.ArrayOf(8, reflect.TypeOf(""))
+       a := reflect.New(t).Elem()
+       return m[a.Interface().([8]string)]
+}
+
+func main() {
+       m := map[[8]string]int{}
+       g(m)
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue22660.go b/gcc/testsuite/go.test/test/fixedbugs/issue22660.go
new file mode 100644 (file)
index 0000000..44ba42a
--- /dev/null
@@ -0,0 +1,50 @@
+// run
+
+// Copyright 2017 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 (
+       "bytes"
+       "fmt"
+       "io/ioutil"
+       "log"
+       "os"
+       "os/exec"
+       "path/filepath"
+       "runtime"
+       "strings"
+)
+
+func main() {
+       if runtime.GOOS == "js" {
+               return // no file system available on builders
+       }
+
+       f, err := ioutil.TempFile("", "issue22660.go")
+       if err != nil {
+               log.Fatal(err)
+       }
+       f.Close()
+       defer os.Remove(f.Name())
+
+       // path must appear in error messages even if we strip them with -trimpath
+       path := filepath.Join("users", "xxx", "go")
+       var src bytes.Buffer
+       fmt.Fprintf(&src, "//line %s:1\n", filepath.Join(path, "foo.go"))
+
+       if err := ioutil.WriteFile(f.Name(), src.Bytes(), 0660); err != nil {
+               log.Fatal(err)
+       }
+
+       out, err := exec.Command("go", "tool", "compile", fmt.Sprintf("-trimpath=%s", path), f.Name()).CombinedOutput()
+       if err == nil {
+               log.Fatalf("expected compiling %s to fail", f.Name())
+       }
+
+       if !strings.HasPrefix(string(out), path) {
+               log.Fatalf("expected full path (%s) in error message, got:\n%s", path, out)
+       }
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue22683.go b/gcc/testsuite/go.test/test/fixedbugs/issue22683.go
new file mode 100644 (file)
index 0000000..47c7f65
--- /dev/null
@@ -0,0 +1,30 @@
+// run
+
+// Copyright 2017 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"
+)
+
+type foo struct {
+       bar [1]*int
+}
+
+func main() {
+       ch := make(chan foo, 2)
+       var a int
+       var b [1]*int
+       b[0] = &a
+       ch <- foo{bar: b}
+       close(ch)
+
+       for v := range ch {
+               for i := 0; i < 1; i++ {
+                       fmt.Println(v.bar[0] != nil)
+               }
+       }
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue22683.out b/gcc/testsuite/go.test/test/fixedbugs/issue22683.out
new file mode 100644 (file)
index 0000000..27ba77d
--- /dev/null
@@ -0,0 +1 @@
+true
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue22781.go b/gcc/testsuite/go.test/test/fixedbugs/issue22781.go
new file mode 100644 (file)
index 0000000..5ad8239
--- /dev/null
@@ -0,0 +1,29 @@
+// run
+
+// Copyright 2017 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/debug"
+
+type T struct {
+       // >= 16 bytes to avoid tiny alloc.
+       a, b int
+}
+
+func main() {
+       debug.SetGCPercent(1)
+       for i := 0; i < 100000; i++ {
+               m := make(map[*T]struct{}, 0)
+               for j := 0; j < 20; j++ {
+                       // During the call to mapassign_fast64, the key argument
+                       // was incorrectly treated as a uint64. If the stack was
+                       // scanned during that call, the only pointer to k was
+                       // missed, leading to *k being collected prematurely.
+                       k := new(T)
+                       m[k] = struct{}{}
+               }
+       }
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue22794.go b/gcc/testsuite/go.test/test/fixedbugs/issue22794.go
new file mode 100644 (file)
index 0000000..2ac31ef
--- /dev/null
@@ -0,0 +1,20 @@
+// errorcheck
+
+// Copyright 2017 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 it struct {
+       Floats bool
+       inner  string
+}
+
+func main() {
+       i1 := it{Floats: true}
+       if i1.floats { // ERROR "(type it .* field or method floats, but does have Floats)|undefined field or method"
+       }
+       i2 := &it{floats: false} // ERROR "(but does have Floats)|unknown field|declared but not used"
+       _ = &it{InneR: "foo"}    // ERROR "(but does have inner)|unknown field"
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue22822.go b/gcc/testsuite/go.test/test/fixedbugs/issue22822.go
new file mode 100644 (file)
index 0000000..ea53452
--- /dev/null
@@ -0,0 +1,16 @@
+// errorcheck
+
+// Copyright 2018 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 calling a function shadowing a built-in provides a good
+// error message.
+
+package main
+
+func F() {
+       slice := []int{1, 2, 3}
+       len := int(2)
+       println(len(slice)) // ERROR "cannot call non-function len .type int., declared at|expected function"
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue22881.go b/gcc/testsuite/go.test/test/fixedbugs/issue22881.go
new file mode 100644 (file)
index 0000000..645f2d4
--- /dev/null
@@ -0,0 +1,117 @@
+// run
+
+// Copyright 2017 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.
+
+// Test to make sure RHS is evaluated before map insert is started.
+// The RHS panics in all of these cases.
+
+package main
+
+import "fmt"
+
+func main() {
+       for i, f := range []func(map[int]int){
+               f0, f1, f2, f3, f4, f5, f6, f7, f8,
+       } {
+               m := map[int]int{}
+               func() { // wrapper to scope the defer.
+                       defer func() {
+                               recover()
+                       }()
+                       f(m) // Will panic. Shouldn't modify m.
+                       fmt.Printf("RHS didn't panic, case f%d\n", i)
+               }()
+               if len(m) != 0 {
+                       fmt.Printf("map insert happened, case f%d\n", i)
+               }
+       }
+
+       // Append slice.
+       for i, f := range []func(map[int][]int){
+               fa0, fa1, fa2, fa3,
+       } {
+               m := map[int][]int{}
+               func() { // wrapper to scope the defer.
+                       defer func() {
+                               recover()
+                       }()
+                       f(m) // Will panic. Shouldn't modify m.
+                       fmt.Printf("RHS didn't panic, case fa%d\n", i)
+               }()
+               if len(m) != 0 {
+                       fmt.Printf("map insert happened, case fa%d\n", i)
+               }
+       }
+}
+
+func f0(m map[int]int) {
+       var p *int
+       m[0] = *p
+}
+
+func f1(m map[int]int) {
+       var p *int
+       m[0] += *p
+}
+
+func f2(m map[int]int) {
+       var p *int
+       sink, m[0] = sink, *p
+}
+
+func f3(m map[int]int) {
+       var p *chan int
+       m[0], sink = <-(*p)
+}
+
+func f4(m map[int]int) {
+       var p *interface{}
+       m[0], sink = (*p).(int)
+}
+
+func f5(m map[int]int) {
+       var p *map[int]int
+       m[0], sink = (*p)[0]
+}
+
+func f6(m map[int]int) {
+       var z int
+       m[0] /= z
+}
+
+func f7(m map[int]int) {
+       var a []int
+       m[0] = a[0]
+}
+
+func f8(m map[int]int) {
+       var z int
+       m[0] %= z
+}
+
+func fa0(m map[int][]int) {
+       var p *int
+       m[0] = append(m[0], *p)
+}
+
+func fa1(m map[int][]int) {
+       var p *int
+       sink, m[0] = !sink, append(m[0], *p)
+}
+
+func fa2(m map[int][]int) {
+       var p *int
+       m[0], _ = append(m[0], 0), *p
+}
+
+func fa3(m map[int][]int) {
+       // OSLICE has similar in-place-reassignment
+       // optimizations as OAPPEND, but we need to make sure
+       // to *not* optimize them, because we can't guarantee
+       // the slice indices are within bounds.
+       m[0] = m[0][:1]
+}
+
+var sink bool
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue22904.go b/gcc/testsuite/go.test/test/fixedbugs/issue22904.go
new file mode 100644 (file)
index 0000000..02459c6
--- /dev/null
@@ -0,0 +1,19 @@
+// errorcheck
+
+// Copyright 2017 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 22904: Make sure the compiler emits a proper error message about
+// invalid recursive types rather than crashing.
+
+package p
+
+type a struct{ b } // ERROR "invalid recursive type"
+type b struct{ a } // GCCGO_ERROR "invalid recursive type"
+
+var x interface{}
+
+func f() {
+       x = a{}
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue22921.go b/gcc/testsuite/go.test/test/fixedbugs/issue22921.go
new file mode 100644 (file)
index 0000000..5336ba3
--- /dev/null
@@ -0,0 +1,18 @@
+// errorcheck
+
+// Copyright 2020 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 "bytes"
+
+type _ struct{ bytes.nonexist } // ERROR "unexported|undefined"
+
+type _ interface{ bytes.nonexist } // ERROR "unexported|undefined|expected signature or type name"
+
+func main() {
+       var _ bytes.Buffer
+       var _ bytes.buffer // ERROR "unexported|undefined"
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue22941.dir/a.go b/gcc/testsuite/go.test/test/fixedbugs/issue22941.dir/a.go
new file mode 100644 (file)
index 0000000..7a4ede4
--- /dev/null
@@ -0,0 +1,7 @@
+// Copyright 2017 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 q
+
+type P int
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue22941.dir/b.go b/gcc/testsuite/go.test/test/fixedbugs/issue22941.dir/b.go
new file mode 100644 (file)
index 0000000..87d59a6
--- /dev/null
@@ -0,0 +1,30 @@
+// Copyright 2017 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
+
+import q "./a"
+
+type T struct {
+       X *q.P
+}
+
+func F(in, out *T) {
+       *out = *in
+       if in.X != nil {
+               in, out := &in.X, &out.X
+               if *in == nil {
+                       *out = nil
+               } else {
+                       *out = new(q.P)
+                       **out = **in
+               }
+       }
+       return
+}
+
+//go:noinline
+func G(x, y *T) {
+       F(x, y)
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue22941.dir/main.go b/gcc/testsuite/go.test/test/fixedbugs/issue22941.dir/main.go
new file mode 100644 (file)
index 0000000..84666ad
--- /dev/null
@@ -0,0 +1,15 @@
+// Copyright 2017 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 p "./b"
+
+var G int
+
+func main() {
+       if G == 101 {
+               p.G(nil, nil)
+       }
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue22941.go b/gcc/testsuite/go.test/test/fixedbugs/issue22941.go
new file mode 100644 (file)
index 0000000..c3732c3
--- /dev/null
@@ -0,0 +1,7 @@
+// rundir
+
+// Copyright 2017 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/issue22962.dir/a.go b/gcc/testsuite/go.test/test/fixedbugs/issue22962.dir/a.go
new file mode 100644 (file)
index 0000000..7257d7d
--- /dev/null
@@ -0,0 +1,11 @@
+// Copyright 2017 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
+
+func F() {
+       if x := 0; false {
+               _ = x
+       }
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue22962.dir/b.go b/gcc/testsuite/go.test/test/fixedbugs/issue22962.dir/b.go
new file mode 100644 (file)
index 0000000..e1568c8
--- /dev/null
@@ -0,0 +1,9 @@
+// Copyright 2017 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
+
+import "a"
+
+var V = func() { a.F() }
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue22962.go b/gcc/testsuite/go.test/test/fixedbugs/issue22962.go
new file mode 100644 (file)
index 0000000..8000a52
--- /dev/null
@@ -0,0 +1,7 @@
+// compiledir
+
+// Copyright 2017 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/issue23093.go b/gcc/testsuite/go.test/test/fixedbugs/issue23093.go
new file mode 100644 (file)
index 0000000..7b2865c
--- /dev/null
@@ -0,0 +1,9 @@
+// errorcheck
+
+// Copyright 2017 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
+
+var f = func() { f() } // ERROR "initialization loop|initialization expression for .*f.* depends upon itself"
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue23116.go b/gcc/testsuite/go.test/test/fixedbugs/issue23116.go
new file mode 100644 (file)
index 0000000..b4b36d4
--- /dev/null
@@ -0,0 +1,15 @@
+// errorcheck
+
+// Copyright 2018 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
+
+func f(x interface{}) {
+       switch x.(type) {
+       }
+
+       switch t := x.(type) { // ERROR "declared but not used"
+       }
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue23179.dir/a.go b/gcc/testsuite/go.test/test/fixedbugs/issue23179.dir/a.go
new file mode 100644 (file)
index 0000000..3d2816f
--- /dev/null
@@ -0,0 +1,13 @@
+// Copyright 2017 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
+
+type Large struct {
+       x [256]int
+}
+
+func F(x int, _ int, _ bool, _ Large) int {
+       return x
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue23179.dir/b.go b/gcc/testsuite/go.test/test/fixedbugs/issue23179.dir/b.go
new file mode 100644 (file)
index 0000000..bec3d15
--- /dev/null
@@ -0,0 +1,11 @@
+// Copyright 2017 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
+
+import "a"
+
+func G(x int) int {
+       return a.F(x, 1, false, a.Large{})
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue23179.go b/gcc/testsuite/go.test/test/fixedbugs/issue23179.go
new file mode 100644 (file)
index 0000000..8000a52
--- /dev/null
@@ -0,0 +1,7 @@
+// compiledir
+
+// Copyright 2017 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/issue23298.go b/gcc/testsuite/go.test/test/fixedbugs/issue23298.go
new file mode 100644 (file)
index 0000000..be00a8e
--- /dev/null
@@ -0,0 +1,14 @@
+// compile
+
+// Copyright 2018 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 T string
+
+var (
+       t = T("T")
+       r = []rune(t)
+)
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue23305.go b/gcc/testsuite/go.test/test/fixedbugs/issue23305.go
new file mode 100644 (file)
index 0000000..28f400c
--- /dev/null
@@ -0,0 +1,28 @@
+// run
+
+// Copyright 2018 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 mask1(a, b uint64) uint64 {
+       op1 := int32(a)
+       op2 := int32(b)
+       return uint64(uint32(op1 / op2))
+}
+
+var mask2 = mask1
+
+func main() {
+       res1 := mask1(0x1, 0xfffffffeffffffff)
+       res2 := mask2(0x1, 0xfffffffeffffffff)
+       if res1 != 0xffffffff {
+               println("got", res1, "want", 0xffffffff)
+               panic("FAIL")
+       }
+       if res2 != 0xffffffff {
+               println("got", res2, "want", 0xffffffff)
+               panic("FAIL")
+       }
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue23311.dir/main.go b/gcc/testsuite/go.test/test/fixedbugs/issue23311.dir/main.go
new file mode 100644 (file)
index 0000000..fa4cf76
--- /dev/null
@@ -0,0 +1,14 @@
+// Copyright 2018 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" // for linkname
+
+//go:linkname f runtime.GC
+func f()
+
+func main() {
+       f()
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue23311.go b/gcc/testsuite/go.test/test/fixedbugs/issue23311.go
new file mode 100644 (file)
index 0000000..128cf9d
--- /dev/null
@@ -0,0 +1,7 @@
+// compiledir
+
+// Copyright 2018 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/issue23414.go b/gcc/testsuite/go.test/test/fixedbugs/issue23414.go
new file mode 100644 (file)
index 0000000..7ef3d83
--- /dev/null
@@ -0,0 +1,13 @@
+// compile
+
+// Copyright 2018 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
+
+var x struct{}
+
+func f() bool {
+       return x == x && x == x
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue23504.go b/gcc/testsuite/go.test/test/fixedbugs/issue23504.go
new file mode 100644 (file)
index 0000000..77f3184
--- /dev/null
@@ -0,0 +1,15 @@
+// compile
+
+// Copyright 2018 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
+
+func f() {
+       var B bool
+       B2 := (B || B && !B) && !B
+       B3 := B2 || B
+       for (B3 || B2) && !B2 && B {
+       }
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue23521.go b/gcc/testsuite/go.test/test/fixedbugs/issue23521.go
new file mode 100644 (file)
index 0000000..159e032
--- /dev/null
@@ -0,0 +1,43 @@
+// errorcheck -0 -m
+
+// Copyright 2018 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 23521: improve early DCE for if without explicit else.
+
+package p
+
+//go:noinline
+func nonleaf() {}
+
+const truth = true
+
+func f() int { // ERROR "can inline f"
+       if truth {
+               return 0
+       }
+       // If everything below is removed, as it should,
+       // function f should be inlineable.
+       nonleaf()
+       for {
+               panic("")
+       }
+}
+
+func g() int { // ERROR "can inline g"
+       return f() // ERROR "inlining call to f"
+}
+
+func f2() int { // ERROR "can inline f2"
+       if !truth {
+               nonleaf()
+       } else {
+               return 0
+       }
+       panic("")
+}
+
+func g2() int { // ERROR "can inline g2"
+       return f2() // ERROR "inlining call to f2"
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue23522.go b/gcc/testsuite/go.test/test/fixedbugs/issue23522.go
new file mode 100644 (file)
index 0000000..cace86c
--- /dev/null
@@ -0,0 +1,46 @@
+// run
+
+// Copyright 2018 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 (
+       "math"
+)
+
+type S struct {
+       u int64
+       n int32
+}
+
+func F1(f float64) *S {
+       s := f
+       pf := math.Copysign(f, 1)
+       u := math.Floor(pf)
+       return &S{
+               u: int64(math.Copysign(u, s)),
+               n: int32(math.Copysign((pf-u)*1e9, s)),
+       }
+}
+
+func F2(f float64) *S {
+       s := f
+       f = math.Copysign(f, 1)
+       u := math.Floor(f)
+       return &S{
+               u: int64(math.Copysign(u, s)),
+               n: int32(math.Copysign((f-u)*1e9, s)),
+       }
+}
+
+func main() {
+       s1 := F1(-1)
+       s2 := F2(-1)
+       if *s1 != *s2 {
+               println("F1:", s1.u, s1.n)
+               println("F2:", s2.u, s2.n)
+               panic("different")
+       }
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue23545.go b/gcc/testsuite/go.test/test/fixedbugs/issue23545.go
new file mode 100644 (file)
index 0000000..d97f64a
--- /dev/null
@@ -0,0 +1,31 @@
+// run
+
+// Copyright 2018 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 23545: gccgo didn't lower array comparison to
+// proper equality function in some case.
+
+package main
+
+func main() {
+       if a := Get(); a != dummyID(1234) {
+               panic("FAIL")
+       }
+}
+
+func dummyID(x int) [Size]interface{} {
+       var out [Size]interface{}
+       out[0] = x
+       return out
+}
+
+const Size = 32
+
+type OutputID [Size]interface{}
+
+//go:noinline
+func Get() OutputID {
+       return dummyID(1234)
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue23546.go b/gcc/testsuite/go.test/test/fixedbugs/issue23546.go
new file mode 100644 (file)
index 0000000..818f0cd
--- /dev/null
@@ -0,0 +1,22 @@
+// run
+
+// Copyright 2018 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 23546: type..eq function not generated when
+// DWARF is disabled.
+
+package main
+
+func main() {
+       use(f() == f())
+}
+
+func f() [2]interface{} {
+       var out [2]interface{}
+       return out
+}
+
+//go:noinline
+func use(bool) {}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue23586.go b/gcc/testsuite/go.test/test/fixedbugs/issue23586.go
new file mode 100644 (file)
index 0000000..c2d4c9f
--- /dev/null
@@ -0,0 +1,24 @@
+// errorcheck
+
+// Copyright 2018 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.
+
+// Test that we type-check deferred/go functions even
+// if they are not called (a common error). Specifically,
+// we don't want to see errors such as import or variable
+// declared but not used.
+
+package p
+
+import (
+       "fmt"
+       "math"
+)
+
+func f() {
+       var i int
+       defer func() { fmt.Println() } // ERROR "must be function call"
+       go func() { _ = math.Sin(0) }  // ERROR "must be function call"
+       go func() { _ = i}             // ERROR "must be function call"
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue23719.go b/gcc/testsuite/go.test/test/fixedbugs/issue23719.go
new file mode 100644 (file)
index 0000000..c97e636
--- /dev/null
@@ -0,0 +1,42 @@
+// run
+
+// Copyright 2018 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() {
+       v1 := [2]int32{-1, 88}
+       v2 := [2]int32{-1, 99}
+       if v1 == v2 {
+               panic("bad comparison")
+       }
+
+       w1 := [2]int16{-1, 88}
+       w2 := [2]int16{-1, 99}
+       if w1 == w2 {
+               panic("bad comparison")
+       }
+       x1 := [4]int16{-1, 88, 88, 88}
+       x2 := [4]int16{-1, 99, 99, 99}
+       if x1 == x2 {
+               panic("bad comparison")
+       }
+
+       a1 := [2]int8{-1, 88}
+       a2 := [2]int8{-1, 99}
+       if a1 == a2 {
+               panic("bad comparison")
+       }
+       b1 := [4]int8{-1, 88, 88, 88}
+       b2 := [4]int8{-1, 99, 99, 99}
+       if b1 == b2 {
+               panic("bad comparison")
+       }
+       c1 := [8]int8{-1, 88, 88, 88, 88, 88, 88, 88}
+       c2 := [8]int8{-1, 99, 99, 99, 99, 99, 99, 99}
+       if c1 == c2 {
+               panic("bad comparison")
+       }
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue23732.go b/gcc/testsuite/go.test/test/fixedbugs/issue23732.go
new file mode 100644 (file)
index 0000000..db2d182
--- /dev/null
@@ -0,0 +1,42 @@
+// errorcheck
+
+// Copyright 2018 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 23732: Give better details about which struct
+// initializer has the wrong number of values.
+
+package main
+
+type Foo struct {
+       A int
+       B int
+       C interface{}
+       Bar
+}
+
+type Bar struct {
+       A string
+}
+
+func main() {
+       _ = Foo{ // GCCGO_ERROR "too few expressions"
+               1,
+               2,
+               3, // GC_ERROR "too few values in Foo{...}"
+       }
+
+       _ = Foo{
+               1,
+               2,
+               3,
+               Bar{"A", "B"}, // ERROR "too many values in Bar{...}|too many expressions"
+       }
+
+       _ = Foo{ // GCCGO_ERROR "too few expressions"
+               1,
+               2,
+               Bar{"A", "B"}, // ERROR "too many values in Bar{...}|too many expressions" "too few values in Foo{...}"
+       }
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue23734.go b/gcc/testsuite/go.test/test/fixedbugs/issue23734.go
new file mode 100644 (file)
index 0000000..dd5869b
--- /dev/null
@@ -0,0 +1,32 @@
+// run
+
+// Copyright 2018 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() {
+       m := map[interface{}]int{}
+       k := []int{}
+
+       mustPanic(func() {
+               _ = m[k]
+       })
+       mustPanic(func() {
+               _, _ = m[k]
+       })
+       mustPanic(func() {
+               delete(m, k)
+       })
+}
+
+func mustPanic(f func()) {
+       defer func() {
+               r := recover()
+               if r == nil {
+                       panic("didn't panic")
+               }
+       }()
+       f()
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue23780.go b/gcc/testsuite/go.test/test/fixedbugs/issue23780.go
new file mode 100644 (file)
index 0000000..71fc2d9
--- /dev/null
@@ -0,0 +1,17 @@
+// compile
+
+// Copyright 2018 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
+
+func f() {
+       _ = []byte{1 << 30: 1}
+}
+
+func g() {
+       sink = []byte{1 << 30: 1}
+}
+
+var sink []byte
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue23781.go b/gcc/testsuite/go.test/test/fixedbugs/issue23781.go
new file mode 100644 (file)
index 0000000..5c03cf7
--- /dev/null
@@ -0,0 +1,10 @@
+// +build amd64
+// compile
+
+// Copyright 2009 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
+
+var _ = []int{1 << 31: 1} // ok on machines with 64bit int
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue23812.go b/gcc/testsuite/go.test/test/fixedbugs/issue23812.go
new file mode 100644 (file)
index 0000000..0a40deb
--- /dev/null
@@ -0,0 +1,34 @@
+// run
+
+// Copyright 2018 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() {
+       want := int32(0x3edae8)
+       got := foo(1)
+       if want != got {
+               panic(fmt.Sprintf("want %x, got %x", want, got))
+       }
+}
+
+func foo(a int32) int32 {
+       return shr1(int32(shr2(int64(0x14ff6e2207db5d1f), int(a))), 4)
+}
+
+func shr1(n int32, m int) int32 { return n >> uint(m) }
+
+func shr2(n int64, m int) int64 {
+       if m < 0 {
+               m = -m
+       }
+       if m >= 64 {
+               return n
+       }
+
+       return n >> uint(m)
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue23823.go b/gcc/testsuite/go.test/test/fixedbugs/issue23823.go
new file mode 100644 (file)
index 0000000..067a8f1
--- /dev/null
@@ -0,0 +1,16 @@
+// errorcheck
+
+// Copyright 2018 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 I1 = interface {
+       I2
+}
+
+// BAD: type loop should mention I1; see also #41669
+type I2 interface { // GC_ERROR "invalid recursive type I2\n\tLINE: I2 refers to\n\tLINE: I2$"
+       I1 // GCCGO_ERROR "invalid recursive interface"
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue24120.go b/gcc/testsuite/go.test/test/fixedbugs/issue24120.go
new file mode 100644 (file)
index 0000000..6c7d871
--- /dev/null
@@ -0,0 +1,14 @@
+// compile
+
+// Copyright 2018 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
+
+var F func(int)
+
+func G() {
+       if F(func() int { return 1 }()); false {
+       }
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue24173.go b/gcc/testsuite/go.test/test/fixedbugs/issue24173.go
new file mode 100644 (file)
index 0000000..4c19e05
--- /dev/null
@@ -0,0 +1,19 @@
+// compile
+
+// Copyright 2018 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 arrayAlias = [10]int
+type mapAlias = map[int]int
+type sliceAlias = []int
+type structAlias = struct{}
+
+func Exported() {
+       _ = arrayAlias{}
+       _ = mapAlias{}
+       _ = sliceAlias{}
+       _ = structAlias{}
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue24187.go b/gcc/testsuite/go.test/test/fixedbugs/issue24187.go
new file mode 100644 (file)
index 0000000..45fc929
--- /dev/null
@@ -0,0 +1,33 @@
+// +build amd64p32
+// run
+
+// Copyright 2018 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 (
+       "bytes"
+       "fmt"
+       "unsafe"
+)
+
+func main() {
+       b := make([]byte, 128)
+       for i := range b {
+               b[i] = 1
+       }
+       if bytes.IndexByte(b, 0) != -1 {
+               panic("found 0")
+       }
+       for i := range b {
+               b[i] = 0
+               c := b
+               *(*int)(unsafe.Pointer(uintptr(unsafe.Pointer(&c)) + unsafe.Sizeof(uintptr(0)))) = 1<<31 - 1
+               if bytes.IndexByte(c, 0) != i {
+                       panic(fmt.Sprintf("missing 0 at %d\n", i))
+               }
+               b[i] = 1
+       }
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue24419.go b/gcc/testsuite/go.test/test/fixedbugs/issue24419.go
new file mode 100644 (file)
index 0000000..73b7783
--- /dev/null
@@ -0,0 +1,51 @@
+// run
+
+// Copyright 2018 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 (
+       "bytes"
+       "strings"
+)
+
+func growstack(n int) {
+       if n > 0 {
+               growstack(n - 1)
+       }
+}
+
+func main() {
+       c := make(chan struct{})
+       go compare(c)
+       go equal(c)
+       go indexByte(c)
+       go indexByteString(c)
+       <-c
+       <-c
+       <-c
+       <-c
+}
+
+func compare(c chan struct{}) {
+       defer bytes.Compare(nil, nil)
+       growstack(10000)
+       c <- struct{}{}
+}
+func equal(c chan struct{}) {
+       defer bytes.Equal(nil, nil)
+       growstack(10000)
+       c <- struct{}{}
+}
+func indexByte(c chan struct{}) {
+       defer bytes.IndexByte(nil, 0)
+       growstack(10000)
+       c <- struct{}{}
+}
+func indexByteString(c chan struct{}) {
+       defer strings.IndexByte("", 0)
+       growstack(10000)
+       c <- struct{}{}
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue24449.go b/gcc/testsuite/go.test/test/fixedbugs/issue24449.go
new file mode 100644 (file)
index 0000000..b236645
--- /dev/null
@@ -0,0 +1,62 @@
+// run
+
+// Copyright 2018 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 (
+       "sync/atomic"
+)
+
+var cnt32 int32
+
+//go:noinline
+func test32(a, b []int) bool {
+       // Try to generate flag value, issue atomic
+       // adds and then re-use the flag value to see if
+       // the atomic add has clobbered them.
+       atomic.AddInt32(&cnt32, 1)
+       if len(a) == len(b) {
+               atomic.AddInt32(&cnt32, 2)
+       }
+       atomic.AddInt32(&cnt32, 4)
+       if len(a) >= len(b) {
+               atomic.AddInt32(&cnt32, 8)
+       }
+       if len(a) <= len(b) {
+               atomic.AddInt32(&cnt32, 16)
+       }
+       return atomic.LoadInt32(&cnt32) == 31
+}
+
+var cnt64 int64
+
+//go:noinline
+func test64(a, b []int) bool {
+       // Try to generate flag value, issue atomic
+       // adds and then re-use the flag value to see if
+       // the atomic add has clobbered them.
+       atomic.AddInt64(&cnt64, 1)
+       if len(a) == len(b) {
+               atomic.AddInt64(&cnt64, 2)
+       }
+       atomic.AddInt64(&cnt64, 4)
+       if len(a) >= len(b) {
+               atomic.AddInt64(&cnt64, 8)
+       }
+       if len(a) <= len(b) {
+               atomic.AddInt64(&cnt64, 16)
+       }
+       return atomic.LoadInt64(&cnt64) == 31
+}
+
+func main() {
+       if !test32([]int{}, []int{}) {
+               panic("test32")
+       }
+       if !test64([]int{}, []int{}) {
+               panic("test64")
+       }
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue24470.go b/gcc/testsuite/go.test/test/fixedbugs/issue24470.go
new file mode 100644 (file)
index 0000000..d0e5e23
--- /dev/null
@@ -0,0 +1,15 @@
+// errorcheck
+
+// Copyright 2018 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.
+
+// Verify that we get "use of .(type) outside type switch"
+// before any other (misleading) errors. Test case from issue.
+
+package p
+
+func f(i interface{}) {
+       if x, ok := i.(type); ok { // ERROR "outside type switch"
+       }
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue24488.go b/gcc/testsuite/go.test/test/fixedbugs/issue24488.go
new file mode 100644 (file)
index 0000000..b3deab4
--- /dev/null
@@ -0,0 +1,38 @@
+// run
+
+// Copyright 2018 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"
+)
+
+type Func func()
+
+func (f Func) Foo() {
+       if f != nil {
+               f()
+       }
+}
+
+func (f Func) Bar() {
+       if f != nil {
+               f()
+       }
+       buf := make([]byte, 4000)
+       n := runtime.Stack(buf, true)
+       s := string(buf[:n])
+       if strings.Contains(s, "-fm") {
+               panic("wrapper present in stack trace:\n" + s)
+       }
+}
+
+func main() {
+       foo := Func(func() {})
+       foo = foo.Bar
+       foo.Foo()
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue24503.go b/gcc/testsuite/go.test/test/fixedbugs/issue24503.go
new file mode 100644 (file)
index 0000000..933ce70
--- /dev/null
@@ -0,0 +1,28 @@
+// run
+
+// Copyright 2018 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 24503: Handle == and != of addresses taken of symbols consistently.
+
+package main
+
+func test() string {
+       type test struct{}
+       o1 := test{}
+       o2 := test{}
+       if &o1 == &o2 {
+               return "equal"
+       }
+       if &o1 != &o2 {
+               return "unequal"
+       }
+       return "failed"
+}
+
+func main() {
+       if test() == "failed" {
+               panic("expected either 'equal' or 'unequal'")
+       }
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue24547.go b/gcc/testsuite/go.test/test/fixedbugs/issue24547.go
new file mode 100644 (file)
index 0000000..47d94a9
--- /dev/null
@@ -0,0 +1,46 @@
+// run
+
+// Copyright 2018 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.
+
+// When computing method sets with shadowed methods, make sure we
+// compute whether a method promotion involved a pointer traversal
+// based on the promoted method, not the shadowed method.
+
+package main
+
+import (
+       "bytes"
+       "fmt"
+)
+
+type mystruct struct {
+       f int
+}
+
+func (t mystruct) String() string {
+       return "FAIL"
+}
+
+func main() {
+       type deep struct {
+               mystruct
+       }
+       s := struct {
+               deep
+               *bytes.Buffer
+       }{
+               deep{},
+               bytes.NewBufferString("ok"),
+       }
+
+       if got := s.String(); got != "ok" {
+               panic(got)
+       }
+
+       var i fmt.Stringer = s
+       if got := i.String(); got != "ok" {
+               panic(got)
+       }
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue24760.go b/gcc/testsuite/go.test/test/fixedbugs/issue24760.go
new file mode 100644 (file)
index 0000000..cd6f124
--- /dev/null
@@ -0,0 +1,12 @@
+// compile
+
+// Copyright 2018 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
+
+import "unsafe"
+
+var _ = string([]byte(nil))[0]
+var _ = uintptr(unsafe.Pointer(uintptr(1))) << 100
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue24763.go b/gcc/testsuite/go.test/test/fixedbugs/issue24763.go
new file mode 100644 (file)
index 0000000..623ab48
--- /dev/null
@@ -0,0 +1,21 @@
+// run
+
+// Copyright 2018 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() {
+       var s uint
+       var x = interface{}(1<<s + 1<<s) // compiler must not crash here
+       if x.(int) != 2 {
+               panic("x not int or not 2")
+       }
+
+       var y interface{}
+       y = 1<<s + 1 // compiler must not crash here
+       if y.(int) != 2 {
+               panic("y not int or not 2")
+       }
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue24799.go b/gcc/testsuite/go.test/test/fixedbugs/issue24799.go
new file mode 100644 (file)
index 0000000..c805c86
--- /dev/null
@@ -0,0 +1,58 @@
+// run
+
+// Copyright 2018 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.
+
+// Loads of 8 byte go.strings cannot use DS relocation
+// in case the alignment is not a multiple of 4.
+
+package main
+
+import (
+        "fmt"
+)
+
+type Level string
+
+// The following are all go.strings. A link time error can
+// occur if an 8 byte load is used to load a go.string that is
+// not aligned to 4 bytes due to the type of relocation that
+// is generated for the instruction. A fix was made to avoid
+// generating an instruction with DS relocation for go.strings
+// since their alignment is not known until link time. 
+
+// This problem only affects go.string since other types have
+// correct alignment.
+
+const (
+        LevelBad Level = "badvals"
+        LevelNone Level = "No"
+        LevelMetadata Level = "Metadata"
+        LevelRequest Level = "Request"
+        LevelRequestResponse Level = "RequestResponse"
+)
+
+func ordLevel(l Level) int {
+        switch l {
+        case LevelMetadata:
+                return 1
+        case LevelRequest:
+                return 2
+        case LevelRequestResponse:
+                return 3
+        default:
+                return 0
+        }
+}
+
+//go:noinline
+func test(l Level) {
+        if ordLevel(l) < ordLevel(LevelMetadata) {
+                fmt.Printf("OK\n")
+        }
+}
+
+func main() {
+        test(LevelMetadata)
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue24801.dir/a.go b/gcc/testsuite/go.test/test/fixedbugs/issue24801.dir/a.go
new file mode 100644 (file)
index 0000000..58e6240
--- /dev/null
@@ -0,0 +1,9 @@
+// Copyright 2018 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
+
+type main int
+
+var X main
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue24801.dir/main.go b/gcc/testsuite/go.test/test/fixedbugs/issue24801.dir/main.go
new file mode 100644 (file)
index 0000000..5c7db7b
--- /dev/null
@@ -0,0 +1,11 @@
+// Copyright 2018 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 "./a"
+
+func main() {
+       a.X = 1
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue24801.go b/gcc/testsuite/go.test/test/fixedbugs/issue24801.go
new file mode 100644 (file)
index 0000000..9b05db8
--- /dev/null
@@ -0,0 +1,5 @@
+// compiledir
+
+// Copyright 2018 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.
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue24817.go b/gcc/testsuite/go.test/test/fixedbugs/issue24817.go
new file mode 100644 (file)
index 0000000..ba2a138
--- /dev/null
@@ -0,0 +1,64 @@
+// run
+
+// Copyright 2018 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 all ways to compare a non-constant string to the empty string.
+
+package main
+
+import (
+       "fmt"
+       "os"
+)
+
+var (
+       s      = "abc"
+       e      = ""
+       failed bool
+)
+
+func main() {
+       want(true, "" < s, `"" < s`)
+       want(false, s < "", `s < ""`)
+       want(false, "" < e, `"" < e`)
+       want(false, e < "", `e < ""`)
+
+       want(true, "" <= s, `"" <= s`)
+       want(false, s <= "", `s <= ""`)
+       want(true, "" <= e, `"" <= e`)
+       want(true, e <= "", `e <= ""`)
+
+       want(false, "" > s, `"" > s`)
+       want(true, s > "", `s > ""`)
+       want(false, "" > e, `"" > e`)
+       want(false, e > "", `e > ""`)
+
+       want(false, "" >= s, `"" >= s`)
+       want(true, s >= "", `s >= ""`)
+       want(true, "" >= e, `"" >= e`)
+       want(true, e >= "", `e >= ""`)
+
+       want(false, "" == s, `"" == s`)
+       want(false, s == "", `s == ""`)
+       want(true, "" == e, `"" == e`)
+       want(true, e == "", `e == ""`)
+
+       want(true, "" != s, `"" != s`)
+       want(true, s != "", `s != ""`)
+       want(false, "" != e, `"" != e`)
+       want(false, e != "", `e != ""`)
+
+       if failed {
+               os.Exit(1)
+       }
+}
+
+//go:noinline
+func want(b bool, have bool, msg string) {
+       if b != have {
+               fmt.Println(msg)
+               failed = true
+       }
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue24937.go b/gcc/testsuite/go.test/test/fixedbugs/issue24937.go
new file mode 100644 (file)
index 0000000..7d8460f
--- /dev/null
@@ -0,0 +1,15 @@
+// run
+
+// Copyright 2018 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 := []byte{'a'}
+       switch string(x) {
+       case func() string { x[0] = 'b'; return "b" }():
+               panic("FAIL")
+       }
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue24939.go b/gcc/testsuite/go.test/test/fixedbugs/issue24939.go
new file mode 100644 (file)
index 0000000..0ae6f2b
--- /dev/null
@@ -0,0 +1,23 @@
+// compile
+
+// Copyright 2018 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 interface {
+       M(P)
+}
+
+type M interface {
+       F() P
+}
+
+type P = interface {
+       // The compiler cannot handle this case. Disabled for now.
+       // See issue #25838.
+       // I() M
+}
+
+func main() {}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue25006.go b/gcc/testsuite/go.test/test/fixedbugs/issue25006.go
new file mode 100644 (file)
index 0000000..570fdca
--- /dev/null
@@ -0,0 +1,30 @@
+// compile
+
+// Copyright 2018 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
+
+func spin() {
+       var i int
+       var b bool
+
+       switch 1 {
+       case 0:
+               i = 1
+       }
+       switch 1 {
+       case i:
+       default:
+               i = 1
+               b = !b && (b && !b) && b
+       }
+       switch false {
+       case false:
+               i = 3 + -i
+               switch 0 {
+               case 1 - i:
+               }
+       }
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue25101.go b/gcc/testsuite/go.test/test/fixedbugs/issue25101.go
new file mode 100644 (file)
index 0000000..4fd6bed
--- /dev/null
@@ -0,0 +1,16 @@
+// compile
+
+// Copyright 2018 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.
+
+// Indexed export format must not crash when writing
+// the anonymous parameter for m.
+
+package p
+
+var x interface {
+       m(int)
+}
+
+var M = x.m
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue25322.go b/gcc/testsuite/go.test/test/fixedbugs/issue25322.go
new file mode 100644 (file)
index 0000000..ee4ff53
--- /dev/null
@@ -0,0 +1,23 @@
+// run
+
+// Copyright 2018 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.
+
+// Missing zero extension when converting a float32
+// to a uint64.
+
+package main
+
+import (
+       "fmt"
+       "math"
+)
+
+func Foo(v float32) {
+       fmt.Printf("%x\n", uint64(math.Float32bits(v)))
+}
+
+func main() {
+       Foo(2.0)
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue25322.out b/gcc/testsuite/go.test/test/fixedbugs/issue25322.out
new file mode 100644 (file)
index 0000000..52f3f6a
--- /dev/null
@@ -0,0 +1 @@
+40000000
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue25507.go b/gcc/testsuite/go.test/test/fixedbugs/issue25507.go
new file mode 100644 (file)
index 0000000..9143a73
--- /dev/null
@@ -0,0 +1,29 @@
+// errorcheck
+
+// Copyright 2018 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.
+
+// We have a limit of 1GB for stack frames.
+// Test that we extend that limit to include large argument/return areas.
+// Argument/return areas are part of the parent frame, not the frame itself,
+// so they need to be handled separately.
+
+package main
+
+// >1GB to trigger failure, <2GB to work on 32-bit platforms.
+type large struct {
+       b [1500000000]byte
+}
+
+func (x large) f1() int { // GC_ERROR "stack frame too large"
+       return 5
+}
+
+func f2(x large) int { // GC_ERROR "stack frame too large"
+       return 5
+}
+
+func f3() (x large, i int) { // GC_ERROR "stack frame too large"
+       return
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue25516.go b/gcc/testsuite/go.test/test/fixedbugs/issue25516.go
new file mode 100644 (file)
index 0000000..8326ef9
--- /dev/null
@@ -0,0 +1,26 @@
+// compile
+
+// Copyright 2018 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.
+
+// Make sure dead write barriers are handled correctly.
+
+package main
+
+func f(p **int) {
+       // The trick here is to eliminate the block containing the write barrier,
+       // but only after the write barrier branches are inserted.
+       // This requires some delicate code.
+       i := 0
+       var b []bool
+       var s string
+       for true {
+               if b[i] {
+                       var a []string
+                       s = a[len(s)]
+                       i = 0
+               }
+               *p = nil
+       }
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue25727.go b/gcc/testsuite/go.test/test/fixedbugs/issue25727.go
new file mode 100644 (file)
index 0000000..936b9f8
--- /dev/null
@@ -0,0 +1,21 @@
+// errorcheck
+
+// Copyright 2018 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 "net/http"
+
+var s = http.Server{}
+var _ = s.doneChan                  // ERROR "s.doneChan undefined .cannot refer to unexported field or method doneChan.$|unexported field or method"
+var _ = s.DoneChan                  // ERROR "s.DoneChan undefined .type http.Server has no field or method DoneChan.$|undefined field or method"
+var _ = http.Server{tlsConfig: nil} // ERROR "unknown field 'tlsConfig' in struct literal.+ .but does have TLSConfig.$|unknown field .?tlsConfig.? in .?http.Server"
+var _ = http.Server{DoneChan: nil}  // ERROR "unknown field 'DoneChan' in struct literal of type http.Server$|unknown field .?DoneChan.? in .?http.Server"
+
+type foo struct {
+       bar int
+}
+
+var _ = &foo{bAr: 10} // ERROR "unknown field 'bAr' in struct literal.+ .but does have bar.$|unknown field .?bAr.? in .?foo"
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue25741.go b/gcc/testsuite/go.test/test/fixedbugs/issue25741.go
new file mode 100644 (file)
index 0000000..c76e975
--- /dev/null
@@ -0,0 +1,14 @@
+// compile
+
+// Copyright 2018 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 s []int
+
+func main() {
+       i := -1
+       s[i] = 0
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue25776.go b/gcc/testsuite/go.test/test/fixedbugs/issue25776.go
new file mode 100644 (file)
index 0000000..e05c0bc
--- /dev/null
@@ -0,0 +1,99 @@
+// run
+
+// Copyright 2018 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
+
+const (
+       Upper       = true
+       blas_Upper  = 121
+       badTriangle = "bad triangle"
+)
+
+// Triangular represents a triangular matrix. Triangular matrices are always square.
+type Triangular interface {
+       // Triangular returns the number of rows/columns in the matrix and its
+       // orientation.
+       Tryangle() (mmmm int, kynd bool)
+       Triangle() (mmmm int, kynd bool)
+}
+
+// blas64_Triangular represents a triangular matrix using the conventional storage scheme.
+type blas64_Triangular struct {
+       Stride int
+       Uplo   int
+}
+
+// TriDense represents an upper or lower triangular matrix in dense storage
+// format.
+type TriDense struct {
+       mat blas64_Triangular
+}
+
+func NewTriDense() *TriDense {
+       return &TriDense{
+               mat: blas64_Triangular{
+                       Stride: 3,
+                       Uplo:   blas_Upper,
+               },
+       }
+}
+
+func (t *TriDense) isUpper() bool {
+       return isUpperUplo(t.mat.Uplo)
+}
+
+func (t *TriDense) triKind() bool {
+       return isUpperUplo(t.mat.Uplo)
+}
+
+func isUpperUplo(u int) bool {
+       switch u {
+       case blas_Upper:
+               return true
+       default:
+               panic(badTriangle)
+       }
+}
+
+func (t *TriDense) IsZero() bool {
+       return t.mat.Stride == 0
+}
+
+//go:noinline
+func (t *TriDense) ScaleTri(f float64, a Triangular) {
+       n, kind := a.Triangle()
+       if kind == false {
+               println("ScaleTri n, kind=", n, ", ", kind, " (FAIL, expected true)")
+       }
+}
+
+//go:noinline
+func (t *TriDense) ScaleTry(f float64, a Triangular) {
+       n, kind := a.Tryangle()
+       if kind == false {
+               println("ScaleTry n, kind=", n, ", ", kind, " (FAIL, expected true)")
+       }
+}
+
+// Triangle failed (before fix)
+func (t *TriDense) Triangle() (nnnn int, kind bool) {
+       return 3, !t.IsZero() && t.triKind()
+}
+
+// Tryangle works -- difference is not-named output parameters.
+func (t *TriDense) Tryangle() (int, bool) {
+       return 3, !t.IsZero() && t.triKind()
+}
+
+func main() {
+       ta := NewTriDense()
+       n, kind := ta.Triangle()
+       if kind == false {
+               println("    main n, kind=", n, ", ", kind, " (FAIL, expected true)")
+       }
+       ta.ScaleTri(1, ta)
+       ta.ScaleTry(1, ta)
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue25897a.go b/gcc/testsuite/go.test/test/fixedbugs/issue25897a.go
new file mode 100644 (file)
index 0000000..6a724a7
--- /dev/null
@@ -0,0 +1,34 @@
+// run
+
+// Copyright 2019 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.
+
+// Make sure the runtime can scan args of an unstarted goroutine
+// which starts with a reflect-generated function.
+
+package main
+
+import (
+       "reflect"
+       "runtime"
+)
+
+const N = 100
+
+func main() {
+       runtime.GOMAXPROCS(1)
+       c := make(chan bool, N)
+       for i := 0; i < N; i++ {
+               f := reflect.MakeFunc(reflect.TypeOf(((func(*int))(nil))),
+                       func(args []reflect.Value) []reflect.Value {
+                               c <- true
+                               return nil
+                       }).Interface().(func(*int))
+               go f(nil)
+       }
+       runtime.GC()
+       for i := 0; i < N; i++ {
+               <-c
+       }
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue25897b.go b/gcc/testsuite/go.test/test/fixedbugs/issue25897b.go
new file mode 100644 (file)
index 0000000..09a9673
--- /dev/null
@@ -0,0 +1,38 @@
+// run
+
+// Copyright 2019 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.
+
+// Make sure the runtime can scan args of an unstarted goroutine
+// which starts with a reflect-generated function.
+
+package main
+
+import (
+       "reflect"
+       "runtime"
+)
+
+const N = 100
+
+type T struct {
+}
+
+func (t *T) Foo(c chan bool) {
+       c <- true
+}
+
+func main() {
+       t := &T{}
+       runtime.GOMAXPROCS(1)
+       c := make(chan bool, N)
+       for i := 0; i < N; i++ {
+               f := reflect.ValueOf(t).MethodByName("Foo").Interface().(func(chan bool))
+               go f(c)
+       }
+       runtime.GC()
+       for i := 0; i < N; i++ {
+               <-c
+       }
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue25958.go b/gcc/testsuite/go.test/test/fixedbugs/issue25958.go
new file mode 100644 (file)
index 0000000..90fcee1
--- /dev/null
@@ -0,0 +1,17 @@
+// errorcheck
+
+// Copyright 2018 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
+
+// Verify that the "must be receive" error for "case done:" appears
+// on the line of the case clause, not the line of the done declaration.
+
+func f(done chan struct{}) {
+       select {
+       case done: // ERROR "must be receive|expected .*<-.* or .*=" "not used"
+       case (chan struct{})(done): // ERROR "must be receive|expected .*<-.* or .*="
+       }
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue25984.dir/p.go b/gcc/testsuite/go.test/test/fixedbugs/issue25984.dir/p.go
new file mode 100644 (file)
index 0000000..306d6a4
--- /dev/null
@@ -0,0 +1,15 @@
+// Copyright 2018 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 m struct {
+       link *m
+}
+
+var head *m
+
+func F(m *int) bool {
+       return head != nil
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue25984.dir/q.go b/gcc/testsuite/go.test/test/fixedbugs/issue25984.dir/q.go
new file mode 100644 (file)
index 0000000..64d2587
--- /dev/null
@@ -0,0 +1,11 @@
+// Copyright 2018 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 q
+
+import "./p"
+
+func G() {
+       p.F(nil)
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue25984.go b/gcc/testsuite/go.test/test/fixedbugs/issue25984.go
new file mode 100644 (file)
index 0000000..128cf9d
--- /dev/null
@@ -0,0 +1,7 @@
+// compiledir
+
+// Copyright 2018 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/issue26024.go b/gcc/testsuite/go.test/test/fixedbugs/issue26024.go
new file mode 100644 (file)
index 0000000..78877b2
--- /dev/null
@@ -0,0 +1,28 @@
+// compile
+// Copyright 2018 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 r
+
+// f compiles into code where no stores remain in the two successors
+// of a write barrier block; i.e., they are empty. Pre-fix, this
+// results in an unexpected input to markUnsafePoints, that expects to
+// see a pair of non-empty plain blocks.
+func f() {
+       var i int
+       var s string
+       for len(s) < len(s) {
+               i++
+               s = "a"
+       }
+       var b bool
+       var sa []string
+       for true {
+               sa = []string{""}
+               for b || i == 0 {
+               }
+               b = !b
+               _ = sa
+       }
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue26043.go b/gcc/testsuite/go.test/test/fixedbugs/issue26043.go
new file mode 100644 (file)
index 0000000..fe32947
--- /dev/null
@@ -0,0 +1,32 @@
+// compile
+
+// Copyright 2018 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.
+
+// This program results in a loop inferred to increment
+// j by 0, causing bounds check elimination to attempt
+// something%0, which panics (in the bug).
+
+package q
+
+func f() {
+       var s1 string
+       var b bool
+       if b {
+               b = !b
+               s1 += "a"
+       }
+
+       var s2 string
+       var i, j int
+       if (s1 <= "") || (s2 >= "") {
+               j = len(s1[:6])
+       } else {
+               i = len("b")
+       }
+
+       for j < 0 {
+               j += i
+       }
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue26097.go b/gcc/testsuite/go.test/test/fixedbugs/issue26097.go
new file mode 100644 (file)
index 0000000..eedd6ba
--- /dev/null
@@ -0,0 +1,47 @@
+// run
+
+// Copyright 2018 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
+
+//go:noinline
+func cmovClobberAX64(v1, v2 int64, x1, x2 float64) int64 {
+       r := v1
+       if x1 == x2 {
+               r = v2
+       }
+       return r
+}
+
+//go:noinline
+func cmovClobberAX32(v1, v2 int32, x1, x2 float64) int32 {
+       r := v1
+       if x1 == x2 {
+               r = v2
+       }
+       return r
+}
+
+//go:noinline
+func cmovClobberAX16(v1, v2 int16, x1, x2 float64) int16 {
+       r := v1
+       if x1 == x2 {
+               r = v2
+       }
+       return r
+}
+
+func main() {
+       if cmovClobberAX16(1, 2, 4.0, 5.0) != 1 {
+               panic("CMOVQEQF causes incorrect code")
+       }
+       if cmovClobberAX32(1, 2, 4.0, 5.0) != 1 {
+               panic("CMOVQEQF causes incorrect code")
+       }
+       if cmovClobberAX64(1, 2, 4.0, 5.0) != 1 {
+               panic("CMOVQEQF causes incorrect code")
+       }
+
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue26105.go b/gcc/testsuite/go.test/test/fixedbugs/issue26105.go
new file mode 100644 (file)
index 0000000..88a5f16
--- /dev/null
@@ -0,0 +1,25 @@
+// compile
+
+// Copyright 2018 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.
+
+// Triggers a bug in writebarrier, which inserts one
+// between (first block) OpAddr x and (second block) a VarDef x,
+// which are then in the wrong order and unable to be
+// properly scheduled.
+
+package q
+
+var S interface{}
+
+func F(n int) {
+       fun := func(x int) int {
+               S = 1
+               return n
+       }
+       i := fun(([]int{})[n])
+
+       var fc [2]chan int
+       S = (([1][2]chan int{fc})[i][i])
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue26116.go b/gcc/testsuite/go.test/test/fixedbugs/issue26116.go
new file mode 100644 (file)
index 0000000..8a63481
--- /dev/null
@@ -0,0 +1,18 @@
+// run
+
+// Copyright 2018 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() {
+       s := []int{0, 1, 2}
+       i := 1
+       for i > 0 && s[i] != 2 {
+               i++
+       }
+       if i != 2 {
+               panic("loop didn't run")
+       }
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue26120.go b/gcc/testsuite/go.test/test/fixedbugs/issue26120.go
new file mode 100644 (file)
index 0000000..94bf7d9
--- /dev/null
@@ -0,0 +1,23 @@
+// compile
+
+// Copyright 2018 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 26120: INDEX of 1-element but non-SSAable array
+// is mishandled when building SSA.
+
+package p
+
+type T [1]struct {
+       f    []int
+       i, j int
+}
+
+func F() {
+       var v T
+       f := func() T {
+               return v
+       }
+       _ = []int{}[f()[0].i]
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue26153.go b/gcc/testsuite/go.test/test/fixedbugs/issue26153.go
new file mode 100644 (file)
index 0000000..53f53cf
--- /dev/null
@@ -0,0 +1,29 @@
+// run
+
+// Copyright 2018 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 26153. The write to ps was incorrectly
+// removed by the dead auto elimination pass.
+
+package main
+
+const hello = "hello world"
+
+func main() {
+       var s string
+       mangle(&s)
+       if s != hello {
+               panic("write incorrectly elided")
+       }
+}
+
+//go:noinline
+func mangle(ps *string) {
+       if ps == nil {
+               var s string
+               ps = &s
+       }
+       *ps = hello
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue26248.go b/gcc/testsuite/go.test/test/fixedbugs/issue26248.go
new file mode 100644 (file)
index 0000000..2f04e48
--- /dev/null
@@ -0,0 +1,39 @@
+// run
+
+// Copyright 2018 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 26248: gccgo miscompiles interface field expression.
+// In G().M where G returns an interface, G() is evaluated twice.
+
+package main
+
+type I interface {
+       M()
+}
+
+type T struct{}
+
+func (T) M() {}
+
+var g = 0
+
+//go:noinline
+func G() I {
+       g++
+       return T{}
+}
+
+//go:noinline
+func Use(interface{}) {}
+
+func main() {
+       x := G().M
+       Use(x)
+
+       if g != 1 {
+               println("want 1, got", g)
+               panic("FAIL")
+       }
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue26341.dir/a.go b/gcc/testsuite/go.test/test/fixedbugs/issue26341.dir/a.go
new file mode 100644 (file)
index 0000000..4fd23c7
--- /dev/null
@@ -0,0 +1,11 @@
+// Copyright 2018 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
+
+type k int
+
+func (k) F() {}
+
+type M map[k]int
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue26341.dir/b.go b/gcc/testsuite/go.test/test/fixedbugs/issue26341.dir/b.go
new file mode 100644 (file)
index 0000000..30b8c25
--- /dev/null
@@ -0,0 +1,13 @@
+// Copyright 2018 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
+
+import "./a"
+
+func f() {
+       for k := range (a.M{}) {
+               k.F()
+       }
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue26341.go b/gcc/testsuite/go.test/test/fixedbugs/issue26341.go
new file mode 100644 (file)
index 0000000..128cf9d
--- /dev/null
@@ -0,0 +1,7 @@
+// compiledir
+
+// Copyright 2018 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/issue26407.go b/gcc/testsuite/go.test/test/fixedbugs/issue26407.go
new file mode 100644 (file)
index 0000000..aa8e79c
--- /dev/null
@@ -0,0 +1,58 @@
+// run
+
+// Copyright 2018 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 26407: ensure that stack variables which have
+// had their address taken and then used in a comparison,
+// but are otherwise unused, are cleared.
+
+package main
+
+func main() {
+       poison()
+       test()
+}
+
+//go:noinline
+func poison() {
+       // initialise the stack with invalid pointers
+       var large [256]uintptr
+       for i := range large {
+               large[i] = 1
+       }
+       use(large[:])
+}
+
+//go:noinline
+func test() {
+       a := 2
+       x := &a
+       if x != compare(&x) {
+               panic("not possible")
+       }
+}
+
+//go:noinline
+func compare(x **int) *int {
+       var y *int
+       if x == &y {
+               panic("not possible")
+       }
+       // grow the stack to trigger a check for invalid pointers
+       grow()
+       if x == &y {
+               panic("not possible")
+       }
+       return *x
+}
+
+//go:noinline
+func grow() {
+       var large [1 << 16]uintptr
+       use(large[:])
+}
+
+//go:noinline
+func use(_ []uintptr) { }
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue26411.go b/gcc/testsuite/go.test/test/fixedbugs/issue26411.go
new file mode 100644 (file)
index 0000000..5f40bf2
--- /dev/null
@@ -0,0 +1,92 @@
+// +build !nacl,!js
+// run
+
+// Copyright 2018 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.
+
+// Ensure that label redefinition errors print out
+// a column number that matches the start of the current label's
+// definition instead of the label delimiting token ":"
+
+package main
+
+import (
+       "bytes"
+       "fmt"
+       "io/ioutil"
+       "log"
+       "os"
+       "os/exec"
+       "path/filepath"
+       "regexp"
+)
+
+func main() {
+       tmpdir, err := ioutil.TempDir("", "issue26411")
+       if err != nil {
+               log.Fatalf("Failed to create temporary directory: %v", err)
+       }
+       defer os.RemoveAll(tmpdir)
+
+       tests := []struct {
+               code   string
+               errors []string
+       }{
+               {
+                       code: `
+package main
+
+func main() {
+foo:
+foo:
+}
+`,
+                       errors: []string{
+                               "^.+:5:1: label foo defined and not used\n",
+                               ".+:6:1: label foo already defined at .+:5:1\n$",
+                       },
+               },
+               {
+                       code: `
+package main
+
+func main() {
+
+            bar:
+   bar:
+bar:
+bar            :
+}
+`,
+
+                       errors: []string{
+                               "^.+:6:13: label bar defined and not used\n",
+                               ".+:7:4: label bar already defined at .+:6:13\n",
+                               ".+:8:1: label bar already defined at .+:6:13\n",
+                               ".+:9:1: label bar already defined at .+:6:13\n$",
+                       },
+               },
+       }
+
+       for i, test := range tests {
+               filename := filepath.Join(tmpdir, fmt.Sprintf("%d.go", i))
+               if err := ioutil.WriteFile(filename, []byte(test.code), 0644); err != nil {
+                       log.Printf("#%d: failed to create file %s", i, filename)
+                       continue
+               }
+               output, _ := exec.Command("go", "tool", "compile", filename).CombinedOutput()
+
+               // remove each matching error from the output
+               for _, err := range test.errors {
+                       rx := regexp.MustCompile(err)
+                       match := rx.Find(output)
+                       output = bytes.Replace(output, match, nil, 1) // remove match (which might be nil) from output
+               }
+
+               // at this point all output should have been consumed
+               if len(output) != 0 {
+                       log.Printf("Test case %d has unmatched errors:\n%s", i, output)
+               }
+       }
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue26416.go b/gcc/testsuite/go.test/test/fixedbugs/issue26416.go
new file mode 100644 (file)
index 0000000..44a4fc7
--- /dev/null
@@ -0,0 +1,27 @@
+// errorcheck
+
+// Copyright 2018 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 {
+       t1f1 int
+       t1f2 int
+}
+type t2 struct {
+       t2f1 int
+       t2f2 int
+       *t1
+}
+type t3 struct {
+       t3f1 int
+       *t2
+}
+
+var (
+       _ = t2{t1f1: 600} // ERROR "cannot use promoted field t1.t1f1 in struct literal of type t2|unknown field"
+       _ = t3{t1f2: 800} // ERROR "cannot use promoted field t2.t1.t1f2 in struct literal of type t3|unknown field"
+       _ = t3{t2f1: 900} // ERROR "cannot use promoted field t2.t2f1 in struct literal of type t3|unknown field"
+)
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue26438.go b/gcc/testsuite/go.test/test/fixedbugs/issue26438.go
new file mode 100644 (file)
index 0000000..d44da21
--- /dev/null
@@ -0,0 +1,26 @@
+// run
+
+// Copyright 2018 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 26438: arm64 backend may use 64-bit TST for
+// "if uint32(a)&uint32(b) == 0", which should be
+// 32-bit TSTW
+
+package main
+
+//go:noinline
+func tstw(a, b uint64) uint64 {
+       if uint32(a)&uint32(b) == 0 {
+               return 100
+       } else {
+               return 200
+       }
+}
+
+func main() {
+       if tstw(0xff00000000, 0xaa00000000) == 200 {
+               panic("impossible")
+       }
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue26495.go b/gcc/testsuite/go.test/test/fixedbugs/issue26495.go
new file mode 100644 (file)
index 0000000..11ea360
--- /dev/null
@@ -0,0 +1,36 @@
+// run
+
+// Copyright 2018 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 26495: gccgo produces incorrect order of evaluation
+// for expressions involving &&, || subexpressions.
+
+package main
+
+var i int
+
+func checkorder(order int) {
+       if i != order {
+               panic("FAIL: wrong evaluation order")
+       }
+       i++
+}
+
+func A() bool              { checkorder(1); return true }
+func B() bool              { checkorder(2); return true }
+func C() bool              { checkorder(5); return false }
+func D() bool              { panic("FAIL: D should not be called") }
+func E() int               { checkorder(3); return 0 }
+func F() int               { checkorder(0); return 0 }
+func G(bool) int           { checkorder(9); return 0 }
+func H(int, bool, int) int { checkorder(7); return 0 }
+func I(int) bool           { checkorder(8); return true }
+func J() int               { checkorder(4); return 0 }
+func K() int               { checkorder(6); return 0 }
+func L() int               { checkorder(10); return 0 }
+
+func main() {
+       _ = F() + G(A() && B() && I(E()+H(J(), C() && D(), K()))) + L()
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue26616.go b/gcc/testsuite/go.test/test/fixedbugs/issue26616.go
new file mode 100644 (file)
index 0000000..87c0293
--- /dev/null
@@ -0,0 +1,20 @@
+// errorcheck
+
+// Copyright 2018 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
+
+var x int = three() // ERROR "assignment mismatch: 1 variable but three returns 3 values|multiple-value function call in single-value context"
+
+func f() {
+       var _ int = three() // ERROR "assignment mismatch: 1 variable but three returns 3 values|multiple-value function call in single-value context"
+       var a int = three() // ERROR "assignment mismatch: 1 variable but three returns 3 values|multiple-value function call in single-value context"
+       a = three()         // ERROR "assignment mismatch: 1 variable but three returns 3 values|multiple-value function call in single-value context"
+       b := three()        // ERROR "assignment mismatch: 1 variable but three returns 3 values|single variable set to multiple-value|multiple-value function call in single-value context"
+
+       _, _ = a, b
+}
+
+func three() (int, int, int)
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue26855.go b/gcc/testsuite/go.test/test/fixedbugs/issue26855.go
new file mode 100644 (file)
index 0000000..b965635
--- /dev/null
@@ -0,0 +1,28 @@
+// errorcheck
+
+// Copyright 2012 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.
+
+// Verify that we get the correct (T vs &T) literal specification
+// in the error message.
+
+package p
+
+type S struct {
+       f T
+}
+
+type P struct {
+       f *T
+}
+
+type T struct{}
+
+var _ = S{
+       f: &T{}, // ERROR "cannot use &T{}|incompatible type"
+}
+
+var _ = P{
+       f: T{}, // ERROR "cannot use T{}|incompatible type"
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue27143.go b/gcc/testsuite/go.test/test/fixedbugs/issue27143.go
new file mode 100644 (file)
index 0000000..009ec9f
--- /dev/null
@@ -0,0 +1,17 @@
+// compile
+
+// Copyright 2018 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 27143: cmd/compile: erroneous application of walkinrange
+// optimization for const over 2**63
+
+package p
+
+var c uint64
+
+var b1 bool = 0x7fffffffffffffff < c && c < 0x8000000000000000
+var b2 bool = c < 0x8000000000000000 && 0x7fffffffffffffff < c
+var b3 bool = 0x8000000000000000 < c && c < 0x8000000000000001
+var b4 bool = c < 0x8000000000000001 && 0x8000000000000000 < c
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue27232.go b/gcc/testsuite/go.test/test/fixedbugs/issue27232.go
new file mode 100644 (file)
index 0000000..3a1cc87
--- /dev/null
@@ -0,0 +1,19 @@
+// compile
+
+// Copyright 2018 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 F = func(T)
+
+type T interface {
+       m(F)
+}
+
+type t struct{}
+
+func (t) m(F) {}
+
+var _ T = &t{}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue27267.go b/gcc/testsuite/go.test/test/fixedbugs/issue27267.go
new file mode 100644 (file)
index 0000000..ebae44f
--- /dev/null
@@ -0,0 +1,21 @@
+// compile
+
+// Copyright 2018 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
+
+// 1st test case from issue
+type F = func(E) // compiles if not type alias or moved below E struct
+type E struct {
+       f F
+}
+
+var x = E{func(E) {}}
+
+// 2nd test case from issue
+type P = *S
+type S struct {
+       p P
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue27278.go b/gcc/testsuite/go.test/test/fixedbugs/issue27278.go
new file mode 100644 (file)
index 0000000..73f7c75
--- /dev/null
@@ -0,0 +1,63 @@
+// run
+
+// Copyright 2018 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 27278: dead auto elim deletes an auto and its
+// initialization, but it is live because of a nil check.
+
+package main
+
+type T struct {
+       _ [3]string
+       T2
+}
+
+func (t *T) M() []string {
+       return t.T2.M()
+}
+
+type T2 struct {
+       T3
+}
+
+func (t *T2) M() []string {
+       return t.T3.M()
+}
+
+type T3 struct {
+       a string
+}
+
+func (t *T3) M() []string {
+       return []string{}
+}
+
+func main() {
+       poison()
+       f()
+}
+
+//go:noinline
+func f() {
+       (&T{}).M()
+       grow(10000)
+}
+
+// grow stack, triggers stack copy
+func grow(n int) {
+       if n == 0 {
+               return
+       }
+       grow(n-1)
+}
+
+// put some junk on stack, which cannot be valid address
+//go:noinline
+func poison() {
+       x := [10]int{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}
+       g = x
+}
+
+var g [10]int
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue27289.go b/gcc/testsuite/go.test/test/fixedbugs/issue27289.go
new file mode 100644 (file)
index 0000000..293b9d0
--- /dev/null
@@ -0,0 +1,24 @@
+// run
+
+// Copyright 2018 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.
+
+// Make sure we don't prove that the bounds check failure branch is unreachable.
+
+package main
+
+//go:noinline
+func f(a []int) {
+       _ = a[len(a)-1]
+}
+
+func main() {
+       defer func() {
+               if err := recover(); err != nil {
+                       return
+               }
+               panic("f should panic")
+       }()
+       f(nil)
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue27356.go b/gcc/testsuite/go.test/test/fixedbugs/issue27356.go
new file mode 100644 (file)
index 0000000..c3e686d
--- /dev/null
@@ -0,0 +1,19 @@
+// errorcheck
+
+// Copyright 2018 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 27356: function parameter hiding built-in function results in compiler crash
+
+package p
+
+var a = []int{1,2,3}
+
+func _(len int) {
+       _ =  len(a) // ERROR "cannot call non-function|expected function"
+}
+
+var cap = false
+var _ = cap(a) // ERROR "cannot call non-function|expected function"
+
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue27695.go b/gcc/testsuite/go.test/test/fixedbugs/issue27695.go
new file mode 100644 (file)
index 0000000..8bd4939
--- /dev/null
@@ -0,0 +1,62 @@
+// run
+
+// Copyright 2018 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.
+
+// Make sure return values are always scanned, when
+// calling methods (+functions, TODO) with reflect.
+
+package main
+
+import (
+       "reflect"
+       "runtime/debug"
+       "sync"
+)
+
+func main() {
+       debug.SetGCPercent(1) // run GC frequently
+       var wg sync.WaitGroup
+       for i := 0; i < 20; i++ {
+               wg.Add(1)
+               go func() {
+                       defer wg.Done()
+                       for i := 0; i < 2000; i++ {
+                               _test()
+                       }
+               }()
+       }
+       wg.Wait()
+}
+
+type Stt struct {
+       Data interface{}
+}
+
+type My struct {
+       b byte
+}
+
+func (this *My) Run(rawData []byte) (Stt, error) {
+       var data string = "hello"
+       stt := Stt{
+               Data: data,
+       }
+       return stt, nil
+}
+
+func _test() (interface{}, error) {
+       f := reflect.ValueOf(&My{}).MethodByName("Run")
+       if method, ok := f.Interface().(func([]byte) (Stt, error)); ok {
+               s, e := method(nil)
+               // The bug in issue27695 happens here, during the return
+               // from the above call (at the end of reflect.callMethod
+               // when preparing to return). The result value that
+               // is assigned to s was not being scanned if GC happens
+               // to occur there.
+               i := interface{}(s)
+               return i, e
+       }
+       return nil, nil
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue27695b.go b/gcc/testsuite/go.test/test/fixedbugs/issue27695b.go
new file mode 100644 (file)
index 0000000..d80acfb
--- /dev/null
@@ -0,0 +1,64 @@
+// run
+
+// Copyright 2018 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.
+
+// Make sure return values aren't scanned until they
+// are initialized, when calling functions and methods
+// via reflect.
+
+package main
+
+import (
+       "reflect"
+       "runtime"
+       "unsafe"
+)
+
+var badPtr uintptr
+
+var sink []byte
+
+func init() {
+       // Allocate large enough to use largeAlloc.
+       b := make([]byte, 1<<16-1)
+       sink = b // force heap allocation
+       //  Any space between the object and the end of page is invalid to point to.
+       badPtr = uintptr(unsafe.Pointer(&b[len(b)-1])) + 1
+}
+
+func f(d func() *byte) *byte {
+       // Initialize callee args section with a bad pointer.
+       g(badPtr)
+
+       // Then call a function which returns a pointer.
+       // That return slot starts out holding a bad pointer.
+       return d()
+}
+
+//go:noinline
+func g(x uintptr) {
+}
+
+type T struct {
+}
+
+func (t *T) Foo() *byte {
+       runtime.GC()
+       return nil
+}
+
+func main() {
+       // Functions
+       d := reflect.MakeFunc(reflect.TypeOf(func() *byte { return nil }),
+               func(args []reflect.Value) []reflect.Value {
+                       runtime.GC()
+                       return []reflect.Value{reflect.ValueOf((*byte)(nil))}
+               }).Interface().(func() *byte)
+       f(d)
+
+       // Methods
+       e := reflect.ValueOf(&T{}).Method(0).Interface().(func() *byte)
+       f(e)
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue27695c.go b/gcc/testsuite/go.test/test/fixedbugs/issue27695c.go
new file mode 100644 (file)
index 0000000..948191c
--- /dev/null
@@ -0,0 +1,65 @@
+// run
+
+// Copyright 2018 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.
+
+// Make sure return values aren't scanned until they
+// are initialized, when calling functions and methods
+// via reflect.
+
+package main
+
+import (
+       "io"
+       "reflect"
+       "runtime"
+       "unsafe"
+)
+
+var badPtr uintptr
+
+var sink []byte
+
+func init() {
+       // Allocate large enough to use largeAlloc.
+       b := make([]byte, 1<<16-1)
+       sink = b // force heap allocation
+       //  Any space between the object and the end of page is invalid to point to.
+       badPtr = uintptr(unsafe.Pointer(&b[len(b)-1])) + 1
+}
+
+func f(d func(error) error) error {
+       // Initialize callee args section with a bad pointer.
+       g(badPtr, badPtr, badPtr, badPtr)
+
+       // Then call a function which returns a pointer.
+       // That return slot starts out holding a bad pointer.
+       return d(io.EOF)
+}
+
+//go:noinline
+func g(x, y, z, w uintptr) {
+}
+
+type T struct {
+}
+
+func (t *T) Foo(e error) error {
+       runtime.GC()
+       return e
+}
+
+func main() {
+       // Functions
+       d := reflect.MakeFunc(reflect.TypeOf(func(e error) error { return e }),
+               func(args []reflect.Value) []reflect.Value {
+                       runtime.GC()
+                       return args
+               }).Interface().(func(error) error)
+       f(d)
+
+       // Methods
+       x := reflect.ValueOf(&T{}).Method(0).Interface().(func(error) error)
+       f(x)
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue27718.go b/gcc/testsuite/go.test/test/fixedbugs/issue27718.go
new file mode 100644 (file)
index 0000000..ff616fb
--- /dev/null
@@ -0,0 +1,102 @@
+// run
+
+// Copyright 2018 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.
+
+// (-0)+0 should be 0, not -0.
+
+package main
+
+//go:noinline
+func add64(x float64) float64 {
+       return x + 0
+}
+
+func testAdd64() {
+       var zero float64
+       inf := 1.0 / zero
+       negZero := -1 / inf
+       if 1/add64(negZero) != inf {
+               panic("negZero+0 != posZero (64 bit)")
+       }
+}
+
+//go:noinline
+func sub64(x float64) float64 {
+       return x - 0
+}
+
+func testSub64() {
+       var zero float64
+       inf := 1.0 / zero
+       negZero := -1 / inf
+       if 1/sub64(negZero) != -inf {
+               panic("negZero-0 != negZero (64 bit)")
+       }
+}
+
+//go:noinline
+func neg64(x float64) float64 {
+       return -x
+}
+
+func testNeg64() {
+       var zero float64
+       inf := 1.0 / zero
+       negZero := -1 / inf
+       if 1/neg64(negZero) != inf {
+               panic("-negZero != posZero (64 bit)")
+       }
+}
+
+//go:noinline
+func add32(x float32) float32 {
+       return x + 0
+}
+
+func testAdd32() {
+       var zero float32
+       inf := 1.0 / zero
+       negZero := -1 / inf
+       if 1/add32(negZero) != inf {
+               panic("negZero+0 != posZero (32 bit)")
+       }
+}
+
+//go:noinline
+func sub32(x float32) float32 {
+       return x - 0
+}
+
+func testSub32() {
+       var zero float32
+       inf := 1.0 / zero
+       negZero := -1 / inf
+       if 1/sub32(negZero) != -inf {
+               panic("negZero-0 != negZero (32 bit)")
+       }
+}
+
+//go:noinline
+func neg32(x float32) float32 {
+       return -x
+}
+
+func testNeg32() {
+       var zero float32
+       inf := 1.0 / zero
+       negZero := -1 / inf
+       if 1/neg32(negZero) != inf {
+               panic("-negZero != posZero (32 bit)")
+       }
+}
+
+func main() {
+       testAdd64()
+       testSub64()
+       testNeg64()
+       testAdd32()
+       testSub32()
+       testNeg32()
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue27829.go b/gcc/testsuite/go.test/test/fixedbugs/issue27829.go
new file mode 100644 (file)
index 0000000..9204043
--- /dev/null
@@ -0,0 +1,27 @@
+// run
+
+// Copyright 2018 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.
+
+// Bad AND/BTR combination rule.
+
+package main
+
+import "fmt"
+
+//go:noinline
+func f(x uint64) uint64 {
+       return (x >> 48) &^ (uint64(0x4000))
+}
+
+func main() {
+       bad := false
+       if got, want := f(^uint64(0)), uint64(0xbfff); got != want {
+               fmt.Printf("got %x, want %x\n", got, want)
+               bad = true
+       }
+       if bad {
+               panic("bad")
+       }
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue27938.go b/gcc/testsuite/go.test/test/fixedbugs/issue27938.go
new file mode 100644 (file)
index 0000000..ed974e6
--- /dev/null
@@ -0,0 +1,23 @@
+// errorcheck
+
+// Copyright 2018 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.
+
+// Verify that we get a single non-confusing error
+// message for embedded fields/interfaces that use
+// a qualified identifier with non-existing package.
+
+package p
+
+type _ struct {
+       F sync.Mutex // ERROR "undefined: sync|expected package"
+}
+
+type _ struct {
+       sync.Mutex // ERROR "undefined: sync|expected package"
+}
+
+type _ interface {
+       sync.Mutex // ERROR "undefined: sync|expected package|expected signature or type name"
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue27961.go b/gcc/testsuite/go.test/test/fixedbugs/issue27961.go
new file mode 100644 (file)
index 0000000..f8b4f66
--- /dev/null
@@ -0,0 +1,35 @@
+// run
+
+// Copyright 2018 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 27961: some optimizations generate OffPtr with wrong
+// types, which causes invalid bytecode on Wasm.
+
+package main
+
+import "math"
+
+type Vec2 [2]float64
+
+func main() {
+       var a Vec2
+       a.A().B().C().D()
+}
+
+func (v Vec2) A() Vec2 {
+       return Vec2{v[0], v[0]}
+}
+
+func (v Vec2) B() Vec2 {
+       return Vec2{1.0 / v.D(), 0}
+}
+
+func (v Vec2) C() Vec2 {
+       return Vec2{v[0], v[0]}
+}
+
+func (v Vec2) D() float64 {
+       return math.Sqrt(v[0])
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue28055.go b/gcc/testsuite/go.test/test/fixedbugs/issue28055.go
new file mode 100644 (file)
index 0000000..d4889d5
--- /dev/null
@@ -0,0 +1,16 @@
+// compile
+
+// Copyright 2018 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.
+
+// Make sure VARDEF can be a top-level statement.
+
+package p
+
+func f() {
+       var s string
+       var as []string
+       switch false && (s+"a"+as[0]+s+as[0]+s == "") {
+       }
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue28058.go b/gcc/testsuite/go.test/test/fixedbugs/issue28058.go
new file mode 100644 (file)
index 0000000..d8206e7
--- /dev/null
@@ -0,0 +1,13 @@
+// errorcheck
+
+// Copyright 2018 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 14988: declaring a map with an invalid key type should not cause a
+//              fatal panic.
+
+package main
+
+var x map[func()]int // ERROR "invalid map key type"
+var X map[func()]int // ERROR "invalid map key type"
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue28078.go b/gcc/testsuite/go.test/test/fixedbugs/issue28078.go
new file mode 100644 (file)
index 0000000..2e4c4b5
--- /dev/null
@@ -0,0 +1,34 @@
+// compile
+
+// Copyright 2018 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.
+
+// Non-constant duplicate keys/cases should not be reported
+// as errors by the compiler.
+
+package p
+
+import "unsafe"
+
+func f() {
+       _ = map[uintptr]int{
+               0:                            0,
+               uintptr(unsafe.Pointer(nil)): 0,
+       }
+
+       switch uintptr(0) {
+       case 0:
+       case uintptr(unsafe.Pointer(nil)):
+       }
+
+       switch interface{}(nil) {
+       case nil:
+       case nil:
+       }
+
+       _ = map[interface{}]int{
+               nil: 0,
+               nil: 0,
+       }
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue28079a.go b/gcc/testsuite/go.test/test/fixedbugs/issue28079a.go
new file mode 100644 (file)
index 0000000..b0631bb
--- /dev/null
@@ -0,0 +1,20 @@
+// compile
+
+// Copyright 2018 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.
+
+// Non-Go-constant but constant indexes are ok at compile time.
+
+package p
+
+import "unsafe"
+
+func f() {
+       var x [0]int
+       x[uintptr(unsafe.Pointer(nil))] = 0
+}
+func g() {
+       var x [10]int
+       _ = x[3:uintptr(unsafe.Pointer(nil))]
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue28079b.go b/gcc/testsuite/go.test/test/fixedbugs/issue28079b.go
new file mode 100644 (file)
index 0000000..d1992e1
--- /dev/null
@@ -0,0 +1,17 @@
+// errorcheck
+
+// Copyright 2018 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.
+
+// Non-Go-constant but constant values aren't ok for array sizes.
+
+package p
+
+import "unsafe"
+
+type T [uintptr(unsafe.Pointer(nil))]int // ERROR "non-constant array bound|array bound is not constant"
+
+func f() {
+       _ = complex(1<<uintptr(unsafe.Pointer(nil)), 0) // GCCGO_ERROR "non-integer type for left operand of shift"
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue28079c.go b/gcc/testsuite/go.test/test/fixedbugs/issue28079c.go
new file mode 100644 (file)
index 0000000..dfac8d0
--- /dev/null
@@ -0,0 +1,15 @@
+// errorcheck
+
+// Copyright 2018 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.
+
+// Non-Go-constant but constant values aren't ok for shifts.
+
+package p
+
+import "unsafe"
+
+func f() {
+       _ = complex(1<<uintptr(unsafe.Pointer(nil)), 0) // ERROR "invalid operation: .*shift of type float64.*|non-integer type for left operand of shift"
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue28268.go b/gcc/testsuite/go.test/test/fixedbugs/issue28268.go
new file mode 100644 (file)
index 0000000..59a4c57
--- /dev/null
@@ -0,0 +1,30 @@
+// errorcheck
+
+// Copyright 2018 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.
+
+// Verify that follow-on errors due to conflicting
+// struct field and method names are suppressed.
+
+package p
+
+type T struct {
+       a, b, c int
+       E
+}
+
+type E struct{}
+
+func (T) b()  {} // ERROR "field and method named b|redeclares struct field name"
+func (*T) E() {} // ERROR "field and method named E|redeclares struct field name"
+
+func _() {
+       var x T
+       _ = x.a
+       _ = x.b // no follow-on error here
+       x.b()   // no follow-on error here
+       _ = x.c
+       _ = x.E // no follow-on error here
+       x.E()   // no follow-on error here
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue28390.go b/gcc/testsuite/go.test/test/fixedbugs/issue28390.go
new file mode 100644 (file)
index 0000000..0a4d873
--- /dev/null
@@ -0,0 +1,39 @@
+// run
+
+// Copyright 2018 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 28390/28430: Function call arguments were not
+// converted correctly under some circumstances.
+
+package main
+
+import "fmt"
+
+type A struct {
+       K int
+       S string
+       M map[string]string
+}
+
+func newA(k int, s string) (a A) {
+       a.K = k
+       a.S = s
+       a.M = make(map[string]string)
+       a.M[s] = s
+       return
+}
+
+func proxy() (x int, a A) {
+       return 1, newA(2, "3")
+}
+
+func consume(x int, a interface{}) {
+       fmt.Println(x)
+       fmt.Println(a) // used to panic here
+}
+
+func main() {
+       consume(proxy())
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue28390.out b/gcc/testsuite/go.test/test/fixedbugs/issue28390.out
new file mode 100644 (file)
index 0000000..c923108
--- /dev/null
@@ -0,0 +1,2 @@
+1
+{2 3 map[3:3]}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue28430.go b/gcc/testsuite/go.test/test/fixedbugs/issue28430.go
new file mode 100644 (file)
index 0000000..b59259a
--- /dev/null
@@ -0,0 +1,17 @@
+// compile
+
+// Copyright 2018 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 28390/28430: Function call arguments were not
+// converted correctly under some circumstances.
+
+package main
+
+func g(_ interface{}, e error)
+func h() (int, error)
+
+func f() {
+       g(h())
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue28445.go b/gcc/testsuite/go.test/test/fixedbugs/issue28445.go
new file mode 100644 (file)
index 0000000..5726140
--- /dev/null
@@ -0,0 +1,16 @@
+// compile
+
+// Copyright 2018 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
+
+var fp = (**float64)(nil)
+
+func f() {
+       switch fp {
+       case new(*float64):
+               println()
+       }
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue28450.go b/gcc/testsuite/go.test/test/fixedbugs/issue28450.go
new file mode 100644 (file)
index 0000000..2acfe39
--- /dev/null
@@ -0,0 +1,18 @@
+// errorcheck
+
+// Copyright 2018 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
+
+func f(a, b, c, d ...int)       {} // ERROR "non-final parameter a|only permits one name"
+func g(a ...int, b ...int)      {} // ERROR "non-final parameter a|must be last parameter"
+func h(...int, ...int, float32) {} // ERROR "non-final parameter|must be last parameter"
+
+type a func(...float32, ...interface{}) // ERROR "non-final parameter|must be last parameter"
+type b interface {
+       f(...int, ...int)                // ERROR "non-final parameter|must be last parameter"
+       g(a ...int, b ...int, c float32) // ERROR "non-final parameter a|must be last parameter"
+       valid(...int)
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue28616.go b/gcc/testsuite/go.test/test/fixedbugs/issue28616.go
new file mode 100644 (file)
index 0000000..f1ba974
--- /dev/null
@@ -0,0 +1,25 @@
+// compile
+
+// Copyright 2018 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.
+
+// Make sure we don't dead code eliminate a label.
+
+package p
+
+var i int
+
+func f() {
+
+       if true {
+
+               if i == 1 {
+                       goto label
+               }
+
+               return
+       }
+
+label:
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue28688.go b/gcc/testsuite/go.test/test/fixedbugs/issue28688.go
new file mode 100644 (file)
index 0000000..0d2000e
--- /dev/null
@@ -0,0 +1,31 @@
+// run -gcflags=-d=softfloat
+
+// Copyright 2018 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"
+)
+
+// When using soft-float, OMUL might be rewritten to function
+// call so we should ensure it was evaluated first. Stack frame
+// setup for "test" function call should happen after call to runtime.fmul32
+
+var x int32 = 1
+
+func main() {
+       var y float32 = 1.0
+       test(x, y*y)
+}
+
+//go:noinline
+func test(id int32, a float32) {
+
+       if id != x {
+               fmt.Printf("got: %d, want: %d\n", id, x)
+               panic("FAIL")
+       }
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue28797.go b/gcc/testsuite/go.test/test/fixedbugs/issue28797.go
new file mode 100644 (file)
index 0000000..480c105
--- /dev/null
@@ -0,0 +1,53 @@
+// run
+
+// Copyright 2018 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"
+)
+
+// test expects f to panic, but not to run out of memory,
+// which is a non-panic fatal error.  OOM results from failure
+// to properly check negative limit.
+func test(f func()) {
+       defer func() {
+               r := recover()
+               if r == nil {
+                       panic("panic wasn't recoverable")
+               }
+       }()
+       f()
+}
+
+//go:noinline
+func id(x int) int {
+       return x
+}
+
+func main() {
+       test(foo)
+       test(bar)
+}
+
+func foo() {
+       b := make([]byte, 0)
+       b = append(b, 1)
+       id(len(b))
+       id(len(b) - 2)
+       s := string(b[1 : len(b)-2])
+       fmt.Println(s)
+}
+
+func bar() {
+       b := make([]byte, 1)
+       b = append(b, 1)
+       i := id(-1)
+       if i < len(b) { // establish value is not too large.
+               s := string(b[1:i]) // should check for negative also.
+               fmt.Println(s)
+       }
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue29013a.go b/gcc/testsuite/go.test/test/fixedbugs/issue29013a.go
new file mode 100644 (file)
index 0000000..efc50df
--- /dev/null
@@ -0,0 +1,24 @@
+// run
+
+// Copyright 2018 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 TestSuite struct {
+       Tests []int
+}
+
+var Suites = []TestSuite{
+       Dicts,
+}
+var Dicts = TestSuite{
+       Tests: []int{0},
+}
+
+func main() {
+       if &Dicts.Tests[0] != &Suites[0].Tests[0] {
+               panic("bad")
+       }
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue29013b.go b/gcc/testsuite/go.test/test/fixedbugs/issue29013b.go
new file mode 100644 (file)
index 0000000..b8502da
--- /dev/null
@@ -0,0 +1,43 @@
+// run
+
+// Copyright 2018 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 TestSuite struct {
+       Tests []Test
+}
+type Test struct {
+       Want interface{}
+}
+type Int struct {
+       i int
+}
+
+func NewInt(v int) Int {
+       return Int{i: v}
+}
+
+var Suites = []TestSuite{
+       Dicts,
+}
+var Dicts = TestSuite{
+       Tests: []Test{
+               {
+                       Want: map[Int]bool{NewInt(1): true},
+               },
+               {
+                       Want: map[Int]string{
+                               NewInt(3): "3",
+                       },
+               },
+       },
+}
+
+func main() {
+       if Suites[0].Tests[0].Want.(map[Int]bool)[NewInt(3)] {
+               panic("bad")
+       }
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue29190.go b/gcc/testsuite/go.test/test/fixedbugs/issue29190.go
new file mode 100644 (file)
index 0000000..c0c4bb1
--- /dev/null
@@ -0,0 +1,37 @@
+// run
+
+// Copyright 2018 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 (
+       "strings"
+)
+
+type T struct{}
+
+const maxInt = int(^uint(0) >> 1)
+
+func main() {
+       s := make([]T, maxInt)
+       shouldPanic("cap out of range", func() { s = append(s, T{}) })
+       var oneElem = make([]T, 1)
+       shouldPanic("cap out of range", func() { s = append(s, oneElem...) })
+}
+
+func shouldPanic(str string, f func()) {
+       defer func() {
+               err := recover()
+               if err == nil {
+                       panic("did not panic")
+               }
+               s := err.(error).Error()
+               if !strings.Contains(s, str) {
+                       panic("got panic " + s + ", want " + str)
+               }
+       }()
+
+       f()
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue29215.go b/gcc/testsuite/go.test/test/fixedbugs/issue29215.go
new file mode 100644 (file)
index 0000000..4e8f107
--- /dev/null
@@ -0,0 +1,35 @@
+// compile
+
+// Copyright 2018 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 f() {
+        var s string
+        var p, q bool
+        s = "a"
+        for p {
+                p = false == (true != q)
+                s = ""
+        }
+        _ = s == "bbb"
+}
+
+// Another case: load from negative offset of a symbol
+// in dead code (issue 30257).
+func g() {
+       var i int
+       var s string
+
+       if true {
+               s = "a"
+       }
+
+       if f := 0.0; -f < 0 {
+               i = len(s[:4])
+       }
+
+       _ = s[i-1:0] != "bb" && true
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue29218.go b/gcc/testsuite/go.test/test/fixedbugs/issue29218.go
new file mode 100644 (file)
index 0000000..ac9fed7
--- /dev/null
@@ -0,0 +1,24 @@
+// compile
+
+// Copyright 2019 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 T struct {
+       b bool
+       string
+}
+
+func f() {
+       var b bool
+       var t T
+       for {
+               switch &t.b {
+               case &b:
+                       if b {
+                       }
+               }
+       }
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue29220.go b/gcc/testsuite/go.test/test/fixedbugs/issue29220.go
new file mode 100644 (file)
index 0000000..bbfe930
--- /dev/null
@@ -0,0 +1,26 @@
+// compile
+
+// Copyright 2018 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 ascii(r rune) rune {
+       switch {
+       case 97 <= r && r <= 122:
+               return r - 32
+       case 65 <= r && r <= 90:
+               return r + 32
+       default:
+               return r
+       }
+}
+
+func main() {
+       nomeObjeto := "ABE1FK21"
+       println(string(nomeObjeto[1:4]))
+       println(ascii(rune(nomeObjeto[4])) >= 48 && ascii(rune(nomeObjeto[4])) <= 57)
+       println(string(nomeObjeto[5]))
+       println(string(nomeObjeto[6:10]))
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue29264.go b/gcc/testsuite/go.test/test/fixedbugs/issue29264.go
new file mode 100644 (file)
index 0000000..3781559
--- /dev/null
@@ -0,0 +1,22 @@
+// run
+
+// Copyright 2018 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.
+
+// Verify that we emit a valid type descriptor for
+// a fairly deeply nested type.
+
+package main
+
+import "fmt"
+import "strings"
+
+func main() {
+       a := [][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][]int{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{42}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}
+       got := fmt.Sprint(a)
+       want := strings.Repeat("[", 100) + "42" + strings.Repeat("]", 100)
+       if got != want {
+               fmt.Printf("got  %q\nwant %q\n", got, want)
+       }
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue29304.go b/gcc/testsuite/go.test/test/fixedbugs/issue29304.go
new file mode 100644 (file)
index 0000000..47bc99f
--- /dev/null
@@ -0,0 +1,19 @@
+// run
+
+// Copyright 2018 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.
+
+// Verify that relocation target go.builtin.error.Error
+// is defined and the code links and runs correctly.
+
+package main
+
+import "errors"
+
+func main() {
+       err := errors.New("foo")
+       if error.Error(err) != "foo" {
+               panic("FAILED")
+       }
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue29312.go b/gcc/testsuite/go.test/test/fixedbugs/issue29312.go
new file mode 100644 (file)
index 0000000..4293e01
--- /dev/null
@@ -0,0 +1,70 @@
+// run
+
+// Copyright 2020 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.
+
+// This test is not for a fix of 29312 proper, but for the patch that
+// makes sure we at least don't have a security hole because of 29312.
+
+// This code generates lots of types. The binary should contain
+// a runtime.slicetype for each of the following 253 types:
+//
+//     []*pwn
+//     [][]*pwn
+//     ...
+//     [][]...[][]*pwn          - 249 total "[]"
+//     [][]...[][][]*pwn        - 250 total "[]"
+//     [][]...[][][][]*pwn      - 251 total "[]"
+//     [][]...[][][][][]*pwn    - 252 total "[]"
+//     [][]...[][][][][][]*pwn  - 253 total "[]"
+//
+// The type names for these types are as follows. Because we truncate
+// the name at depth 250, the last few names are all identical:
+//
+//     type.[]*"".pwn
+//     type.[][]*"".pwn
+//     ...
+//     type.[][]...[][]*pwn       - 249 total "[]"
+//     type.[][]...[][][]*<...>   - 250 total "[]"
+//     type.[][]...[][][][]<...>  - 251 total "[]"
+//     type.[][]...[][][][]<...>  - 252 total "[]" (but only 251 "[]" in the name)
+//     type.[][]...[][][][]<...>  - 253 total "[]" (but only 251 "[]" in the name)
+//
+// Because the names of the last 3 types are all identical, the
+// compiler will generate only a single runtime.slicetype data
+// structure for all 3 underlying types. It turns out the compiler
+// generates just the 251-entry one. There aren't any
+// runtime.slicetypes generated for the final two types.
+//
+// The compiler passes type.[]...[]<...> (251 total "[]") to
+// fmt.Sprintf (instead of the correct 253 one). But the data
+// structure at runtime actually has 253 nesting levels. So we end up
+// calling String on something that is of type [][]*pwn instead of
+// something of type *pwn. The way arg passing in Go works, the
+// backing store pointer for the outer slice becomes the "this"
+// pointer of the String method, which points to the inner []*pwn
+// slice.  The String method then modifies the length of that inner
+// slice.
+package main
+
+import "fmt"
+
+type pwn struct {
+       a [3]uint
+}
+
+func (this *pwn) String() string {
+       this.a[1] = 7 // update length
+       return ""
+}
+
+func main() {
+       var a pwn
+       s := [][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][]*pwn{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{&a}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}} // depth 253
+       fmt.Sprint(s)
+       n := len(s[0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0]) // depth 252, type []*pwn
+       if n != 1 {
+               panic(fmt.Sprintf("length was changed, want 1 got %d", n))
+       }
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue29329.go b/gcc/testsuite/go.test/test/fixedbugs/issue29329.go
new file mode 100644 (file)
index 0000000..7818bca
--- /dev/null
@@ -0,0 +1,107 @@
+// +build cgo
+// run -race
+
+// Copyright 2018 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.
+
+// +build linux,amd64
+
+package main
+
+import (
+       "fmt"
+)
+
+type LineString []Point
+type Point [2]float64
+
+//go:noinline
+func benchmarkData() LineString {
+       return LineString{{1.0, 2.0}}
+}
+
+func (ls LineString) Clone() LineString {
+       ps := MultiPoint(ls)
+       return LineString(ps.Clone())
+}
+
+type MultiPoint []Point
+
+func (mp MultiPoint) Clone() MultiPoint {
+       if mp == nil {
+               return nil
+       }
+
+       points := make([]Point, len(mp))
+       copy(points, mp)
+
+       return MultiPoint(points)
+}
+
+func F1() {
+       cases := []struct {
+               threshold float64
+               length    int
+       }{
+               {0.1, 1118},
+               {0.5, 257},
+               {1.0, 144},
+               {1.5, 95},
+               {2.0, 71},
+               {3.0, 46},
+               {4.0, 39},
+               {5.0, 33},
+       }
+
+       ls := benchmarkData()
+
+       for k := 0; k < 100; k++ {
+               for i, tc := range cases {
+                       r := DouglasPeucker(tc.threshold).LineString(ls.Clone())
+                       if len(r) == tc.length {
+                               fmt.Printf("%d: unexpected\n", i)
+                       }
+               }
+       }
+}
+
+// A DouglasPeuckerSimplifier wraps the DouglasPeucker function.
+type DouglasPeuckerSimplifier struct {
+       Threshold float64
+}
+
+// DouglasPeucker creates a new DouglasPeuckerSimplifier.
+func DouglasPeucker(threshold float64) *DouglasPeuckerSimplifier {
+       return &DouglasPeuckerSimplifier{
+               Threshold: threshold,
+       }
+}
+
+func (s *DouglasPeuckerSimplifier) LineString(ls LineString) LineString {
+       return lineString(s, ls)
+}
+
+type simplifier interface {
+       simplify(LineString, bool) (LineString, []int)
+}
+
+func lineString(s simplifier, ls LineString) LineString {
+       return runSimplify(s, ls)
+}
+
+func runSimplify(s simplifier, ls LineString) LineString {
+       if len(ls) <= 2 {
+               return ls
+       }
+       ls, _ = s.simplify(ls, false)
+       return ls
+}
+
+func (s *DouglasPeuckerSimplifier) simplify(ls LineString, wim bool) (LineString, []int) {
+       return nil, nil
+}
+
+func main() {
+       F1()
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue29350.go b/gcc/testsuite/go.test/test/fixedbugs/issue29350.go
new file mode 100644 (file)
index 0000000..9d59f6f
--- /dev/null
@@ -0,0 +1,9 @@
+// compile
+
+// Copyright 2018 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
+
+var X interface{} = 'x'
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue29362.go b/gcc/testsuite/go.test/test/fixedbugs/issue29362.go
new file mode 100644 (file)
index 0000000..a8bd607
--- /dev/null
@@ -0,0 +1,42 @@
+// run
+
+// Copyright 2018 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.
+
+// Verify that we don't consider a Go'd function's
+// arguments as pointers when they aren't.
+
+package main
+
+import (
+       "unsafe"
+)
+
+var badPtr uintptr
+
+var sink []byte
+
+func init() {
+       // Allocate large enough to use largeAlloc.
+       b := make([]byte, 1<<16-1)
+       sink = b // force heap allocation
+       //  Any space between the object and the end of page is invalid to point to.
+       badPtr = uintptr(unsafe.Pointer(&b[len(b)-1])) + 1
+}
+
+var throttle = make(chan struct{}, 10)
+
+func noPointerArgs(a, b, c, d uintptr) {
+       sink = make([]byte, 4096)
+       <-throttle
+}
+
+func main() {
+       const N = 1000
+       for i := 0; i < N; i++ {
+               throttle <- struct{}{}
+               go noPointerArgs(badPtr, badPtr, badPtr, badPtr)
+               sink = make([]byte, 4096)
+       }
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue29362b.go b/gcc/testsuite/go.test/test/fixedbugs/issue29362b.go
new file mode 100644 (file)
index 0000000..d1e3b47
--- /dev/null
@@ -0,0 +1,53 @@
+// run
+
+// Copyright 2018 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.
+
+// Verify that we don't consider a Go'd function's
+// arguments as pointers when they aren't.
+
+package main
+
+import (
+       "unsafe"
+)
+
+var badPtr uintptr
+
+var sink []byte
+
+func init() {
+       // Allocate large enough to use largeAlloc.
+       b := make([]byte, 1<<16-1)
+       sink = b // force heap allocation
+       //  Any space between the object and the end of page is invalid to point to.
+       badPtr = uintptr(unsafe.Pointer(&b[len(b)-1])) + 1
+}
+
+var throttle = make(chan struct{}, 10)
+
+// There are 2 arg bitmaps for this function, each with 2 bits.
+// In the first, p and q are both live, so that bitmap is 11.
+// In the second, only p is live, so that bitmap is 10.
+// Bitmaps are byte aligned, so if the first bitmap is interpreted as
+// extending across the entire argument area, we incorrectly concatenate
+// the bitmaps and end up using 110000001. That bad bitmap causes a6
+// to be considered a pointer.
+func noPointerArgs(p, q *byte, a0, a1, a2, a3, a4, a5, a6 uintptr) {
+       sink = make([]byte, 4096)
+       sinkptr = q
+       <-throttle
+       sinkptr = p
+}
+
+var sinkptr *byte
+
+func main() {
+       const N = 1000
+       for i := 0; i < N; i++ {
+               throttle <- struct{}{}
+               go noPointerArgs(nil, nil, badPtr, badPtr, badPtr, badPtr, badPtr, badPtr, badPtr)
+               sink = make([]byte, 4096)
+       }
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue29389.go b/gcc/testsuite/go.test/test/fixedbugs/issue29389.go
new file mode 100644 (file)
index 0000000..43859fd
--- /dev/null
@@ -0,0 +1,17 @@
+// compile
+
+// Copyright 2018 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.
+
+// Make sure we can correctly compile method expressions
+// where the method is implicitly declared.
+
+package main
+
+import "io"
+
+func main() {
+       err := io.EOF
+       _ = err.Error
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue29402.go b/gcc/testsuite/go.test/test/fixedbugs/issue29402.go
new file mode 100644 (file)
index 0000000..8a1f959
--- /dev/null
@@ -0,0 +1,23 @@
+// run
+  
+// Copyright 2018 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 29402: wrong optimization of comparison of
+// constant and shift on MIPS.
+
+package main
+
+//go:noinline
+func F(s []int) bool {
+       half := len(s) / 2
+       return half >= 0
+}
+
+func main() {
+       b := F([]int{1, 2, 3, 4})
+       if !b {
+               panic("FAIL")
+       }
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue29562.go b/gcc/testsuite/go.test/test/fixedbugs/issue29562.go
new file mode 100644 (file)
index 0000000..cbcd77d
--- /dev/null
@@ -0,0 +1,26 @@
+// compile
+
+// Copyright 2019 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.
+
+// Triggers a double walk of the (inlined) switch in il
+
+package p
+
+func il(s string) string {
+       switch len(s) {
+       case 0:
+               return "zero"
+       case 1:
+               return "one"
+       }
+       return s
+}
+
+func f() {
+       var s string
+       var as []string
+       switch false && (s+"a"+as[0]+il(s)+as[0]+s == "") {
+       }
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue29610.dir/a.go b/gcc/testsuite/go.test/test/fixedbugs/issue29610.dir/a.go
new file mode 100644 (file)
index 0000000..ccbe451
--- /dev/null
@@ -0,0 +1,15 @@
+// Copyright 2019 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
+
+type I interface {
+       M(init bool)
+}
+
+var V I
+
+func init() {
+       V = nil
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue29610.dir/b.go b/gcc/testsuite/go.test/test/fixedbugs/issue29610.dir/b.go
new file mode 100644 (file)
index 0000000..c2016de
--- /dev/null
@@ -0,0 +1,17 @@
+// Copyright 2019 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
+
+import "./a"
+
+type S struct {
+       a.I
+}
+
+var V a.I
+
+func init() {
+       V = S{}
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue29610.dir/main.go b/gcc/testsuite/go.test/test/fixedbugs/issue29610.dir/main.go
new file mode 100644 (file)
index 0000000..29437bf
--- /dev/null
@@ -0,0 +1,11 @@
+// Copyright 2019 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 "./b"
+
+var v b.S
+
+func main() {}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue29610.go b/gcc/testsuite/go.test/test/fixedbugs/issue29610.go
new file mode 100644 (file)
index 0000000..8d49ba6
--- /dev/null
@@ -0,0 +1,13 @@
+// rundir
+
+// Copyright 2018 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 29610: Symbol import and initialization order caused function
+// symbols to be recorded as non-function symbols.
+
+// This uses rundir not because we actually want to run the final
+// binary, but because we need to at least link it.
+
+package ignored
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue29735.go b/gcc/testsuite/go.test/test/fixedbugs/issue29735.go
new file mode 100644 (file)
index 0000000..7a0381d
--- /dev/null
@@ -0,0 +1,33 @@
+// run
+
+// Copyright 2019 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.
+
+// Make sure FuncForPC won't panic when given a pc which
+// lies between two functions.
+
+package main
+
+import (
+       "runtime"
+)
+
+func main() {
+       var stack [1]uintptr
+       runtime.Callers(1, stack[:])
+       f() // inlined function, to give main some inlining info
+       for i := uintptr(0); true; i++ {
+               f := runtime.FuncForPC(stack[0] + i)
+               if f.Name() != "main.main" && f.Name() != "main.f" {
+                       // Reached next function successfully.
+                       break
+               }
+       }
+}
+
+func f() {
+       sink = 0 // one instruction which can't be removed
+}
+
+var sink int
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue29855.go b/gcc/testsuite/go.test/test/fixedbugs/issue29855.go
new file mode 100644 (file)
index 0000000..402093c
--- /dev/null
@@ -0,0 +1,17 @@
+// errorcheck
+
+// Copyright 2018 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 struct {
+       GlobalName string
+}
+
+var t = T{Name: "foo"} // ERROR "unknown field 'Name' in struct literal of type T|unknown field .*Name.* in .*T"
+
+func (t T) Name() string {
+       return t.GlobalName
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue29870.go b/gcc/testsuite/go.test/test/fixedbugs/issue29870.go
new file mode 100644 (file)
index 0000000..b79860c
--- /dev/null
@@ -0,0 +1,15 @@
+// compile
+
+// Copyright 2019 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.
+
+// Make sure we can compile "_" functions without crashing.
+
+package main
+
+import "log"
+
+func _() {
+       log.Println("%2F")
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue29870b.go b/gcc/testsuite/go.test/test/fixedbugs/issue29870b.go
new file mode 100644 (file)
index 0000000..0a83489
--- /dev/null
@@ -0,0 +1,14 @@
+// errorcheck
+
+// Copyright 2019 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.
+
+// Make sure we're compiling "_" functions at least enough
+// to get to an error which is generated during walk.
+
+package main
+
+func _() {
+       x := 7 // ERROR ".*x.* declared but not used"
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue29943.go b/gcc/testsuite/go.test/test/fixedbugs/issue29943.go
new file mode 100644 (file)
index 0000000..ff47de5
--- /dev/null
@@ -0,0 +1,28 @@
+// run
+
+// Copyright 2019 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.
+
+// Code was miscompiled on ppc64le due to incorrect zero-extension
+// that was CSE'd.
+
+package main
+
+//go:noinline
+func g(i uint64) uint64 {
+       return uint64(uint32(i))
+}
+
+var sink uint64
+
+func main() {
+       for i := uint64(0); i < 1; i++ {
+               i32 := int32(i - 1)
+               sink = uint64((uint32(i32) << 1) ^ uint32((i32 >> 31)))
+               x := g(uint64(i32))
+               if x != uint64(uint32(i32)) {
+                       panic(x)
+               }
+       }
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue30041.go b/gcc/testsuite/go.test/test/fixedbugs/issue30041.go
new file mode 100644 (file)
index 0000000..7d8a169
--- /dev/null
@@ -0,0 +1,63 @@
+// run
+
+// Copyright 2019 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 30041: copying results of a reflect-generated
+// call on stack should not have write barrier.
+
+package main
+
+import (
+       "reflect"
+       "runtime"
+       "unsafe"
+)
+
+var badPtr uintptr
+
+var sink []byte
+
+func init() {
+       // Allocate large enough to use largeAlloc.
+       b := make([]byte, 1<<16-1)
+       sink = b // force heap allocation
+       //  Any space between the object and the end of page is invalid to point to.
+       badPtr = uintptr(unsafe.Pointer(&b[len(b)-1])) + 1
+}
+
+type ft func() *int
+
+var fn ft
+
+func rf([]reflect.Value) []reflect.Value {
+       a := reflect.ValueOf((*int)(nil))
+       return []reflect.Value{a}
+}
+
+const N = 1000
+
+func main() {
+       fn = reflect.MakeFunc(reflect.TypeOf(fn), rf).Interface().(ft)
+
+       // Keep running GC so the write barrier is on.
+       go func() {
+               for i := 0; i < N; i++ {
+                       runtime.GC()
+               }
+       }()
+
+       var x [10]uintptr
+       for i := range x {
+               x[i] = badPtr
+       }
+       for i := 0; i < N; i++ {
+               runtime.Gosched()
+               use(x) // prepare bad pointers on stack
+               fn()
+       }
+}
+
+//go:noinline
+func use([10]uintptr) {}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue30061.go b/gcc/testsuite/go.test/test/fixedbugs/issue30061.go
new file mode 100644 (file)
index 0000000..5092b01
--- /dev/null
@@ -0,0 +1,20 @@
+// compile
+
+// Copyright 2019 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.
+
+// Make sure we can linkname to memmove with an unsafe.Pointer argument.
+
+package p
+
+import "unsafe"
+
+//go:linkname memmove runtime.memmove
+func memmove(to, from unsafe.Pointer, n uintptr)
+
+var V1, V2 int
+
+func F() {
+       memmove(unsafe.Pointer(&V1), unsafe.Pointer(&V2), unsafe.Sizeof(int(0)))
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue30085.go b/gcc/testsuite/go.test/test/fixedbugs/issue30085.go
new file mode 100644 (file)
index 0000000..d2ac4cf
--- /dev/null
@@ -0,0 +1,12 @@
+// errorcheck
+
+// Copyright 2019 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() {
+       var c, d = 1, 2, 3 // ERROR "assignment mismatch: 2 variables but 3 values|wrong number of initializations"
+       var e, f, g = 1, 2 // ERROR "assignment mismatch: 3 variables but 2 values|wrong number of initializations"
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue30087.go b/gcc/testsuite/go.test/test/fixedbugs/issue30087.go
new file mode 100644 (file)
index 0000000..3ad9c8c
--- /dev/null
@@ -0,0 +1,14 @@
+// errorcheck
+
+// Copyright 2019 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() {
+       var a, b = 1    // ERROR "assignment mismatch: 2 variables but 1 values|wrong number of initializations"
+       _ = 1, 2        // ERROR "assignment mismatch: 1 variables but 2 values|number of variables does not match"
+       c, d := 1       // ERROR "assignment mismatch: 2 variables but 1 values|wrong number of initializations"
+       e, f := 1, 2, 3 // ERROR "assignment mismatch: 2 variables but 3 values|wrong number of initializations"
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue30243.go b/gcc/testsuite/go.test/test/fixedbugs/issue30243.go
new file mode 100644 (file)
index 0000000..51fd204
--- /dev/null
@@ -0,0 +1,27 @@
+// run
+
+// Copyright 2019 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.
+
+// Compile-time constants, even if they cannot be represented
+// accurately, should remain the same in operations that don't
+// affect their values.
+
+package main
+
+import "fmt"
+
+func main() {
+       const x = 0.01
+       const xi = 0.01i
+       const xc = complex(0, x)
+
+       if imag(xi) != x {
+               fmt.Printf("FAILED: %g != %g\n", imag(xi), x)
+       }
+
+       if xi != complex(0, x) {
+               fmt.Printf("FAILED: %g != %g\n", xi, complex(0, x))
+       }
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue30430.go b/gcc/testsuite/go.test/test/fixedbugs/issue30430.go
new file mode 100644 (file)
index 0000000..6c27b82
--- /dev/null
@@ -0,0 +1,17 @@
+// compile
+
+// Copyright 2019 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 30430: isGoConst returned true for non-const variables,
+// resulting in ICE.
+
+package p
+
+func f() {
+       var s string
+       _ = map[string]string{s: ""}
+}
+
+const s = ""
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue30476.go b/gcc/testsuite/go.test/test/fixedbugs/issue30476.go
new file mode 100644 (file)
index 0000000..a2147ec
--- /dev/null
@@ -0,0 +1,30 @@
+// run
+
+// Copyright 2019 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 30476: KeepAlive didn't keep stack object alive.
+
+package main
+
+import "runtime"
+
+func main() {
+       x := new([10]int)
+       runtime.SetFinalizer(x, func(*[10]int) { panic("FAIL: finalizer runs") })
+       p := &T{x, 0}
+       use(p)
+       runtime.GC()
+       runtime.GC()
+       runtime.GC()
+       runtime.KeepAlive(p)
+}
+
+type T struct {
+       x *[10]int
+       y int
+}
+
+//go:noinline
+func use(*T) {}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue30566a.go b/gcc/testsuite/go.test/test/fixedbugs/issue30566a.go
new file mode 100644 (file)
index 0000000..5d736cc
--- /dev/null
@@ -0,0 +1,23 @@
+// run
+
+// Copyright 2019 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"
+
+//go:noinline
+func ident(s string) string { return s }
+
+func returnSecond(x bool, s string) string { return s }
+
+func identWrapper(s string) string { return ident(s) }
+
+func main() {
+       got := returnSecond((false || identWrapper("bad") != ""), ident("good"))
+       if got != "good" {
+               panic(fmt.Sprintf("wanted \"good\", got \"%s\"", got))
+       }
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue30566b.go b/gcc/testsuite/go.test/test/fixedbugs/issue30566b.go
new file mode 100644 (file)
index 0000000..92e0644
--- /dev/null
@@ -0,0 +1,27 @@
+// run
+
+// Copyright 2019 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 (
+       "bytes"
+       "fmt"
+)
+
+func main() {
+       _, _ = false || g(1), g(2)
+       if !bytes.Equal(x, []byte{1, 2}) {
+               panic(fmt.Sprintf("wanted [1,2], got %v", x))
+       }
+}
+
+var x []byte
+
+//go:noinline
+func g(b byte) bool {
+       x = append(x, b)
+       return false
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue30606.go b/gcc/testsuite/go.test/test/fixedbugs/issue30606.go
new file mode 100644 (file)
index 0000000..bc31982
--- /dev/null
@@ -0,0 +1,20 @@
+// run
+
+// Copyright 2019 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 "reflect"
+
+func main() {}
+
+func typ(x interface{}) reflect.Type { return reflect.ValueOf(x).Type() }
+
+var x = reflect.New(reflect.StructOf([]reflect.StructField{
+       {Name: "F5", Type: reflect.StructOf([]reflect.StructField{
+               {Name: "F4", Type: reflect.ArrayOf(5462,
+                       reflect.SliceOf(typ(uint64(0))))},
+       })},
+}))
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue30606b.go b/gcc/testsuite/go.test/test/fixedbugs/issue30606b.go
new file mode 100644 (file)
index 0000000..2ce2804
--- /dev/null
@@ -0,0 +1,51 @@
+// run
+
+// Copyright 2019 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 "reflect"
+
+func main() {}
+
+func typ(x interface{}) reflect.Type { return reflect.ValueOf(x).Type() }
+
+var byteType = typ((byte)(0))
+var ptrType = typ((*byte)(nil))
+
+// Arrays of pointers. There are two size thresholds.
+// Bit masks are chunked in groups of 120 pointers.
+// Array types with >16384 pointers have a GC program instead of a bitmask.
+var smallPtrType = reflect.ArrayOf(100, ptrType)
+var mediumPtrType = reflect.ArrayOf(1000, ptrType)
+var bigPtrType = reflect.ArrayOf(16385, ptrType)
+
+var x0 = reflect.New(reflect.StructOf([]reflect.StructField{
+       {Name: "F1", Type: byteType},
+       {Name: "F2", Type: bigPtrType},
+}))
+var x1 = reflect.New(reflect.StructOf([]reflect.StructField{
+       {Name: "F1", Type: smallPtrType},
+       {Name: "F2", Type: bigPtrType},
+}))
+var x2 = reflect.New(reflect.StructOf([]reflect.StructField{
+       {Name: "F1", Type: mediumPtrType},
+       {Name: "F2", Type: bigPtrType},
+}))
+var x3 = reflect.New(reflect.StructOf([]reflect.StructField{
+       {Name: "F1", Type: ptrType},
+       {Name: "F2", Type: byteType},
+       {Name: "F3", Type: bigPtrType},
+}))
+var x4 = reflect.New(reflect.StructOf([]reflect.StructField{
+       {Name: "F1", Type: ptrType},
+       {Name: "F2", Type: smallPtrType},
+       {Name: "F3", Type: bigPtrType},
+}))
+var x5 = reflect.New(reflect.StructOf([]reflect.StructField{
+       {Name: "F1", Type: ptrType},
+       {Name: "F2", Type: mediumPtrType},
+       {Name: "F3", Type: bigPtrType},
+}))
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue30679.go b/gcc/testsuite/go.test/test/fixedbugs/issue30679.go
new file mode 100644 (file)
index 0000000..4d0df18
--- /dev/null
@@ -0,0 +1,18 @@
+// compile
+
+// Copyright 2019 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() {
+       var f float64
+       var p, q *float64
+
+       p = &f
+       if *q > 0 {
+               p = q
+       }
+       _ = *p
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue30709.go b/gcc/testsuite/go.test/test/fixedbugs/issue30709.go
new file mode 100644 (file)
index 0000000..4952454
--- /dev/null
@@ -0,0 +1,33 @@
+// run
+
+// Copyright 2019 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 closure in const declaration group can be compiled
+// and set correct value
+
+package main
+
+import "unsafe"
+
+const (
+       x = unsafe.Sizeof(func() {})
+       y
+)
+
+func main() {
+       const (
+               z = unsafe.Sizeof(func() {})
+               t
+       )
+
+       // x and y must be equal
+       println(x == y)
+       // size must be greater than zero
+       println(y > 0)
+
+       // Same logic as x, y above
+       println(z == t)
+       println(t > 0)
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue30709.out b/gcc/testsuite/go.test/test/fixedbugs/issue30709.out
new file mode 100644 (file)
index 0000000..1140ff5
--- /dev/null
@@ -0,0 +1,4 @@
+true
+true
+true
+true
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue30862.dir/a.go b/gcc/testsuite/go.test/test/fixedbugs/issue30862.dir/a.go
new file mode 100644 (file)
index 0000000..c23f4de
--- /dev/null
@@ -0,0 +1,15 @@
+// Copyright 2019 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
+
+var pl int
+
+type NoitfStruct struct {
+       F int
+       G int
+}
+
+//go:nointerface
+func (t *NoitfStruct) NoInterfaceMethod() {}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue30862.dir/b.go b/gcc/testsuite/go.test/test/fixedbugs/issue30862.dir/b.go
new file mode 100644 (file)
index 0000000..3e501bb
--- /dev/null
@@ -0,0 +1,29 @@
+// Copyright 2019 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
+
+import "./a"
+
+type EmbedImported struct {
+       a.NoitfStruct
+}
+
+func Test() []string {
+       bad := []string{}
+       x := interface{}(new(a.NoitfStruct))
+       if _, ok := x.(interface {
+               NoInterfaceMethod()
+       }); ok {
+               bad = append(bad, "fail 1")
+       }
+
+       x = interface{}(new(EmbedImported))
+       if _, ok := x.(interface {
+               NoInterfaceMethod()
+       }); ok {
+               bad = append(bad, "fail 2")
+       }
+       return bad
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue30862.dir/main.go b/gcc/testsuite/go.test/test/fixedbugs/issue30862.dir/main.go
new file mode 100644 (file)
index 0000000..80db0e1
--- /dev/null
@@ -0,0 +1,28 @@
+// Copyright 2019 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"
+       "os"
+
+       "./b"
+)
+
+// Test case for issue 30862.
+
+// Be aware that unless GOEXPERIMENT=fieldtrack is set when building
+// the compiler, this test will fail if executed with a regular GC
+// compiler.
+
+func main() {
+       bad := b.Test()
+       if len(bad) > 0 {
+               for _, s := range bad {
+                       fmt.Fprintf(os.Stderr, "test failed: %s\n", s)
+               }
+               os.Exit(1)
+       }
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue30862.go b/gcc/testsuite/go.test/test/fixedbugs/issue30862.go
new file mode 100644 (file)
index 0000000..ba122cc
--- /dev/null
@@ -0,0 +1,14 @@
+// rundir
+
+// Copyright 2019 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.
+
+// Test case for issue 30862.  This test as written will
+// fail for the main 'gc' compiler unless GOEXPERIMENT=fieldtrack
+// is set when building it, whereas gccgo has field tracking
+// enabled by default (hence the build tag below).
+
+// +build gccgo
+
+package ignored
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue30898.go b/gcc/testsuite/go.test/test/fixedbugs/issue30898.go
new file mode 100644 (file)
index 0000000..b6376d3
--- /dev/null
@@ -0,0 +1,19 @@
+// errorcheck -0 -m
+
+// Copyright 2019 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.
+
+// Test escape analysis for functions with variadic arguments
+
+package foo
+
+func debugf(format string, args ...interface{}) { // ERROR "can inline debugf" "format does not escape" "args does not escape"
+       // Dummy implementation for non-debug build.
+       // A non-empty implementation would be enabled with a build tag.
+}
+
+func bar() { // ERROR "can inline bar"
+       value := 10
+       debugf("value is %d", value) // ERROR "inlining call to debugf" "value does not escape" "\[\]interface {}{...} does not escape"
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue30907.dir/a.go b/gcc/testsuite/go.test/test/fixedbugs/issue30907.dir/a.go
new file mode 100644 (file)
index 0000000..e1a5c0c
--- /dev/null
@@ -0,0 +1,19 @@
+// Copyright 2019 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
+
+type UUID string
+
+func New() UUID {
+       return Must(NewRandom())
+}
+
+func NewRandom() (UUID, error) {
+       return "", nil
+}
+
+func Must(uuid UUID, err error) UUID {
+       return uuid
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue30907.dir/b.go b/gcc/testsuite/go.test/test/fixedbugs/issue30907.dir/b.go
new file mode 100644 (file)
index 0000000..f4f5fc4
--- /dev/null
@@ -0,0 +1,11 @@
+// Copyright 2019 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
+
+import "./a"
+
+func F() {
+       a.New()
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue30907.go b/gcc/testsuite/go.test/test/fixedbugs/issue30907.go
new file mode 100644 (file)
index 0000000..973ae1d
--- /dev/null
@@ -0,0 +1,7 @@
+// compiledir
+
+// Copyright 2019 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/issue30956.go b/gcc/testsuite/go.test/test/fixedbugs/issue30956.go
new file mode 100644 (file)
index 0000000..021e6c5
--- /dev/null
@@ -0,0 +1,32 @@
+// run
+
+// Copyright 2019 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 for compile generated static data for literal
+// composite struct
+
+package main
+
+import "fmt"
+
+type X struct {
+       V interface{}
+
+       a int
+       b int
+       c int
+}
+
+func pr(x X) {
+       fmt.Println(x.V)
+}
+
+func main() {
+       pr(X{
+               V: struct {
+                       A int
+               }{42},
+       })
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue30956.out b/gcc/testsuite/go.test/test/fixedbugs/issue30956.out
new file mode 100644 (file)
index 0000000..04f25e8
--- /dev/null
@@ -0,0 +1 @@
+{42}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue30977.go b/gcc/testsuite/go.test/test/fixedbugs/issue30977.go
new file mode 100644 (file)
index 0000000..2ca040d
--- /dev/null
@@ -0,0 +1,52 @@
+// run
+
+// Copyright 2019 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 30977: write barrier call clobbers volatile
+// value when there are multiple uses of the value.
+
+package main
+
+import "runtime"
+
+type T struct {
+       a, b, c, d, e string
+}
+
+//go:noinline
+func g() T {
+       return T{"a", "b", "c", "d", "e"}
+}
+
+//go:noinline
+func f() {
+       // The compiler optimizes this to direct copying
+       // the call result to both globals, with write
+       // barriers. The first write barrier call clobbers
+       // the result of g on stack.
+       X = g()
+       Y = X
+}
+
+var X, Y T
+
+const N = 1000
+
+func main() {
+       // Keep GC running so the write barrier is on.
+       go func() {
+               for {
+                       runtime.GC()
+               }
+       }()
+
+       for i := 0; i < N; i++ {
+               runtime.Gosched()
+               f()
+               if X != Y {
+                       panic("FAIL")
+               }
+       }
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue31010.go b/gcc/testsuite/go.test/test/fixedbugs/issue31010.go
new file mode 100644 (file)
index 0000000..836e85f
--- /dev/null
@@ -0,0 +1,24 @@
+// compile
+
+// Copyright 2019 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
+
+var (
+       x  int
+       xs []int
+)
+
+func a([]int) (int, error)
+
+func b() (int, error) {
+       return a(append(xs, x))
+}
+
+func c(int, error) (int, error)
+
+func d() (int, error) {
+       return c(b())
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue31060.go b/gcc/testsuite/go.test/test/fixedbugs/issue31060.go
new file mode 100644 (file)
index 0000000..a1ba705
--- /dev/null
@@ -0,0 +1,30 @@
+// errorcheck
+
+// Copyright 2019 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
+
+const (
+       f = 1.0
+       c = 1.0i
+
+       _ = ^f // ERROR "invalid operation|expected integer"
+       _ = ^c // ERROR "invalid operation|expected integer"
+
+       _ = f % f // ERROR "invalid operation|expected integer"
+       _ = c % c // ERROR "invalid operation|expected integer"
+
+       _ = f & f // ERROR "invalid operation|expected integer"
+       _ = c & c // ERROR "invalid operation|expected integer"
+
+       _ = f | f // ERROR "invalid operation|expected integer"
+       _ = c | c // ERROR "invalid operation|expected integer"
+
+       _ = f ^ f // ERROR "invalid operation|expected integer"
+       _ = c ^ c // ERROR "invalid operation|expected integer"
+
+       _ = f &^ f // ERROR "invalid operation|expected integer"
+       _ = c &^ c // ERROR "invalid operation|expected integer"
+)
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue31252.dir/a.go b/gcc/testsuite/go.test/test/fixedbugs/issue31252.dir/a.go
new file mode 100644 (file)
index 0000000..fa43150
--- /dev/null
@@ -0,0 +1,13 @@
+// Copyright 2019 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 "fmt"
+
+type IndexController struct{}
+
+func (this *IndexController) Index(m *string) {
+       fmt.Println(m)
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue31252.dir/b.go b/gcc/testsuite/go.test/test/fixedbugs/issue31252.dir/b.go
new file mode 100644 (file)
index 0000000..9bfc0ff
--- /dev/null
@@ -0,0 +1,13 @@
+// Copyright 2019 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
+
+import "fmt"
+
+type IndexController struct{}
+
+func (this *IndexController) Index(m *string) {
+       fmt.Println(m)
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue31252.dir/c.go b/gcc/testsuite/go.test/test/fixedbugs/issue31252.dir/c.go
new file mode 100644 (file)
index 0000000..928c8ee
--- /dev/null
@@ -0,0 +1,26 @@
+// Copyright 2019 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 c
+
+import (
+       "a"
+       "b"
+)
+
+type HandlerFunc func(*string)
+
+func RouterInit() {
+       //home API
+       homeIndex := &a.IndexController{}
+       GET("/home/index/index", homeIndex.Index)
+       //admin API
+       adminIndex := &b.IndexController{}
+       GET("/admin/index/index", adminIndex.Index)
+       return
+}
+
+func GET(path string, handlers ...HandlerFunc) {
+       return
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue31252.dir/main.go b/gcc/testsuite/go.test/test/fixedbugs/issue31252.dir/main.go
new file mode 100644 (file)
index 0000000..25a7548
--- /dev/null
@@ -0,0 +1,11 @@
+// Copyright 2019 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 "c"
+
+func main() {
+       c.RouterInit()
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue31252.go b/gcc/testsuite/go.test/test/fixedbugs/issue31252.go
new file mode 100644 (file)
index 0000000..973ae1d
--- /dev/null
@@ -0,0 +1,7 @@
+// compiledir
+
+// Copyright 2019 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/issue31412a.go b/gcc/testsuite/go.test/test/fixedbugs/issue31412a.go
new file mode 100644 (file)
index 0000000..75021c6
--- /dev/null
@@ -0,0 +1,32 @@
+// compile
+
+// Copyright 2019 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.
+
+// This code was incorrectly flagged as erroneous by gccgo.
+
+package main
+
+type Name string
+
+type EFunc func(int) int
+
+func Register(f EFunc, names ...Name) int {
+       return f(len(names))
+}
+
+const (
+       B Name = "B"
+)
+
+func RegisterIt() {
+       n := B + "Duck"
+       d := B + "Goose"
+       f := func(x int) int { return x + 9 }
+       Register(f, n, d)
+}
+
+func main() {
+       RegisterIt()
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue31412b.go b/gcc/testsuite/go.test/test/fixedbugs/issue31412b.go
new file mode 100644 (file)
index 0000000..6c4ec00
--- /dev/null
@@ -0,0 +1,20 @@
+// errorcheck
+
+// Copyright 2019 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.
+
+// This code was incorrectly accepted by gccgo.
+
+package main
+
+type N string
+type M string
+
+const B N = "B"
+const C M = "C"
+
+func main() {
+       q := B + C // ERROR "mismatched types|incompatible types"
+       println(q)
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue31419.go b/gcc/testsuite/go.test/test/fixedbugs/issue31419.go
new file mode 100644 (file)
index 0000000..233111a
--- /dev/null
@@ -0,0 +1,58 @@
+// run
+
+// Copyright 2019 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 31419: race in getitab when two goroutines try
+// to do the same failed interface conversion.
+
+package main
+
+type T int
+
+func (t T) M() {}
+
+type I interface {
+       M()
+       M2()
+}
+
+var t T
+var e interface{} = &t
+var ok = false
+var ch = make(chan int)
+
+func main() {
+       _, ok = e.(I) // populate itab cache with a false result
+
+       go f() // get itab in a loop
+
+       var i I
+       for k := 0; k < 10000; k++ {
+               i, ok = e.(I) // read the cached itab
+               if ok {
+                       println("iteration", k, "i =", i, "&t =", &t)
+                       panic("conversion succeeded")
+               }
+       }
+       <-ch
+}
+
+func f() {
+       for i := 0; i < 10000; i++ {
+               f1()
+       }
+       ch <- 1
+}
+
+func f1() {
+       defer func() {
+               err := recover()
+               if err == nil {
+                       panic("did not panic")
+               }
+       }()
+       i := e.(I) // triggers itab.init, for getting the panic string
+       _ = i
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue31573.go b/gcc/testsuite/go.test/test/fixedbugs/issue31573.go
new file mode 100644 (file)
index 0000000..005910e
--- /dev/null
@@ -0,0 +1,49 @@
+// errorcheck -0 -m
+
+// Copyright 2019 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
+
+func f(...*int) {} // ERROR "can inline f$"
+
+func g() {
+       defer f()
+       defer f(new(int))           // ERROR "... argument does not escape$" "new\(int\) does not escape$"
+       defer f(new(int), new(int)) // ERROR "... argument does not escape$" "new\(int\) does not escape$"
+
+       defer f(nil...)
+       defer f([]*int{}...)                   // ERROR "\[\]\*int{} does not escape$"
+       defer f([]*int{new(int)}...)           // ERROR "\[\]\*int{...} does not escape$" "new\(int\) does not escape$"
+       defer f([]*int{new(int), new(int)}...) // ERROR "\[\]\*int{...} does not escape$" "new\(int\) does not escape$"
+
+       go f()
+       go f(new(int))           // ERROR "... argument escapes to heap$" "new\(int\) escapes to heap$"
+       go f(new(int), new(int)) // ERROR "... argument escapes to heap$" "new\(int\) escapes to heap$"
+
+       go f(nil...)
+       go f([]*int{}...)                   // ERROR "\[\]\*int{} escapes to heap$"
+       go f([]*int{new(int)}...)           // ERROR "\[\]\*int{...} escapes to heap$" "new\(int\) escapes to heap$"
+       go f([]*int{new(int), new(int)}...) // ERROR "\[\]\*int{...} escapes to heap$" "new\(int\) escapes to heap$"
+
+       for {
+               defer f()
+               defer f(new(int))           // ERROR "... argument escapes to heap$" "new\(int\) escapes to heap$"
+               defer f(new(int), new(int)) // ERROR "... argument escapes to heap$" "new\(int\) escapes to heap$"
+
+               defer f(nil...)
+               defer f([]*int{}...)                   // ERROR "\[\]\*int{} escapes to heap$"
+               defer f([]*int{new(int)}...)           // ERROR "\[\]\*int{...} escapes to heap$" "new\(int\) escapes to heap$"
+               defer f([]*int{new(int), new(int)}...) // ERROR "\[\]\*int{...} escapes to heap$" "new\(int\) escapes to heap$"
+
+               go f()
+               go f(new(int))           // ERROR "... argument escapes to heap$" "new\(int\) escapes to heap$"
+               go f(new(int), new(int)) // ERROR "... argument escapes to heap$" "new\(int\) escapes to heap$"
+
+               go f(nil...)
+               go f([]*int{}...)                   // ERROR "\[\]\*int{} escapes to heap$"
+               go f([]*int{new(int)}...)           // ERROR "\[\]\*int{...} escapes to heap$" "new\(int\) escapes to heap$"
+               go f([]*int{new(int), new(int)}...) // ERROR "\[\]\*int{...} escapes to heap$" "new\(int\) escapes to heap$"
+       }
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue31637.dir/a.go b/gcc/testsuite/go.test/test/fixedbugs/issue31637.dir/a.go
new file mode 100644 (file)
index 0000000..71f3926
--- /dev/null
@@ -0,0 +1,15 @@
+// Copyright 2019 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
+
+type dO struct {
+       x int
+}
+
+type EDO struct{}
+
+func (EDO) Apply(*dO) {}
+
+var X EDO
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue31637.dir/b.go b/gcc/testsuite/go.test/test/fixedbugs/issue31637.dir/b.go
new file mode 100644 (file)
index 0000000..ce83b00
--- /dev/null
@@ -0,0 +1,19 @@
+// Copyright 2019 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 "./a"
+
+type No struct {
+       a.EDO
+}
+
+func X() No {
+       return No{}
+}
+
+func main() {
+       X()
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue31637.go b/gcc/testsuite/go.test/test/fixedbugs/issue31637.go
new file mode 100644 (file)
index 0000000..dcfb4a7
--- /dev/null
@@ -0,0 +1,11 @@
+// compiledir
+
+// Copyright 2019 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.
+
+// This directory contains a pair of packages that triggered
+// a compiler crash in gollvm (problem in handling an inlinable
+// method with unnamed parameter). See issue 31637 for details.
+
+package ignored
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue31777.go b/gcc/testsuite/go.test/test/fixedbugs/issue31777.go
new file mode 100644 (file)
index 0000000..839e242
--- /dev/null
@@ -0,0 +1,24 @@
+// compile
+
+// Copyright 2019 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.
+
+// Compile with static map literal.
+
+package p
+
+type i interface {
+       j()
+}
+
+type s struct{}
+
+func (s) j() {}
+
+type foo map[string]i
+
+var f = foo{
+       "1": s{},
+       "2": s{},
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue31782.go b/gcc/testsuite/go.test/test/fixedbugs/issue31782.go
new file mode 100644 (file)
index 0000000..a42001e
--- /dev/null
@@ -0,0 +1,24 @@
+// run
+
+// Copyright 2019 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 static composite literal reports wrong for struct
+// field.
+
+package main
+
+type one struct {
+       i interface{}
+}
+
+type two struct {
+       i interface{}
+       s []string
+}
+
+func main() {
+       o := one{i: two{i: 42}.i}
+       println(o.i.(int))
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue31782.out b/gcc/testsuite/go.test/test/fixedbugs/issue31782.out
new file mode 100644 (file)
index 0000000..d81cc07
--- /dev/null
@@ -0,0 +1 @@
+42
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue31987.go b/gcc/testsuite/go.test/test/fixedbugs/issue31987.go
new file mode 100644 (file)
index 0000000..372289b
--- /dev/null
@@ -0,0 +1,22 @@
+// run
+
+// Copyright 2019 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"
+
+type container struct {
+       Value string
+}
+
+func main() {
+       s := []container{
+               7: {Value: "string value"},
+       }
+       if s[7].Value != "string value" {
+               panic(fmt.Errorf("wanted \"string value\", got \"%s\"", s[7].Value))
+       }
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue32175.go b/gcc/testsuite/go.test/test/fixedbugs/issue32175.go
new file mode 100644 (file)
index 0000000..a677351
--- /dev/null
@@ -0,0 +1,22 @@
+// run
+
+// Copyright 2019 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
+
+// This used to print 0, because x was incorrectly captured by value.
+
+func f() (x int) {
+       defer func() func() {
+               return func() {
+                       println(x)
+               }
+       }()()
+       return 42
+}
+
+func main() {
+       f()
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue32175.out b/gcc/testsuite/go.test/test/fixedbugs/issue32175.out
new file mode 100644 (file)
index 0000000..d81cc07
--- /dev/null
@@ -0,0 +1 @@
+42
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue32288.go b/gcc/testsuite/go.test/test/fixedbugs/issue32288.go
new file mode 100644 (file)
index 0000000..91c930c
--- /dev/null
@@ -0,0 +1,48 @@
+// run
+
+// Copyright 2019 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 struct {
+       s   [1]string
+       pad [16]uintptr
+}
+
+//go:noinline
+func f(t *int, p *int) []T {
+       var res []T
+       for {
+               var e *T
+               res = append(res, *e)
+       }
+}
+
+func main() {
+       defer func() {
+               useStack(100) // force a stack copy
+               // We're expecting a panic.
+               // The bug in this issue causes a throw, which this recover() will not squash.
+               recover()
+       }()
+       junk() // fill the stack with invalid pointers
+       f(nil, nil)
+}
+
+func useStack(n int) {
+       if n == 0 {
+               return
+       }
+       useStack(n - 1)
+}
+
+//go:noinline
+func junk() uintptr {
+       var a [128]uintptr // 1k of bad pointers on the stack
+       for i := range a {
+               a[i] = 0xaa
+       }
+       return a[12]
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue32347.go b/gcc/testsuite/go.test/test/fixedbugs/issue32347.go
new file mode 100644 (file)
index 0000000..91c038a
--- /dev/null
@@ -0,0 +1,18 @@
+// compile
+
+// Copyright 2019 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 32347: gccgo compiler crashes with int-to-string conversion
+// with large integer constant operand.
+
+package p
+
+const (
+       X1 = string(128049)
+       X2 = string(-1)
+       X3 = string(1<<48)
+)
+
+var S1, S2, S3 = X1, X2, X3
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue32454.go b/gcc/testsuite/go.test/test/fixedbugs/issue32454.go
new file mode 100644 (file)
index 0000000..70895c9
--- /dev/null
@@ -0,0 +1,23 @@
+// compile
+
+// Copyright 2019 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 T struct {
+       s string
+       f float64
+}
+
+func f() {
+       var f float64
+       var st T
+       for {
+               switch &st.f {
+               case &f:
+                       f = 1
+               }
+       }
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue32560.go b/gcc/testsuite/go.test/test/fixedbugs/issue32560.go
new file mode 100644 (file)
index 0000000..c6f72b6
--- /dev/null
@@ -0,0 +1,51 @@
+// run
+
+// Copyright 2019 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.
+
+// Values smaller than 64-bits were mistakenly always proven to be
+// non-negative.
+//
+// The tests here are marked go:noinline to ensure they're
+// independently optimized by SSA.
+
+package main
+
+var x int32 = -1
+
+//go:noinline
+func a() {
+       if x != -1 {
+               panic(1)
+       }
+       if x > 0 || x != -1 {
+               panic(2)
+       }
+}
+
+//go:noinline
+func b() {
+       if x != -1 {
+               panic(3)
+       }
+       if x > 0 {
+               panic(4)
+       }
+}
+
+//go:noinline
+func c() {
+       if x > 0 || x != -1 {
+               panic(5)
+       }
+       if x > 0 || x != -1 {
+               panic(6)
+       }
+}
+
+func main() {
+       a()
+       b()
+       c()
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue32595.dir/a.go b/gcc/testsuite/go.test/test/fixedbugs/issue32595.dir/a.go
new file mode 100644 (file)
index 0000000..8342dd5
--- /dev/null
@@ -0,0 +1,9 @@
+// Copyright 2019 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
+
+func A() {
+       defer func() {}()
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue32595.dir/b.go b/gcc/testsuite/go.test/test/fixedbugs/issue32595.dir/b.go
new file mode 100644 (file)
index 0000000..9a13a57
--- /dev/null
@@ -0,0 +1,15 @@
+// Copyright 2019 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
+
+import "reflect"
+
+func B() {
+       t1 := reflect.TypeOf([0]byte{})
+       t2 := reflect.TypeOf(new([0]byte)).Elem()
+       if t1 != t2 {
+               panic("[0]byte types do not match")
+       }
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue32595.dir/main.go b/gcc/testsuite/go.test/test/fixedbugs/issue32595.dir/main.go
new file mode 100644 (file)
index 0000000..20472cd
--- /dev/null
@@ -0,0 +1,15 @@
+// Copyright 2019 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 (
+       "a"
+       "b"
+)
+
+func main() {
+       a.A()
+       b.B()
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue32595.go b/gcc/testsuite/go.test/test/fixedbugs/issue32595.go
new file mode 100644 (file)
index 0000000..af6f134
--- /dev/null
@@ -0,0 +1,7 @@
+// rundir
+
+// Copyright 2019 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/issue32680.go b/gcc/testsuite/go.test/test/fixedbugs/issue32680.go
new file mode 100644 (file)
index 0000000..27cba6b
--- /dev/null
@@ -0,0 +1,23 @@
+// run -gcflags=-d=ssa/check/on
+
+// Copyright 2019 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.
+
+// As of 2019-06, bug affects/ed amd64 and s390x.
+
+package main
+
+var foo = []byte{105, 57, 172, 152}
+
+func main() {
+       for i := 0; i < len(foo); i += 4 {
+               // Requires inlining and non-constant i
+               // Note the bug/fix also apply to different widths, but was unable to reproduce for those.
+               println(readLittleEndian32_2(foo[i], foo[i+1], foo[i+2], foo[i+3]))
+       }
+}
+
+func readLittleEndian32_2(a, b, c, d byte) uint32 {
+       return uint32(a) | (uint32(b) << 8) | (uint32(c) << 16) | (uint32(d) << 24)
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue32680.out b/gcc/testsuite/go.test/test/fixedbugs/issue32680.out
new file mode 100644 (file)
index 0000000..4d60a97
--- /dev/null
@@ -0,0 +1 @@
+2561423721
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue32680b.go b/gcc/testsuite/go.test/test/fixedbugs/issue32680b.go
new file mode 100644 (file)
index 0000000..61e5317
--- /dev/null
@@ -0,0 +1,16 @@
+// compile
+
+// Copyright 2019 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
+
+func hashBytesRaw(b0, b1, b2, b3, b7 byte) uint64 {
+       return (uint64(b0) | uint64(b1)<<8 | uint64(b2)<<16 | uint64(b3)<<24)
+}
+
+func doStuff(data []byte) uint64 {
+       return hashBytesRaw(data[0], data[1], data[2], data[3], data[7])
+
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue32723.go b/gcc/testsuite/go.test/test/fixedbugs/issue32723.go
new file mode 100644 (file)
index 0000000..850334d
--- /dev/null
@@ -0,0 +1,22 @@
+// errorcheck
+
+// Copyright 2019 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.
+
+// Complex literal comparison
+
+package p
+
+const x = 1i
+const y = 1i < 2i // ERROR "invalid operation: .*not defined on untyped complex|non-ordered type"
+const z = x < 2i  // ERROR "invalid operation: .*not defined on untyped complex|non-ordered type"
+
+func f() {
+       _ = 1i < 2i // ERROR "invalid operation: .*not defined on untyped complex|non-ordered type"
+       _ = 1i < 2  // ERROR "invalid operation: .*not defined on untyped complex|non-ordered type"
+       _ = 1 < 2i  // ERROR "invalid operation: .*not defined on untyped complex|non-ordered type"
+
+       c := 1i
+       _ = c < 2i // ERROR "invalid operation: .*not defined on complex128|non-ordered type"
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue32778.dir/a.go b/gcc/testsuite/go.test/test/fixedbugs/issue32778.dir/a.go
new file mode 100644 (file)
index 0000000..1e6ac01
--- /dev/null
@@ -0,0 +1,18 @@
+// Copyright 2019 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 "strings"
+
+type Name string
+
+type FullName string
+
+func (n FullName) Name() Name {
+       if i := strings.LastIndexByte(string(n), '.'); i >= 0 {
+               return Name(n[i+1:])
+       }
+       return Name(n)
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue32778.dir/b.go b/gcc/testsuite/go.test/test/fixedbugs/issue32778.dir/b.go
new file mode 100644 (file)
index 0000000..a0ee398
--- /dev/null
@@ -0,0 +1,11 @@
+// Copyright 2019 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
+
+import "./a"
+
+func Expo(fn a.FullName) a.Name {
+       return fn.Name()
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue32778.go b/gcc/testsuite/go.test/test/fixedbugs/issue32778.go
new file mode 100644 (file)
index 0000000..83456d4
--- /dev/null
@@ -0,0 +1,11 @@
+// compiledir
+
+// Copyright 2019 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.
+
+// This directory contains a pair of packages that triggers a compiler
+// crash in gccgo (problem with tracking indirectly referenced
+// packages during exporting). See issue 32778 for details.
+
+package ignored
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue32959.go b/gcc/testsuite/go.test/test/fixedbugs/issue32959.go
new file mode 100644 (file)
index 0000000..a0dc789
--- /dev/null
@@ -0,0 +1,17 @@
+// compile
+
+// Copyright 2019 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.
+
+// Test escape analysis with shifting constant
+
+package main
+
+import "unsafe"
+
+func main() {
+       var l uint64
+       var p unsafe.Pointer
+       _ = unsafe.Pointer(uintptr(p) + (uintptr(l) >> 1))
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue33020a.dir/a.go b/gcc/testsuite/go.test/test/fixedbugs/issue33020a.dir/a.go
new file mode 100644 (file)
index 0000000..9176498
--- /dev/null
@@ -0,0 +1,13 @@
+// Copyright 2019 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
+
+type FArg func(args []string) error
+
+type Command struct {
+       Name string
+       Arg1 FArg
+       Arg2 func(args []string) error
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue33020a.dir/b.go b/gcc/testsuite/go.test/test/fixedbugs/issue33020a.dir/b.go
new file mode 100644 (file)
index 0000000..5b0f9d8
--- /dev/null
@@ -0,0 +1,14 @@
+// Copyright 2019 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 "./a"
+
+var Cmd = &a.Command{
+       Name: "test",
+}
+
+func main() {
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue33020a.go b/gcc/testsuite/go.test/test/fixedbugs/issue33020a.go
new file mode 100644 (file)
index 0000000..cfe010e
--- /dev/null
@@ -0,0 +1,9 @@
+// compiledir
+
+// Copyright 2019 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 33020: gollvm assert in Llvm_backend::materializeComposite
+
+package ignored
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue33275.go b/gcc/testsuite/go.test/test/fixedbugs/issue33275.go
new file mode 100644 (file)
index 0000000..f2ec24d
--- /dev/null
@@ -0,0 +1,34 @@
+// skip
+
+// Copyright 2019 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"
+       "time"
+)
+
+func main() {
+       // Make a big map.
+       m := map[int]int{}
+       for i := 0; i < 100000; i++ {
+               m[i] = i
+       }
+       c := make(chan string)
+       go func() {
+               // Print the map.
+               s := fmt.Sprintln(m)
+               c <- s
+       }()
+       go func() {
+               time.Sleep(1 * time.Millisecond)
+               // Add an extra item to the map while iterating.
+               m[-1] = -1
+               c <- ""
+       }()
+       <-c
+       <-c
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue33275_run.go b/gcc/testsuite/go.test/test/fixedbugs/issue33275_run.go
new file mode 100644 (file)
index 0000000..f3e2e14
--- /dev/null
@@ -0,0 +1,25 @@
+// +build !nacl,!js
+// run
+
+// Copyright 2019 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.
+
+// Make sure we don't get an index out of bounds error
+// while trying to print a map that is concurrently modified.
+// The runtime might complain (throw) if it detects the modification,
+// so we have to run the test as a subprocess.
+
+package main
+
+import (
+       "os/exec"
+       "strings"
+)
+
+func main() {
+       out, _ := exec.Command("go", "run", "fixedbugs/issue33275.go").CombinedOutput()
+       if strings.Contains(string(out), "index out of range") {
+               panic(`go run issue33275.go reported "index out of range"`)
+       }
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue33308.go b/gcc/testsuite/go.test/test/fixedbugs/issue33308.go
new file mode 100644 (file)
index 0000000..5821099
--- /dev/null
@@ -0,0 +1,12 @@
+// errorcheck
+
+// Copyright 2020 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.
+
+// Test that the compiler does not crash on a []byte conversion of an
+// untyped expression.
+package p
+
+var v uint
+var x = []byte((1 << v) + 1) // ERROR "cannot convert|non-integer type for left operand of shift"
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue33355.go b/gcc/testsuite/go.test/test/fixedbugs/issue33355.go
new file mode 100644 (file)
index 0000000..c4b1e2e
--- /dev/null
@@ -0,0 +1,147 @@
+// compile
+
+// Copyright 2019 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.
+
+// This code failed on arm64 in the register allocator.
+// See issue 33355.
+
+package server
+
+import (
+       "bytes"
+       "sync"
+)
+
+type client struct {
+       junk [4]int
+       mu   sync.Mutex
+       srv  *Server
+       gw   *gateway
+       msgb [100]byte
+}
+
+type gateway struct {
+       cfg    *gatewayCfg
+       outsim *sync.Map
+}
+
+type gatewayCfg struct {
+       replyPfx []byte
+}
+
+type Account struct {
+       Name string
+}
+
+type Server struct {
+       gateway *srvGateway
+}
+
+type srvGateway struct {
+       outo     []*client
+}
+
+type subscription struct {
+       queue   []byte
+       client  *client
+}
+
+type outsie struct {
+       ni    map[string]struct{}
+       sl    *Sublist
+       qsubs int
+}
+
+type Sublist struct {
+}
+
+type SublistResult struct {
+       psubs []*subscription
+       qsubs [][]*subscription
+}
+
+var subPool = &sync.Pool{}
+
+func (c *client) sendMsgToGateways(acc *Account, msg, subject, reply []byte, qgroups [][]byte) {
+       var gws []*client
+       gw := c.srv.gateway
+       for i := 0; i < len(gw.outo); i++ {
+               gws = append(gws, gw.outo[i])
+       }
+       var (
+               subj       = string(subject)
+               queuesa    = [512]byte{}
+               queues     = queuesa[:0]
+               mreply     []byte
+               dstPfx     []byte
+               checkReply = len(reply) > 0
+       )
+
+       sub := subPool.Get().(*subscription)
+
+       if subjectStartsWithGatewayReplyPrefix(subject) {
+               dstPfx = subject[:8]
+       }
+       for i := 0; i < len(gws); i++ {
+               gwc := gws[i]
+               if dstPfx != nil {
+                       gwc.mu.Lock()
+                       ok := bytes.Equal(dstPfx, gwc.gw.cfg.replyPfx)
+                       gwc.mu.Unlock()
+                       if !ok {
+                               continue
+                       }
+               } else {
+                       qr := gwc.gatewayInterest(acc.Name, subj)
+                       queues = queuesa[:0]
+                       for i := 0; i < len(qr.qsubs); i++ {
+                               qsubs := qr.qsubs[i]
+                               queue := qsubs[0].queue
+                               add := true
+                               for _, qn := range qgroups {
+                                       if bytes.Equal(queue, qn) {
+                                               add = false
+                                               break
+                                       }
+                               }
+                               if add {
+                                       qgroups = append(qgroups, queue)
+                               }
+                       }
+                       if len(queues) == 0 {
+                               continue
+                       }
+               }
+               if checkReply {
+                       checkReply = false
+                       mreply = reply
+               }
+               mh := c.msgb[:10]
+               mh = append(mh, subject...)
+               if len(queues) > 0 {
+                       mh = append(mh, mreply...)
+                       mh = append(mh, queues...)
+               }
+               sub.client = gwc
+       }
+       subPool.Put(sub)
+}
+
+func subjectStartsWithGatewayReplyPrefix(subj []byte) bool {
+       return len(subj) > 8 && string(subj[:4]) == "foob"
+}
+
+func (c *client) gatewayInterest(acc, subj string) *SublistResult {
+       ei, _ := c.gw.outsim.Load(acc)
+       var r *SublistResult
+       e := ei.(*outsie)
+       r = e.sl.Match(subj)
+       return r
+}
+
+func (s *Sublist) Match(subject string) *SublistResult {
+       return nil
+}
+
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue33386.go b/gcc/testsuite/go.test/test/fixedbugs/issue33386.go
new file mode 100644 (file)
index 0000000..7b2f565
--- /dev/null
@@ -0,0 +1,29 @@
+// errorcheck
+
+// Copyright 2019 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.
+
+// Verify that we don't get spurious follow-on errors
+// after a missing expression. Specifically, the parser
+// shouldn't skip over closing parentheses of any kind.
+
+package p
+
+func _() {
+       go func() {     // no error here about goroutine
+               send <- // GCCGO_ERROR "undefined name"
+       }()             // ERROR "expecting expression|expected operand"
+}
+
+func _() {
+       defer func() { // no error here about deferred function
+               1 +    // GCCGO_ERROR "value computed is not used"
+       }()            // ERROR "expecting expression|expected operand"
+}
+
+func _() {
+       _ = (1 +)             // ERROR "expecting expression|expected operand"
+       _ = a[2 +]            // ERROR "expecting expression|expected operand|undefined name"
+       _ = []int{1, 2, 3 + } // ERROR "expecting expression|expected operand"
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue33438.go b/gcc/testsuite/go.test/test/fixedbugs/issue33438.go
new file mode 100644 (file)
index 0000000..e4206d7
--- /dev/null
@@ -0,0 +1,19 @@
+// compile
+
+// Copyright 2019 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 hasPtrs struct {
+        x [2]*int
+       // Note: array size needs to be >1 to force this type to be not SSAable.
+       // The bug triggers only for OpMove, which is only used for unSSAable types.
+}
+
+func main() {
+        var x *hasPtrs       // Can be local, global, or arg; nil or non-nil.
+        var y *hasPtrs = nil // Must initialize to nil.
+        *x = *y
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue33460.go b/gcc/testsuite/go.test/test/fixedbugs/issue33460.go
new file mode 100644 (file)
index 0000000..d90b0a4
--- /dev/null
@@ -0,0 +1,37 @@
+// errorcheck
+
+// Copyright 2019 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
+
+const (
+       zero = iota
+       one
+       two
+       three
+)
+
+const iii int = 0x3
+
+func f(v int) {
+       switch v {
+       case zero, one:
+       case two, one: // ERROR "previous case at LINE-1|duplicate case in switch"
+
+       case three:
+       case 3: // ERROR "previous case at LINE-1|duplicate case in switch"
+       case iii: // ERROR "previous case at LINE-2|duplicate case in switch"
+       }
+}
+
+const b = "b"
+
+var _ = map[string]int{
+       "a": 0,
+       b:   1,
+       "a": 2, // ERROR "previous key at LINE-2|duplicate key in map literal"
+       "b": 3, // GC_ERROR "previous key at LINE-2"
+       "b": 4, // GC_ERROR "previous key at LINE-3"
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue33555.go b/gcc/testsuite/go.test/test/fixedbugs/issue33555.go
new file mode 100644 (file)
index 0000000..7debd20
--- /dev/null
@@ -0,0 +1,81 @@
+// +build !nacl,!js
+// run
+
+// Copyright 2019 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.
+
+// Test that the linker permits long call sequences.
+package main
+
+import (
+       "bytes"
+       "fmt"
+       "io/ioutil"
+       "os"
+       "os/exec"
+       "path/filepath"
+       "strconv"
+)
+
+const start = `
+package main
+
+func main() {
+       println(f0() + 1)
+}
+`
+
+const fn = `
+//go:noinline
+func f%d() int {
+       return f%d() + 1
+}`
+
+const fnlast = `
+//go:noinline
+func f%d() int {
+       return 0
+}
+`
+
+const count = 400
+
+func main() {
+       if err := test(); err != nil {
+               fmt.Fprintln(os.Stderr, err)
+               os.Exit(1)
+       }
+}
+
+func test() error {
+       var buf bytes.Buffer
+       buf.WriteString(start)
+       for i := 0; i < count; i++ {
+               fmt.Fprintf(&buf, fn, i, i + 1)
+       }
+       fmt.Fprintf(&buf, fnlast, count)
+
+       dir, err := ioutil.TempDir("", "issue33555")
+       if err != nil {
+               return err
+       }
+       defer os.RemoveAll(dir)
+
+       fn := filepath.Join(dir, "x.go")
+       if err := ioutil.WriteFile(fn, buf.Bytes(), 0644); err != nil {
+               return err
+       }
+
+       out, err := exec.Command("go", "run", fn).CombinedOutput()
+       if err != nil {
+               return err
+       }
+
+       want := strconv.Itoa(count + 1)
+       if got := string(bytes.TrimSpace(out)); got != want {
+               return fmt.Errorf("got %q want %q", got, want)
+       }
+
+       return nil
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue33724.go b/gcc/testsuite/go.test/test/fixedbugs/issue33724.go
new file mode 100644 (file)
index 0000000..a4ecddc
--- /dev/null
@@ -0,0 +1,45 @@
+// run
+package main
+
+import (
+       "fmt"
+       "runtime/debug"
+       "strings"
+)
+
+type Inner struct {
+       Err int
+}
+
+func (i *Inner) NotExpectedInStackTrace() int {
+       if i == nil {
+               return 86
+       }
+       return 17 + i.Err
+}
+
+type Outer struct {
+       Inner
+}
+
+func ExpectedInStackTrace() {
+       var o *Outer
+       println(o.NotExpectedInStackTrace())
+}
+
+func main() {
+    defer func() {
+        if r := recover(); r != nil {
+               stacktrace := string(debug.Stack())
+               if strings.Contains(stacktrace, "NotExpectedInStackTrace") {
+                       fmt.Println("FAIL, stacktrace contains NotExpectedInStackTrace")
+               }
+               if !strings.Contains(stacktrace, "ExpectedInStackTrace") {
+                       fmt.Println("FAIL, stacktrace does not contain ExpectedInStackTrace")
+               }
+        } else {
+               fmt.Println("FAIL, should have panicked but did not")
+        }
+    }()
+    ExpectedInStackTrace()
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue33866.dir/a.go b/gcc/testsuite/go.test/test/fixedbugs/issue33866.dir/a.go
new file mode 100644 (file)
index 0000000..9c782c5
--- /dev/null
@@ -0,0 +1,18 @@
+// Copyright 2019 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
+
+type Builder struct {
+       x int
+}
+
+func (tb Builder) Build() (out struct {
+       x interface{}
+       s string
+}) {
+       out.x = nil
+       out.s = "hello!"
+       return
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue33866.dir/b.go b/gcc/testsuite/go.test/test/fixedbugs/issue33866.dir/b.go
new file mode 100644 (file)
index 0000000..aa2a322
--- /dev/null
@@ -0,0 +1,15 @@
+// Copyright 2019 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
+
+import "./a"
+
+type (
+       ABuilder = a.Builder
+)
+
+func Bfunc() ABuilder {
+       return ABuilder{}
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue33866.go b/gcc/testsuite/go.test/test/fixedbugs/issue33866.go
new file mode 100644 (file)
index 0000000..220c732
--- /dev/null
@@ -0,0 +1,9 @@
+// compiledir
+
+// Copyright 2019 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 33866: assert in gccgo during compilation
+
+package ignored
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue33903.go b/gcc/testsuite/go.test/test/fixedbugs/issue33903.go
new file mode 100644 (file)
index 0000000..de03282
--- /dev/null
@@ -0,0 +1,16 @@
+// compile
+
+// Copyright 2019 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 the shortcircuit pass correctly handles infinite loops.
+
+package p
+
+func f() {
+       var p, q bool
+       for {
+               p = p && q
+       }
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue34123.go b/gcc/testsuite/go.test/test/fixedbugs/issue34123.go
new file mode 100644 (file)
index 0000000..f50cd02
--- /dev/null
@@ -0,0 +1,43 @@
+// run
+
+// Copyright 2019 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.
+
+// Make sure that the line number is reported correctly
+// for faulting instructions.
+
+package main
+
+import (
+       "fmt"
+       "runtime"
+)
+
+var x byte
+var p *byte
+
+//go:noinline
+func f() {
+       q := p
+       x = 11  // line 23
+       *q = 12 // line 24
+}
+func main() {
+       defer func() {
+               recover()
+               var pcs [10]uintptr
+               n := runtime.Callers(1, pcs[:])
+               frames := runtime.CallersFrames(pcs[:n])
+               for {
+                       f, more := frames.Next()
+                       if f.Function == "main.f" && f.Line != 24 {
+                               panic(fmt.Errorf("expected line 24, got line %d", f.Line))
+                       }
+                       if !more {
+                               break
+                       }
+               }
+       }()
+       f()
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue34395.go b/gcc/testsuite/go.test/test/fixedbugs/issue34395.go
new file mode 100644 (file)
index 0000000..eb5a855
--- /dev/null
@@ -0,0 +1,17 @@
+// run
+
+// Copyright 2019 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.
+
+// Test that a binary with a large data section can load. This failed on wasm.
+
+package main
+
+var test = [100 * 1024 * 1024]byte{42}
+
+func main() {
+       if test[0] != 42 {
+               panic("bad")
+       }
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue34520.go b/gcc/testsuite/go.test/test/fixedbugs/issue34520.go
new file mode 100644 (file)
index 0000000..d92d4cc
--- /dev/null
@@ -0,0 +1,12 @@
+// compile
+
+// Copyright 2019 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
+
+func f() {
+       for true {
+       }
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue34968.go b/gcc/testsuite/go.test/test/fixedbugs/issue34968.go
new file mode 100644 (file)
index 0000000..6b1dbd1
--- /dev/null
@@ -0,0 +1,15 @@
+// +build cgo
+// run -gcflags=all=-d=checkptr
+
+// Copyright 2019 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
+
+// #include <stdlib.h>
+import "C"
+
+func main() {
+       C.malloc(100)
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue35027.go b/gcc/testsuite/go.test/test/fixedbugs/issue35027.go
new file mode 100644 (file)
index 0000000..d4b0be5
--- /dev/null
@@ -0,0 +1,23 @@
+// run -gcflags=-d=checkptr
+
+// Copyright 2019 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 (
+       "reflect"
+       "unsafe"
+)
+
+var s []int
+
+func main() {
+       s = []int{42}
+       h := (*reflect.SliceHeader)(unsafe.Pointer(&s))
+       x := *(*int)(unsafe.Pointer(h.Data))
+       if x != 42 {
+               panic(x)
+       }
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue35073.go b/gcc/testsuite/go.test/test/fixedbugs/issue35073.go
new file mode 100644 (file)
index 0000000..dc8ce3a
--- /dev/null
@@ -0,0 +1,23 @@
+// run -gcflags=-d=checkptr
+
+// Copyright 2020 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.
+
+// Test that reflect.Value.UnsafeAddr/Pointer is handled
+// correctly by -d=checkptr
+
+package main
+
+import (
+       "reflect"
+       "unsafe"
+)
+
+func main() {
+       n := 10
+       m := make(map[string]string)
+
+       _ = unsafe.Pointer(reflect.ValueOf(&n).Elem().UnsafeAddr())
+       _ = unsafe.Pointer(reflect.ValueOf(&m).Elem().Pointer())
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue35157.go b/gcc/testsuite/go.test/test/fixedbugs/issue35157.go
new file mode 100644 (file)
index 0000000..c9c4899
--- /dev/null
@@ -0,0 +1,20 @@
+// compile
+
+// Copyright 2019 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
+
+func f() {
+       var i int
+       var b *bool
+       var s0, s1, s2 string
+
+       if *b {
+               s2 = s2[:1]
+               i = 1
+       }
+       s1 = s1[i:-i+i] + s1[-i+i:i+2]
+       s1 = s0[i:-i]
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue35291.go b/gcc/testsuite/go.test/test/fixedbugs/issue35291.go
new file mode 100644 (file)
index 0000000..5d8381c
--- /dev/null
@@ -0,0 +1,14 @@
+// errorcheck
+
+// Copyright 2019 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 error message for duplicated index in slice literal
+
+package p
+
+var s = []string{
+       1: "dup",
+       1: "dup", // ERROR "duplicate index in slice literal: 1|duplicate value for index 1"
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue35576.go b/gcc/testsuite/go.test/test/fixedbugs/issue35576.go
new file mode 100644 (file)
index 0000000..8228555
--- /dev/null
@@ -0,0 +1,16 @@
+// run
+
+// Copyright 2019 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 print/println(f()) is allowed where f() is multi-value.
+
+package main
+
+func f() (int16, float64, string) { return -42, 42.0, "x" }
+
+func main() {
+       print(f())
+       println(f())
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue35576.out b/gcc/testsuite/go.test/test/fixedbugs/issue35576.out
new file mode 100644 (file)
index 0000000..2aefe3e
--- /dev/null
@@ -0,0 +1 @@
+-42+4.200000e+001x-42 +4.200000e+001 x
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue35586.dir/a.go b/gcc/testsuite/go.test/test/fixedbugs/issue35586.dir/a.go
new file mode 100644 (file)
index 0000000..f509b25
--- /dev/null
@@ -0,0 +1,9 @@
+// Copyright 2019 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
+
+func D(_ string, _ int) (uint64, string) {
+       return 101, "bad"
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue35586.dir/b.go b/gcc/testsuite/go.test/test/fixedbugs/issue35586.dir/b.go
new file mode 100644 (file)
index 0000000..e8b674f
--- /dev/null
@@ -0,0 +1,11 @@
+// Copyright 2019 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
+
+import "a"
+
+func F(addr string) (uint64, string) {
+       return a.D(addr, 32)
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue35586.go b/gcc/testsuite/go.test/test/fixedbugs/issue35586.go
new file mode 100644 (file)
index 0000000..0d522b1
--- /dev/null
@@ -0,0 +1,11 @@
+// compiledir
+
+// Copyright 2019 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 35586: gollvm compiler crash building docker-ce; the problem
+// involves inlining a function that has multiple no-name ("_") parameters.
+//
+
+package ignored
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue35652.go b/gcc/testsuite/go.test/test/fixedbugs/issue35652.go
new file mode 100644 (file)
index 0000000..178a84d
--- /dev/null
@@ -0,0 +1,28 @@
+// compile
+
+// Copyright 2019 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
+
+func e() {
+       for true {
+               if true {
+                       continue
+               }
+       }
+}
+
+func g() {}
+
+func f() {
+       i := 0
+       if true {
+               i++
+       }
+       for true {
+               continue
+               g()
+       }
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue36085.dir/a.go b/gcc/testsuite/go.test/test/fixedbugs/issue36085.dir/a.go
new file mode 100644 (file)
index 0000000..07cabcd
--- /dev/null
@@ -0,0 +1,3 @@
+package a
+
+type W = map[int32]interface{}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue36085.dir/b.go b/gcc/testsuite/go.test/test/fixedbugs/issue36085.dir/b.go
new file mode 100644 (file)
index 0000000..c5ee269
--- /dev/null
@@ -0,0 +1,8 @@
+package main
+
+import "a"
+
+var w a.W
+var X interface{} = &w
+
+func main() {}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue36085.go b/gcc/testsuite/go.test/test/fixedbugs/issue36085.go
new file mode 100644 (file)
index 0000000..69d4490
--- /dev/null
@@ -0,0 +1,11 @@
+// compiledir
+
+// Copyright 2019 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 36085: gccgo compiler did not generate type descriptor
+// for pointer to type alias defined in another package, causing
+// linking error.
+
+package ignored
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue36259.go b/gcc/testsuite/go.test/test/fixedbugs/issue36259.go
new file mode 100644 (file)
index 0000000..246eb35
--- /dev/null
@@ -0,0 +1,28 @@
+// compile
+
+// Copyright 2019 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 rotate(s []int, m int) {
+    l := len(s)
+    m = m % l
+    buf := make([]int, m)
+
+    copy(buf, s)
+    copy(s, s[m:])
+    copy(s[l-m:], buf)
+}
+
+func main() {
+    a0 := [...]int{1,2,3,4,5}
+    println(a0[0])
+
+    rotate(a0[:], 1)
+    println(a0[0])
+
+    rotate(a0[:], -3)
+    println(a0[0])
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue36437.go b/gcc/testsuite/go.test/test/fixedbugs/issue36437.go
new file mode 100644 (file)
index 0000000..f96544b
--- /dev/null
@@ -0,0 +1,49 @@
+// run
+
+// +build !nacl,!js
+
+// Copyright 2020 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.
+
+// Tests that when non-existent files are passed to the
+// compiler, such as in:
+//    go tool compile foo
+// we don't print the beginning position:
+//    foo:0: open foo: no such file or directory
+// but instead omit it and print out:
+//    open foo: no such file or directory
+
+package main
+
+import (
+       "fmt"
+       "io/ioutil"
+       "os"
+       "os/exec"
+       "regexp"
+)
+
+func main() {
+       tmpDir, err := ioutil.TempDir("", "issue36437")
+       if err != nil {
+               panic(err)
+       }
+       defer os.RemoveAll(tmpDir)
+
+       msgOrErr := func(msg []byte, err error) string {
+               if len(msg) == 0 && err != nil {
+                       return err.Error()
+               }
+               return string(msg)
+       }
+
+       filename := "non-existent.go"
+       output, err := exec.Command("go", "tool", "compile", filename).CombinedOutput()
+       got := msgOrErr(output, err)
+
+       regFilenamePos := regexp.MustCompile(filename + ":\\d+")
+       if regFilenamePos.MatchString(got) {
+               fmt.Printf("Error message must not contain filename:pos, but got:\n%q\n", got)
+       }
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue36516.go b/gcc/testsuite/go.test/test/fixedbugs/issue36516.go
new file mode 100644 (file)
index 0000000..d4e28b6
--- /dev/null
@@ -0,0 +1,27 @@
+// +build cgo,linux,amd64
+// run -race
+
+// Copyright 2020 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"
+       "testing"
+       "unsafe"
+)
+
+var buf [2]byte
+var x unsafe.Pointer = unsafe.Pointer(&buf[0])
+
+func main() {
+       n := testing.AllocsPerRun(1000, func() {
+               x = unsafe.Pointer(uintptr(x) + 1)
+               x = unsafe.Pointer(uintptr(x) - 1)
+       })
+       if n > 0 {
+               panic(fmt.Sprintf("too many allocations; want 0 got %f", n))
+       }
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue36705.go b/gcc/testsuite/go.test/test/fixedbugs/issue36705.go
new file mode 100644 (file)
index 0000000..83e4136
--- /dev/null
@@ -0,0 +1,27 @@
+// +build cgo
+// run
+
+// Copyright 2020 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
+
+// #include <stdlib.h>
+// #include <unistd.h>
+import "C"
+
+import "os"
+
+func main() {
+       os.Setenv("FOO", "bar")
+       s := C.GoString(C.getenv(C.CString("FOO")))
+       if s != "bar" {
+               panic("bad setenv, environment variable only has value \"" + s + "\"")
+       }
+       os.Unsetenv("FOO")
+       s = C.GoString(C.getenv(C.CString("FOO")))
+       if s != "" {
+               panic("bad unsetenv, environment variable still has value \"" + s + "\"")
+       }
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue37246.go b/gcc/testsuite/go.test/test/fixedbugs/issue37246.go
new file mode 100644 (file)
index 0000000..fe476da
--- /dev/null
@@ -0,0 +1,23 @@
+// compile
+
+// Copyright 2020 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() {
+       var n, a, b int64
+       for i := int64(2); i < 10; i++ {
+               for j := i; j < 10; j++ {
+                       if ((n % (i * j)) == 0) && (j > 1 && (n/(i*j)) == 1) {
+                               a, b = i, 0
+                               a = n / (i * j)
+                       }
+               }
+       }
+
+       if a != b && a != n {
+               println("yes")
+       }
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue37716.go b/gcc/testsuite/go.test/test/fixedbugs/issue37716.go
new file mode 100644 (file)
index 0000000..42d66df
--- /dev/null
@@ -0,0 +1,32 @@
+// run
+
+// Copyright 2020 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 "reflect"
+
+// complicated enough to require a compile-generated hash function
+type K struct {
+       a, b int32 // these get merged by the compiler into a single field, something typehash doesn't do
+       c    float64
+}
+
+func main() {
+       k := K{a: 1, b: 2, c: 3}
+
+       // Make a reflect map.
+       m := reflect.MakeMap(reflect.MapOf(reflect.TypeOf(K{}), reflect.TypeOf(true)))
+       m.SetMapIndex(reflect.ValueOf(k), reflect.ValueOf(true))
+
+       // The binary must not contain the type map[K]bool anywhere, or reflect.MapOf
+       // will use that type instead of making a new one. So use an equivalent named type.
+       type M map[K]bool
+       var x M
+       reflect.ValueOf(&x).Elem().Set(m)
+       if !x[k] {
+               panic("key not found")
+       }
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue37753.go b/gcc/testsuite/go.test/test/fixedbugs/issue37753.go
new file mode 100644 (file)
index 0000000..ac311e3
--- /dev/null
@@ -0,0 +1,18 @@
+// run
+
+// Copyright 2020 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
+
+//go:noinline
+func f(a, b uint) int {
+       return int(a-b) / 8
+}
+
+func main() {
+       if x := f(1, 2); x != 0 {
+               panic(x)
+       }
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue37975.go b/gcc/testsuite/go.test/test/fixedbugs/issue37975.go
new file mode 100644 (file)
index 0000000..a4e8f1f
--- /dev/null
@@ -0,0 +1,54 @@
+// run
+
+// Copyright 2020 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.
+
+// Make sure runtime.panicmakeslice* are called.
+
+package main
+
+import "strings"
+
+func main() {
+       // Test typechecking passes if len is valid
+       // but cap is out of range for len's type.
+       var x byte
+       _ = make([]int, x, 300)
+
+       capOutOfRange := func() {
+               i := 2
+               s := make([]int, i, 1)
+               s[0] = 1
+       }
+       lenOutOfRange := func() {
+               i := -1
+               s := make([]int, i, 3)
+               s[0] = 1
+       }
+
+       tests := []struct {
+               f        func()
+               panicStr string
+       }{
+               {capOutOfRange, "cap out of range"},
+               {lenOutOfRange, "len out of range"},
+       }
+
+       for _, tc := range tests {
+               shouldPanic(tc.panicStr, tc.f)
+       }
+
+}
+
+func shouldPanic(str string, f func()) {
+       defer func() {
+               err := recover()
+               runtimeErr := err.(error).Error()
+               if !strings.Contains(runtimeErr, str) {
+                       panic("got panic " + runtimeErr + ", want " + str)
+               }
+       }()
+
+       f()
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue38093.go b/gcc/testsuite/go.test/test/fixedbugs/issue38093.go
new file mode 100644 (file)
index 0000000..db92664
--- /dev/null
@@ -0,0 +1,49 @@
+// +build js
+// run
+
+// Copyright 2020 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.
+
+// Test race condition between timers and wasm calls that led to memory corruption.
+
+package main
+
+import (
+       "os"
+       "syscall/js"
+       "time"
+)
+
+func main() {
+       ch1 := make(chan struct{})
+
+       go func() {
+               for {
+                       time.Sleep(5 * time.Millisecond)
+                       ch1 <- struct{}{}
+               }
+       }()
+       go func() {
+               for {
+                       time.Sleep(8 * time.Millisecond)
+                       ch1 <- struct{}{}
+               }
+       }()
+       go func() {
+               time.Sleep(2 * time.Second)
+               os.Exit(0)
+       }()
+
+       for range ch1 {
+               ch2 := make(chan struct{}, 1)
+               f := js.FuncOf(func(this js.Value, args []js.Value) interface{} {
+                       ch2 <- struct{}{}
+                       return nil
+               })
+               defer f.Release()
+               fn := js.Global().Get("Function").New("cb", "cb();")
+               fn.Invoke(f)
+               <-ch2
+       }
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue38117.go b/gcc/testsuite/go.test/test/fixedbugs/issue38117.go
new file mode 100644 (file)
index 0000000..11edef7
--- /dev/null
@@ -0,0 +1,17 @@
+// errorcheck
+
+// Copyright 2020 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.
+
+// cmd/compile erroneously rejected conversions of constant values
+// between int/float and complex types.
+
+package p
+
+const (
+       _ = int(complex64(int(0)))
+       _ = float64(complex128(float64(0)))
+
+       _ = int8(complex128(1000)) // ERROR "overflow"
+)
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue38356.go b/gcc/testsuite/go.test/test/fixedbugs/issue38356.go
new file mode 100644 (file)
index 0000000..a1c7f46
--- /dev/null
@@ -0,0 +1,54 @@
+// compile
+
+// Copyright 2020 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.
+
+// Make sure floating point operations that generate flags
+// are scheduled correctly on s390x.
+
+package p
+
+func f1(x, y float64, z int) float64 {
+       a := x + y  // generate flags
+       if z == 0 { // create basic block that does not clobber flags
+               return a
+       }
+       if a > 0 { // use flags in different basic block
+               return y
+       }
+       return x
+}
+
+func f2(x, y float64, z int) float64 {
+       a := x - y  // generate flags
+       if z == 0 { // create basic block that does not clobber flags
+               return a
+       }
+       if a > 0 { // use flags in different basic block
+               return y
+       }
+       return x
+}
+
+func f3(x, y float32, z int) float32 {
+       a := x + y  // generate flags
+       if z == 0 { // create basic block that does not clobber flags
+               return a
+       }
+       if a > 0 { // use flags in different basic block
+               return y
+       }
+       return x
+}
+
+func f4(x, y float32, z int) float32 {
+       a := x - y  // generate flags
+       if z == 0 { // create basic block that does not clobber flags
+               return a
+       }
+       if a > 0 { // use flags in different basic block
+               return y
+       }
+       return x
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue38359.go b/gcc/testsuite/go.test/test/fixedbugs/issue38359.go
new file mode 100644 (file)
index 0000000..a7550c7
--- /dev/null
@@ -0,0 +1,19 @@
+// compile
+
+// Copyright 2020 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.
+
+// Make sure NaN-NaN compiles correctly.
+
+package p
+
+func f() {
+       var st struct {
+               f    float64
+               _, _ string
+       }
+
+       f := 1e308
+       st.f = 2*f - 2*f
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue38690.go b/gcc/testsuite/go.test/test/fixedbugs/issue38690.go
new file mode 100644 (file)
index 0000000..af8688d
--- /dev/null
@@ -0,0 +1,65 @@
+// compile
+
+// Copyright 2020 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.
+
+// Make sure that literal value can be passed to struct
+// blank field of array/struct type, see issue #38690.
+
+package main
+
+type A1 = [0]int
+type A2 = [1]int
+
+type S1 struct{}
+
+type S2 struct {
+       x int
+}
+
+type S3 = struct{}
+
+type S4 = struct{ x int }
+
+type S struct {
+       x int
+       _ [0]int
+       _ [1]int
+       _ A1
+       _ A2
+       _ S1
+       _ S2
+       _ S3
+       _ S4
+       _ [1]S4
+}
+
+var s = S{1, [0]int{}, [1]int{1}, A1{}, A2{1}, S1{}, S2{1}, S3{}, S4{1}, [1]S4{}}
+
+func main() {
+       f1()
+       mustPanic(f2)
+       mustPanic(f3)
+}
+
+func f1() {
+       _ = S{1, [0]int{}, [1]int{1}, A1{}, A2{1}, S1{}, S2{1}, S3{}, S4{1}, [1]S4{}}
+}
+
+func f2() {
+       _ = S{1, [0]int{}, [1]int{1}, A1{}, A2{1}, S1{}, S2{1}, S3{}, func() S4 { panic("") }(), [1]S4{}}
+}
+
+func f3() {
+       _ = S{1, [0]int{}, [1]int{1}, A1{}, A2{1}, S1{}, S2{1}, S3{}, S4{1}, func() [1]S4 { panic("") }()}
+}
+
+func mustPanic(f func()) {
+       defer func() {
+               if recover() == nil {
+                       panic("expected panic, got nil")
+               }
+       }()
+       f()
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue38745.go b/gcc/testsuite/go.test/test/fixedbugs/issue38745.go
new file mode 100644 (file)
index 0000000..7d4283b
--- /dev/null
@@ -0,0 +1,18 @@
+// errorcheck
+
+// Copyright 2020 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 t struct{ x int }
+
+func f1() {
+       t{}.M()     // ERROR "t{}.M undefined \(type t has no field or method M\)|undefined field or method .*M"
+       t{x: 1}.M() // ERROR "t{...}.M undefined \(type t has no field or method M\)|undefined field or method .*M"
+}
+
+func f2() (*t, error) {
+       return t{}.M() // ERROR "t{}.M undefined \(type t has no field or method M\)|undefined field or method .*M|not enough arguments"
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue38746.go b/gcc/testsuite/go.test/test/fixedbugs/issue38746.go
new file mode 100644 (file)
index 0000000..c670349
--- /dev/null
@@ -0,0 +1,17 @@
+// compile
+
+// Copyright 2020 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 g *uint64
+
+func main() {
+       var v uint64
+       g = &v
+       v &^= (1 << 31)
+       v |= 1 << 63
+       v &^= (1 << 63)
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue38905.go b/gcc/testsuite/go.test/test/fixedbugs/issue38905.go
new file mode 100644 (file)
index 0000000..6f411b8
--- /dev/null
@@ -0,0 +1,18 @@
+// compile
+
+// Copyright 2020 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.
+
+// Make sure that literal value can be passed to struct
+// blank field with expressions where candiscard(value)
+// returns false, see #38905.
+
+package p
+
+type t struct{ _ u }
+type u [10]struct{ f int }
+
+func f(x int) t   { return t{u{{1 / x}, {1 % x}}} }
+func g(p *int) t  { return t{u{{*p}}} }
+func h(s []int) t { return t{u{{s[0]}}} }
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue38916.go b/gcc/testsuite/go.test/test/fixedbugs/issue38916.go
new file mode 100644 (file)
index 0000000..fb2ee34
--- /dev/null
@@ -0,0 +1,14 @@
+// compile
+
+// Copyright 2020 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
+
+func f(b bool, c complex128) func(complex128) complex128 {
+       return func(p complex128) complex128 {
+               b = (p+1i == 0) && b
+               return (p + 2i) * (p + 3i - c)
+       }
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue39292.go b/gcc/testsuite/go.test/test/fixedbugs/issue39292.go
new file mode 100644 (file)
index 0000000..7dac2e5
--- /dev/null
@@ -0,0 +1,29 @@
+// errorcheck -0 -m -l
+
+// Copyright 2020 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 t [20000]*int
+
+func (t) f() {
+}
+
+func x() {
+       x := t{}.f // ERROR "t{}.f escapes to heap"
+       x()
+}
+
+func y() {
+       var i int       // ERROR "moved to heap: i"
+       y := (&t{&i}).f // ERROR "\(&t{...}\).f escapes to heap" "&t{...} escapes to heap"
+       y()
+}
+
+func z() {
+       var i int    // ERROR "moved to heap: i"
+       z := t{&i}.f // ERROR "t{...}.f escapes to heap"
+       z()
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue39459.go b/gcc/testsuite/go.test/test/fixedbugs/issue39459.go
new file mode 100644 (file)
index 0000000..de78a17
--- /dev/null
@@ -0,0 +1,22 @@
+// compile
+
+// Copyright 2020 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 T struct { // big enough to be an unSSAable type
+       a, b, c, d, e, f int
+}
+
+func f(x interface{}, p *int) {
+       _ = *p // trigger nil check here, removing it from below
+       switch x := x.(type) {
+       case *T:
+               // Zero twice, so one of them will be removed by the deadstore pass
+               *x = T{}
+               *p = 0 // store op to prevent Zero ops from being optimized by the earlier opt pass rewrite rules
+               *x = T{}
+       }
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue39505.go b/gcc/testsuite/go.test/test/fixedbugs/issue39505.go
new file mode 100644 (file)
index 0000000..711b562
--- /dev/null
@@ -0,0 +1,31 @@
+// compile
+
+// Copyright 2020 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
+
+func f() {
+       if len([]int{})-1 < len([]int{}) {
+       }
+
+       var st struct {
+               i int
+       }
+       g := func() string {
+               return ""
+       }
+       h := func(string) string {
+               return g() + g()
+       }
+       s, i := "", 0
+
+       st.i = len(s)
+       i = len(h(s[i+0:i+1])) + len(s[len(s)+1:i+1])
+       s = s[(len(s[i+1:len(s)+1])+1):len(h(""))+1] + (s[i+1 : len([]int{})+i])
+       i = 1 + len([]int{len([]string{s[i+len([]int{}) : len(s)+i]})})
+
+       var ch chan int
+       ch <- len(h("")) - len(s)
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue39505b.go b/gcc/testsuite/go.test/test/fixedbugs/issue39505b.go
new file mode 100644 (file)
index 0000000..ecf1ab6
--- /dev/null
@@ -0,0 +1,183 @@
+// run
+
+// Copyright 2020 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() {
+       ff := []func(){lt_f1, lt_f2, lt_f3, lt_f4, lt_f5, lt_f6, lt_f7, lt_f8, lt_f9,
+               gt_f1, gt_f2, gt_f3, le_f1, le_f2, le_f3, ge_f1, ge_f2, ge_f3}
+
+       for _, f := range ff {
+               f()
+       }
+}
+
+func lt_f1() {
+       const c = 1
+       var a = 0
+       var v *int = &a
+       if *v-c < len([]int{}) {
+       } else {
+               panic("bad")
+       }
+}
+
+func lt_f2() {
+       const c = 10
+       var a = 0
+       var v *int = &a
+       if *v+c < len([]int{}) {
+               panic("bad")
+       }
+}
+
+func lt_f3() {
+       const c = -10
+       var a = 0
+       var v *int = &a
+       if *v|0xff+c < len([]int{}) {
+               panic("bad")
+       }
+}
+
+func lt_f4() {
+       const c = 10
+       var a = 0
+       var v *int = &a
+       if *v|0x0f+c < len([]int{}) {
+               panic("bad")
+       }
+}
+
+func lt_f5() {
+       const c int32 = 1
+       var a int32 = 0
+       var v *int32 = &a
+       if *v-c < int32(len([]int32{})) {
+       } else {
+               panic("bad")
+       }
+}
+
+func lt_f6() {
+       const c int32 = 10
+       var a int32 = 0
+       var v *int32 = &a
+       if *v+c < int32(len([]int32{})) {
+               panic("bad")
+       }
+}
+
+func lt_f7() {
+       const c int32 = -10
+       var a int32 = 0
+       var v *int32 = &a
+       if *v|0xff+c < int32(len([]int{})) {
+               panic("bad")
+       }
+}
+
+func lt_f8() {
+       const c int32 = 10
+       var a int32 = 0
+       var v *int32 = &a
+       if *v|0x0f+c < int32(len([]int{})) {
+               panic("bad")
+       }
+}
+
+func lt_f9() {
+       const c int32 = -10
+       var a int32 = 0
+       var v *int32 = &a
+       if *v|0x0a+c < int32(len([]int{})) {
+               panic("bad")
+       }
+}
+
+func gt_f1() {
+       const c = 1
+       var a = 0
+       var v *int = &a
+       if len([]int{}) > *v-c {
+       } else {
+               panic("bad")
+       }
+}
+
+func gt_f2() {
+       const c = 10
+       var a = 0
+       var v *int = &a
+       if len([]int{}) > *v|0x0f+c {
+               panic("bad")
+       }
+}
+
+func gt_f3() {
+       const c int32 = 10
+       var a int32 = 0
+       var v *int32 = &a
+       if int32(len([]int{})) > *v|0x0f+c {
+               panic("bad")
+       }
+}
+
+func le_f1() {
+       const c = -10
+       var a = 0
+       var v *int = &a
+       if *v|0xff+c <= len([]int{}) {
+               panic("bad")
+       }
+}
+
+func le_f2() {
+       const c = 0xf
+       var a = 0
+       var v *int = &a
+       if *v|0xf-c <= len([]int{}) {
+       } else {
+               panic("bad")
+       }
+}
+
+func le_f3() {
+       const c int32 = -10
+       var a int32 = 0
+       var v *int32 = &a
+       if *v|0xff+c <= int32(len([]int{})) {
+               panic("bad")
+       }
+}
+
+func ge_f1() {
+       const c = -10
+       var a = 0
+       var v *int = &a
+       if len([]int{}) >= *v|0xff+c {
+               panic("bad")
+       }
+}
+
+func ge_f2() {
+       const c int32 = 10
+       var a int32 = 0
+       var v *int32 = &a
+       if int32(len([]int{})) >= *v|0x0f+c {
+               panic("bad")
+       }
+}
+
+func ge_f3() {
+       const c = -10
+       var a = 0
+       var v *int = &a
+       if len([]int{}) >= *v|0x0a+c {
+       } else {
+               panic("bad")
+       }
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue39541.go b/gcc/testsuite/go.test/test/fixedbugs/issue39541.go
new file mode 100644 (file)
index 0000000..fba5291
--- /dev/null
@@ -0,0 +1,33 @@
+// run
+
+// Copyright 2020 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 "reflect"
+
+func sub(args []reflect.Value) []reflect.Value {
+       type A struct {
+               s int
+               t int
+       }
+       return []reflect.Value{reflect.ValueOf(A{1, 2})}
+}
+
+func main() {
+       f := reflect.MakeFunc(reflect.TypeOf((func() interface{})(nil)), sub).Interface().(func() interface{})
+       c := make(chan bool, 100)
+       for i := 0; i < 100; i++ {
+               go func() {
+                       for j := 0; j < 10000; j++ {
+                               f()
+                       }
+                       c <- true
+               }()
+       }
+       for i := 0; i < 100; i++ {
+               <-c
+       }
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue39651.go b/gcc/testsuite/go.test/test/fixedbugs/issue39651.go
new file mode 100644 (file)
index 0000000..256a34d
--- /dev/null
@@ -0,0 +1,26 @@
+// run
+
+// Copyright 2020 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.
+
+// Test that float -> integer conversion doesn't clobber
+// flags.
+
+package main
+
+//go:noinline
+func f(x, y float64, a, b *bool, r *int64) {
+       *a = x < y    // set flags
+       *r = int64(x) // clobber flags
+       *b = x == y   // use flags
+}
+
+func main() {
+       var a, b bool
+       var r int64
+       f(1, 1, &a, &b, &r)
+       if a || !b {
+               panic("comparison incorrect")
+       }
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue40367.go b/gcc/testsuite/go.test/test/fixedbugs/issue40367.go
new file mode 100644 (file)
index 0000000..0dc5ad7
--- /dev/null
@@ -0,0 +1,41 @@
+// run
+
+// Copyright 2020 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 case1() {
+       rates := []int32{1,2,3,4,5,6}
+       var sink [6]int
+       j := len(sink)
+       for star, _ := range rates {
+               if star+1 < 1 {
+                       panic("")
+               }
+               j--
+               sink[j] = j
+       }
+}
+
+func case2() {
+       i := 0
+       var sink [3]int
+       j := len(sink)
+top:
+       j--
+       sink[j] = j
+       if i < 2 {
+               i++
+               if i < 1 {
+                       return
+               }
+               goto top
+       }
+}
+
+func main() {
+       case1()
+       case2()
+}
\ No newline at end of file
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue40629.go b/gcc/testsuite/go.test/test/fixedbugs/issue40629.go
new file mode 100644 (file)
index 0000000..c6ef408
--- /dev/null
@@ -0,0 +1,69 @@
+// run
+
+// Copyright 2020 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"
+
+const N = 40
+
+func main() {
+       var x [N]int // stack-allocated memory
+       for i := range x {
+               x[i] = 0x999
+       }
+
+       // This defer checks to see if x is uncorrupted.
+       defer func(p *[N]int) {
+               recover()
+               for i := range p {
+                       if p[i] != 0x999 {
+                               for j := range p {
+                                       fmt.Printf("p[%d]=0x%x\n", j, p[j])
+                               }
+                               panic("corrupted stack variable")
+                       }
+               }
+       }(&x)
+
+       // This defer starts a new goroutine, which will (hopefully)
+       // overwrite x on the garbage stack.
+       defer func() {
+               c := make(chan bool)
+               go func() {
+                       useStack(1000)
+                       c <- true
+               }()
+               <-c
+
+       }()
+
+       // This defer causes a stack copy.
+       // The old stack is now garbage.
+       defer func() {
+               useStack(1000)
+       }()
+
+       // Trigger a segfault.
+       *g = 0
+
+       // Make the return statement unreachable.
+       // That makes the stack map at the deferreturn call empty.
+       // In particular, the argument to the first defer is not
+       // marked as a pointer, so it doesn't get adjusted
+       // during the stack copy.
+       for {
+       }
+}
+
+var g *int64
+
+func useStack(n int) {
+       if n == 0 {
+               return
+       }
+       useStack(n - 1)
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue40746.go b/gcc/testsuite/go.test/test/fixedbugs/issue40746.go
new file mode 100644 (file)
index 0000000..235282f
--- /dev/null
@@ -0,0 +1,19 @@
+// compile
+
+// Copyright 2020 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
+
+func f(x byte, b bool) byte {
+       var c byte
+       if b {
+               c = 1
+       }
+
+       if int8(c) < 0 {
+               x++
+       }
+       return x
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue40917.go b/gcc/testsuite/go.test/test/fixedbugs/issue40917.go
new file mode 100644 (file)
index 0000000..2128be5
--- /dev/null
@@ -0,0 +1,23 @@
+// run -gcflags=-d=checkptr
+
+// Copyright 2020 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 x [2]uint64
+       a := unsafe.Pointer(&x[1])
+
+       b := a
+       b = unsafe.Pointer(uintptr(b) + 2)
+       b = unsafe.Pointer(uintptr(b) - 1)
+       b = unsafe.Pointer(uintptr(b) &^ 1)
+
+       if a != b {
+               panic("pointer arithmetic failed")
+       }
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue40954.go b/gcc/testsuite/go.test/test/fixedbugs/issue40954.go
new file mode 100644 (file)
index 0000000..53e9ccf
--- /dev/null
@@ -0,0 +1,35 @@
+// run
+
+// Copyright 2020 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"
+)
+
+//go:notinheap
+type S struct{ x int }
+
+func main() {
+       var i int
+       p := (*S)(unsafe.Pointer(uintptr(unsafe.Pointer(&i))))
+       v := uintptr(unsafe.Pointer(p))
+       // p is a pointer to a go:notinheap type. Like some C libraries,
+       // we stored an integer in that pointer. That integer just happens
+       // to be the address of i.
+       // v is also the address of i.
+       // p has a base type which is marked go:notinheap, so it
+       // should not be adjusted when the stack is copied.
+       recurse(100, p, v)
+}
+func recurse(n int, p *S, v uintptr) {
+       if n > 0 {
+               recurse(n-1, p, v)
+       }
+       if uintptr(unsafe.Pointer(p)) != v {
+               panic("adjusted notinheap pointer")
+       }
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue41247.go b/gcc/testsuite/go.test/test/fixedbugs/issue41247.go
new file mode 100644 (file)
index 0000000..c5e495b
--- /dev/null
@@ -0,0 +1,11 @@
+// errorcheck
+
+// Copyright 2020 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
+
+func f() [2]int {
+       return [...]int{2: 0} // ERROR "cannot use \[\.\.\.\]int{...} \(type \[3\]int\)|incompatible type"
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue41440.go b/gcc/testsuite/go.test/test/fixedbugs/issue41440.go
new file mode 100644 (file)
index 0000000..0d911f0
--- /dev/null
@@ -0,0 +1,14 @@
+// errorcheck
+
+// Copyright 2020 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
+
+func f(...int) {}
+
+func g() {
+       var x []int
+       f(x, x...) // ERROR "have \(\[\]int, \.\.\.int\)|too many arguments"
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue41500.go b/gcc/testsuite/go.test/test/fixedbugs/issue41500.go
new file mode 100644 (file)
index 0000000..82dca34
--- /dev/null
@@ -0,0 +1,20 @@
+// errorcheck
+
+// Copyright 2020 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 s struct {
+       slice []int
+}
+
+func f() {
+       var x *s
+
+       _ = x == nil || len(x.slice) // ERROR "invalid operation: .+ \(operator \|\| not defined on int\)|incompatible types"
+       _ = len(x.slice) || x == nil // ERROR "invalid operation: .+ \(operator \|\| not defined on int\)|incompatible types"
+       _ = x == nil && len(x.slice) // ERROR "invalid operation: .+ \(operator && not defined on int\)|incompatible types"
+       _ = len(x.slice) && x == nil // ERROR "invalid operation: .+ \(operator && not defined on int\)|incompatible types"
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue41575.go b/gcc/testsuite/go.test/test/fixedbugs/issue41575.go
new file mode 100644 (file)
index 0000000..4568730
--- /dev/null
@@ -0,0 +1,36 @@
+// errorcheck
+
+// Copyright 2020 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 T1 struct { // ERROR "invalid recursive type T1\n\tLINE: T1 refers to\n\tLINE+4: T2 refers to\n\tLINE: T1$|invalid recursive type"
+       f2 T2
+}
+
+type T2 struct { // GCCGO_ERROR "invalid recursive type"
+       f1 T1
+}
+
+type a b // GCCGO_ERROR "invalid recursive type"
+type b c // ERROR "invalid recursive type b\n\tLINE: b refers to\n\tLINE+1: c refers to\n\tLINE: b$|invalid recursive type"
+type c b // GCCGO_ERROR "invalid recursive type"
+
+type d e
+type e f
+type f f // ERROR "invalid recursive type f\n\tLINE: f refers to\n\tLINE: f$|invalid recursive type"
+
+type g struct { // ERROR "invalid recursive type g\n\tLINE: g refers to\n\tLINE: g$|invalid recursive type"
+       h struct {
+               g
+       }
+}
+
+type w x
+type x y           // ERROR "invalid recursive type x\n\tLINE: x refers to\n\tLINE+1: y refers to\n\tLINE+2: z refers to\n\tLINE: x$|invalid recursive type"
+type y struct{ z } // GCCGO_ERROR "invalid recursive type"
+type z [10]x
+
+type w2 w // refer to the type loop again
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue41680.go b/gcc/testsuite/go.test/test/fixedbugs/issue41680.go
new file mode 100644 (file)
index 0000000..9dfeb7d
--- /dev/null
@@ -0,0 +1,21 @@
+// compile
+
+// Copyright 2020 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
+
+func F(s string) bool {
+       const m = 16
+       const n = 1e5
+       _ = make([]int, n)
+       return len(s) < n*m
+}
+
+func G() {
+       const n = 1e5
+       _ = make([]int, n)
+       f := n
+       var _ float64 = f
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue41736.go b/gcc/testsuite/go.test/test/fixedbugs/issue41736.go
new file mode 100644 (file)
index 0000000..36f127f
--- /dev/null
@@ -0,0 +1,105 @@
+// compile
+
+// Copyright 2020 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 I struct {
+       x int64
+}
+
+type F struct {
+       x float64
+}
+
+type C struct {
+       x *complex128
+}
+
+type D struct {
+       x complex64
+}
+
+type A [1]*complex128
+
+//go:noinline
+func (i I) X() C {
+       cx := complex(0, float64(i.x))
+       return C{&cx}
+}
+
+//go:noinline
+func (f F) X() C {
+       cx := complex(f.x, 0)
+       return C{&cx}
+}
+
+//go:noinline
+func (c C) X() C {
+       cx := complex(imag(*c.x), real(*c.x))
+       return C{&cx}
+}
+
+//go:noinline
+func (d D) X() C {
+       cx := complex(float64(imag(d.x)), -float64(real(d.x)))
+       return C{&cx}
+}
+
+//go:noinline
+func (a A) X() C {
+       cx := complex(-float64(imag(*a[0])), float64(real(*a[0])))
+       return C{&cx}
+}
+
+//go:noinline
+func (i I) id() I {
+       return i
+}
+
+//go:noinline
+func (f F) id() F {
+       return f
+}
+
+//go:noinline
+func (c C) id() C {
+       return c
+}
+
+//go:noinline
+func (d D) id() D {
+       return d
+}
+
+//go:noinline
+func (a A) id() A {
+       return a
+}
+
+type T interface {
+       X() C
+}
+
+func G(x []T) []T {
+       var y []T
+       for _, a := range x {
+               var v T
+               switch u := a.(type) {
+               case I:
+                       v = u.id()
+               case F:
+                       v = u.id()
+               case C:
+                       v = u.id()
+               case D:
+                       v = u.id()
+               case A:
+                       v = u.id()
+               }
+               y = append(y, v)
+       }
+       return y
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue41780.go b/gcc/testsuite/go.test/test/fixedbugs/issue41780.go
new file mode 100644 (file)
index 0000000..632c144
--- /dev/null
@@ -0,0 +1,39 @@
+// run
+
+// Copyright 2020 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.
+
+// Checks that conversion of CMP(x,-y) -> CMN(x,y) is only applied in correct context.
+
+package main
+
+type decimal struct {
+       d  [8]byte // digits, big-endian representation
+       dp int     // decimal point
+}
+
+var powtab = []int{1, 3, 6, 9, 13, 16, 19, 23, 26}
+
+//go:noinline
+func foo(d *decimal) int {
+       exp := int(d.d[1])
+       if d.dp < 0 || d.dp == 0 && d.d[0] < '5' {
+               var n int
+               if -d.dp >= len(powtab) {
+                       n = 27
+               } else {
+                       n = powtab[-d.dp] // incorrect CMP -> CMN substitution causes indexing panic.
+               }
+               exp += n
+       }
+       return exp
+}
+
+func main() {
+       var d decimal
+       d.d[0] = '1'
+       if foo(&d) != 1 {
+               println("FAILURE (though not the one this test was written to catch)")
+       }
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue41872.go b/gcc/testsuite/go.test/test/fixedbugs/issue41872.go
new file mode 100644 (file)
index 0000000..837d61a
--- /dev/null
@@ -0,0 +1,26 @@
+// run
+
+// Copyright 2020 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
+
+//go:noinline
+func f8(x int32) bool {
+       return byte(x&0xc0) == 64
+}
+
+//go:noinline
+func f16(x int32) bool {
+       return uint16(x&0x8040) == 64
+}
+
+func main() {
+       if !f8(64) {
+               panic("wanted true, got false")
+       }
+       if !f16(64) {
+               panic("wanted true, got false")
+       }
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue42032.go b/gcc/testsuite/go.test/test/fixedbugs/issue42032.go
new file mode 100644 (file)
index 0000000..c456b1d
--- /dev/null
@@ -0,0 +1,27 @@
+// run
+
+// Copyright 2020 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
+
+//go:notinheap
+type NIH struct {
+}
+
+type T struct {
+       x *NIH
+       p *int
+}
+
+var y NIH
+var z int
+
+func main() {
+       a := []T{{&y, &z}}
+       a = append(a, T{&y, &z})
+       if a[1].x == nil {
+               panic("pointer not written")
+       }
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue42058a.go b/gcc/testsuite/go.test/test/fixedbugs/issue42058a.go
new file mode 100644 (file)
index 0000000..722f86e
--- /dev/null
@@ -0,0 +1,13 @@
+// errorcheck
+
+// Copyright 2020 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
+
+var c chan [2 << 16]byte // GC_ERROR "channel element type too large"
+
+type T [1 << 17]byte
+
+var x chan T // GC_ERROR "channel element type too large"
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue42058b.go b/gcc/testsuite/go.test/test/fixedbugs/issue42058b.go
new file mode 100644 (file)
index 0000000..71a280f
--- /dev/null
@@ -0,0 +1,13 @@
+// errorcheck
+
+// Copyright 2020 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
+
+var c chan [2 << 16]byte // GC_ERROR "channel element type too large"
+
+func f() {
+       _ = 42
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue42075.go b/gcc/testsuite/go.test/test/fixedbugs/issue42075.go
new file mode 100644 (file)
index 0000000..af85fb2
--- /dev/null
@@ -0,0 +1,16 @@
+// errorcheck
+
+// Copyright 2020 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
+
+import "unsafe"
+
+type T struct { // ERROR "recursive type"
+       x int
+       p unsafe.Pointer
+
+       f T
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue42076.go b/gcc/testsuite/go.test/test/fixedbugs/issue42076.go
new file mode 100644 (file)
index 0000000..3e95481
--- /dev/null
@@ -0,0 +1,21 @@
+// run
+
+// Copyright 2020 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 "reflect"
+
+//go:notinheap
+type NIH struct {
+}
+
+var x, y NIH
+
+func main() {
+       if reflect.DeepEqual(&x, &y) != true {
+               panic("should report true")
+       }
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue4215.go b/gcc/testsuite/go.test/test/fixedbugs/issue4215.go
new file mode 100644 (file)
index 0000000..be9fc74
--- /dev/null
@@ -0,0 +1,53 @@
+// errorcheck
+
+// Copyright 2016 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 foo() (int, int) {
+       return 2.3 // ERROR "not enough arguments to return\n\thave \(number\)\n\twant \(int, int\)|not enough arguments to return"
+}
+
+func foo2() {
+       return int(2), 2 // ERROR "too many arguments to return\n\thave \(int, number\)\n\twant \(\)|return with value in function with no return type"
+}
+
+func foo3(v int) (a, b, c, d int) {
+       if v >= 0 {
+               return 1 // ERROR "not enough arguments to return\n\thave \(number\)\n\twant \(int, int, int, int\)|not enough arguments to return"
+       }
+       return 2, 3 // ERROR "not enough arguments to return\n\thave \(number, number\)\n\twant \(int, int, int, int\)|not enough arguments to return"
+}
+
+func foo4(name string) (string, int) {
+       switch name {
+       case "cow":
+               return "moo" // ERROR "not enough arguments to return\n\thave \(string\)\n\twant \(string, int\)|not enough arguments to return"
+       case "dog":
+               return "dog", 10, true // ERROR "too many arguments to return\n\thave \(string, number, bool\)\n\twant \(string, int\)|too many values in return statement"
+       case "fish":
+               return "" // ERROR "not enough arguments to return\n\thave \(string\)\n\twant \(string, int\)|not enough arguments to return"
+       default:
+               return "lizard", 10
+       }
+}
+
+type S int
+type T string
+type U float64
+
+func foo5() (S, T, U) {
+       if false {
+               return "" // ERROR "not enough arguments to return\n\thave \(string\)\n\twant \(S, T, U\)|not enough arguments to return"
+       } else {
+               ptr := new(T)
+               return ptr // ERROR "not enough arguments to return\n\thave \(\*T\)\n\twant \(S, T, U\)|not enough arguments to return"
+       }
+       return new(S), 12.34, 1 + 0i, 'r', true // ERROR "too many arguments to return\n\thave \(\*S, number, number, number, bool\)\n\twant \(S, T, U\)|too many values in return statement"
+}
+
+func foo6() (T, string) {
+       return "T", true, true // ERROR "too many arguments to return\n\thave \(string, bool, bool\)\n\twant \(T, string\)|too many values in return statement"
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue42568.go b/gcc/testsuite/go.test/test/fixedbugs/issue42568.go
new file mode 100644 (file)
index 0000000..834fdc5
--- /dev/null
@@ -0,0 +1,25 @@
+// compile
+
+// Copyright 2020 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.
+
+// Ensure that late expansion correctly handles an OpIData with type interface{}
+
+package p
+
+type S struct{}
+
+func (S) M() {}
+
+type I interface {
+       M()
+}
+
+func f(i I) {
+       o := i.(interface{})
+       if _, ok := i.(*S); ok {
+               o = nil
+       }
+       println(o)
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue42587.go b/gcc/testsuite/go.test/test/fixedbugs/issue42587.go
new file mode 100644 (file)
index 0000000..d10ba97
--- /dev/null
@@ -0,0 +1,15 @@
+// compile
+
+// Copyright 2020 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
+
+func f() {
+       var i, j int
+       _ = func() {
+               i = 32
+               j = j>>i | len([]int{})
+       }
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue42703.go b/gcc/testsuite/go.test/test/fixedbugs/issue42703.go
new file mode 100644 (file)
index 0000000..15f7a91
--- /dev/null
@@ -0,0 +1,19 @@
+// run
+
+// Copyright 2020 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 ok [2]bool
+
+func main() {
+       f()()
+       if !ok[0] || !ok[1] {
+               panic("FAIL")
+       }
+}
+
+func f() func() { ok[0] = true; return g }
+func g()        { ok[1] = true }
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue42727.go b/gcc/testsuite/go.test/test/fixedbugs/issue42727.go
new file mode 100644 (file)
index 0000000..4008170
--- /dev/null
@@ -0,0 +1,23 @@
+// compile
+
+// Copyright 2020 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.
+
+// Ensure that late expansion correctly handles an OpLoad with type interface{}
+
+package p
+
+type iface interface {
+       m()
+}
+
+type it interface{}
+
+type makeIface func() iface
+
+func f() {
+       var im makeIface
+       e := im().(it)
+       _ = &e
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue42784.go b/gcc/testsuite/go.test/test/fixedbugs/issue42784.go
new file mode 100644 (file)
index 0000000..e2b06e9
--- /dev/null
@@ -0,0 +1,26 @@
+// compile
+
+// Copyright 2020 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.
+
+// Ensure that late expansion correctly set OpLoad argument type interface{}
+
+package p
+
+type iface interface {
+       m()
+}
+
+type it interface{}
+
+type makeIface func() iface
+
+func f() {
+       var im makeIface
+       e := im().(it)
+       g(e)
+}
+
+//go:noinline
+func g(i it) {}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue42876.go b/gcc/testsuite/go.test/test/fixedbugs/issue42876.go
new file mode 100644 (file)
index 0000000..67cf491
--- /dev/null
@@ -0,0 +1,18 @@
+// run
+
+// Copyright 2020 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 = [4]int32{-0x7fffffff, 0x7fffffff, 2, 4}
+
+func main() {
+       if x[0] > x[1] {
+               panic("fail 1")
+       }
+       if x[2]&x[3] < 0 {
+               panic("fail 2") // Fails here
+       }
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue43099.go b/gcc/testsuite/go.test/test/fixedbugs/issue43099.go
new file mode 100644 (file)
index 0000000..16f18e5
--- /dev/null
@@ -0,0 +1,34 @@
+// compile
+
+// Copyright 2020 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 to make sure we don't try to constant fold a divide by zero.
+// This is a tricky test, as we need a value that's not recognized as 0
+// until lowering (otherwise it gets handled in a different path).
+
+package p
+
+func f() {
+       var i int
+       var s string
+       for i > 0 {
+               _ = s[0]
+               i++
+       }
+
+       var c chan int
+       c <- 1 % i
+}
+
+func f32() uint32 {
+       s := "\x00\x00\x00\x00"
+       c := uint32(s[0]) | uint32(s[1])<<8 | uint32(s[2])<<16 | uint32(s[3])<<24
+       return 1 / c
+}
+func f64() uint64 {
+       s := "\x00\x00\x00\x00\x00\x00\x00\x00"
+       c := uint64(s[0]) | uint64(s[1])<<8 | uint64(s[2])<<16 | uint64(s[3])<<24 | uint64(s[4])<<32 | uint64(s[5])<<40 | uint64(s[6])<<48 | uint64(s[7])<<56
+       return 1 / c
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue43111.go b/gcc/testsuite/go.test/test/fixedbugs/issue43111.go
new file mode 100644 (file)
index 0000000..76d7beb
--- /dev/null
@@ -0,0 +1,70 @@
+// run
+
+// Copyright 2020 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 ch chan int
+var x int
+
+func f() int {
+       close(ch)
+       ch = nil
+       return 0
+}
+
+func g() int {
+       ch = nil
+       x = 0
+       return 0
+}
+
+func main() {
+       var nilch chan int
+       var v int
+       var ok bool
+       _, _ = v, ok
+
+       ch = make(chan int)
+       select {
+       case <-ch:
+       case nilch <- f():
+       }
+
+       ch = make(chan int)
+       select {
+       case v = <-ch:
+       case nilch <- f():
+       }
+
+       ch = make(chan int)
+       select {
+       case v := <-ch: _ = v
+       case nilch <- f():
+       }
+
+       ch = make(chan int)
+       select {
+       case v, ok = <-ch:
+       case nilch <- f():
+       }
+
+       ch = make(chan int)
+       select {
+       case v, ok := <-ch: _, _ = v, ok
+       case nilch <- f():
+       }
+
+       ch1 := make(chan int, 1)
+       ch = ch1
+       x = 42
+       select {
+       case ch <- x:
+       case nilch <- g():
+       }
+       if got := <-ch1; got != 42 {
+               panic(got)
+       }
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue43112.go b/gcc/testsuite/go.test/test/fixedbugs/issue43112.go
new file mode 100644 (file)
index 0000000..e36627a
--- /dev/null
@@ -0,0 +1,41 @@
+// compile
+
+// Copyright 2020 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 Symbol interface{}
+
+type Value interface {
+       String() string
+}
+
+type Object interface {
+       String() string
+}
+
+type Scope struct {
+       outer *Scope
+       elems map[string]Object
+}
+
+func (s *Scope) findouter(name string) (*Scope, Object) {
+       return s.outer.findouter(name)
+}
+
+func (s *Scope) Resolve(name string) (sym Symbol) {
+       if _, obj := s.findouter(name); obj != nil {
+               sym = obj.(Symbol)
+       }
+       return
+}
+
+type ScopeName struct {
+       scope *Scope
+}
+
+func (n *ScopeName) Get(name string) (Value, error) {
+       return n.scope.Resolve(name).(Value), nil
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue4365.go b/gcc/testsuite/go.test/test/fixedbugs/issue4365.go
new file mode 100644 (file)
index 0000000..09ff1bf
--- /dev/null
@@ -0,0 +1,27 @@
+// errorcheck
+
+// Copyright 2015 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.
+
+// Test that fields hide promoted methods.
+// https://golang.org/issue/4365
+
+package main
+
+type T interface {
+        M()
+}
+
+type M struct{}
+
+func (M) M() {}
+
+type Foo struct {
+        M
+}
+
+func main() {
+        var v T = Foo{} // ERROR "has no methods|not a method|cannot use"
+        _ = v
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue5373.go b/gcc/testsuite/go.test/test/fixedbugs/issue5373.go
new file mode 100644 (file)
index 0000000..8aee9a2
--- /dev/null
@@ -0,0 +1,71 @@
+// run
+
+// Copyright 2015 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.
+
+// Ensure that zeroing range loops have the requisite side-effects.
+
+package main
+
+import (
+       "fmt"
+       "os"
+)
+
+func check(n int) {
+       // When n == 0, i is untouched by the range loop.
+       // Picking an initial value of -1 for i makes the
+       // "want" calculation below correct in all cases.
+       i := -1
+       s := make([]byte, n)
+       for i = range s {
+               s[i] = 0
+       }
+       if want := n - 1; i != want {
+               fmt.Printf("index after range with side-effect = %d want %d\n", i, want)
+               os.Exit(1)
+       }
+
+       i = n + 1
+       // i is shadowed here, so its value should be unchanged.
+       for i := range s {
+               s[i] = 0
+       }
+       if want := n + 1; i != want {
+               fmt.Printf("index after range without side-effect = %d want %d\n", i, want)
+               os.Exit(1)
+       }
+
+       // Index variable whose evaluation has side-effects
+       var x int
+       f := func() int {
+               x++
+               return 0
+       }
+       var a [1]int
+       for a[f()] = range s {
+               s[a[f()]] = 0
+       }
+       if want := n * 2; x != want {
+               fmt.Printf("index function calls = %d want %d\n", x, want)
+               os.Exit(1)
+       }
+
+       // Range expression whose evaluation has side-effects
+       x = 0
+       b := [1][]byte{s}
+       for i := range b[f()] {
+               b[f()][i] = 0
+       }
+       if want := n + 1; x != n+1 {
+               fmt.Printf("range expr function calls = %d want %d\n", x, want)
+               os.Exit(1)
+       }
+}
+
+func main() {
+       check(0)
+       check(1)
+       check(15)
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue5793.go b/gcc/testsuite/go.test/test/fixedbugs/issue5793.go
new file mode 100644 (file)
index 0000000..8104155
--- /dev/null
@@ -0,0 +1,36 @@
+// run
+
+// Copyright 2013 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 5793: calling 2-arg builtin with multiple-result f() call expression gives
+// spurious error.
+
+package main
+
+func complexArgs() (float64, float64) {
+       return 5, 7
+}
+
+func appendArgs() ([]string, string) {
+       return []string{"foo"}, "bar"
+}
+
+func appendMultiArgs() ([]byte, byte, byte) {
+       return []byte{'a', 'b'}, '1', '2'
+}
+
+func main() {
+       if c := complex(complexArgs()); c != 5+7i {
+               panic(c)
+       }
+
+       if s := append(appendArgs()); len(s) != 2 || s[0] != "foo" || s[1] != "bar" {
+               panic(s)
+       }
+
+       if b := append(appendMultiArgs()); len(b) != 4 || b[0] != 'a' || b[1] != 'b' || b[2] != '1' || b[3] != '2' {
+               panic(b)
+       }
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue6295.dir/p0.go b/gcc/testsuite/go.test/test/fixedbugs/issue6295.dir/p0.go
new file mode 100644 (file)
index 0000000..d4d4da7
--- /dev/null
@@ -0,0 +1,13 @@
+// Copyright 2013 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 p0
+
+type T0 interface {
+       m0()
+}
+
+type S0 struct{}
+
+func (S0) m0() {}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue6295.dir/p1.go b/gcc/testsuite/go.test/test/fixedbugs/issue6295.dir/p1.go
new file mode 100644 (file)
index 0000000..26efae7
--- /dev/null
@@ -0,0 +1,26 @@
+// Copyright 2013 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 p1
+
+import "./p0"
+
+type T1 interface {
+       p0.T0
+       m1()
+}
+
+type S1 struct {
+       p0.S0
+}
+
+func (S1) m1() {}
+
+func NewT0() p0.T0 {
+       return S1{}
+}
+
+func NewT1() T1 {
+       return S1{}
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue6295.dir/p2.go b/gcc/testsuite/go.test/test/fixedbugs/issue6295.dir/p2.go
new file mode 100644 (file)
index 0000000..f5b6ffd
--- /dev/null
@@ -0,0 +1,19 @@
+// Copyright 2013 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 (
+       "./p0"
+       "./p1"
+)
+
+var (
+       _ p0.T0 = p0.S0{}
+       _ p0.T0 = p1.S1{}
+       _ p0.T0 = p1.NewT0()
+       _ p0.T0 = p1.NewT1() // same as p1.S1{}
+)
+
+func main() {}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue6295.go b/gcc/testsuite/go.test/test/fixedbugs/issue6295.go
new file mode 100644 (file)
index 0000000..b8da212
--- /dev/null
@@ -0,0 +1,10 @@
+// compiledir
+
+// Copyright 2013 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 6295: qualified name of unexported methods
+// is corrupted during import.
+
+package ignored
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue6402.go b/gcc/testsuite/go.test/test/fixedbugs/issue6402.go
new file mode 100644 (file)
index 0000000..ecde9ae
--- /dev/null
@@ -0,0 +1,13 @@
+// errorcheck
+
+// Copyright 2014 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 6402: spurious 'use of untyped nil' error
+
+package p
+
+func f() uintptr {
+       return nil // ERROR "cannot use nil as type uintptr in return argument|incompatible type"
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue6403.go b/gcc/testsuite/go.test/test/fixedbugs/issue6403.go
new file mode 100644 (file)
index 0000000..809efef
--- /dev/null
@@ -0,0 +1,14 @@
+// errorcheck
+
+// Copyright 2014 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 6403: fix spurious 'const initializer is not a constant' error
+
+package p
+
+import "syscall"
+
+const A int = syscall.X // ERROR "undefined: syscall.X|undefined identifier .*syscall.X"
+const B int = voidpkg.X // ERROR "undefined: voidpkg|undefined name .*voidpkg"
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue6406.go b/gcc/testsuite/go.test/test/fixedbugs/issue6406.go
new file mode 100644 (file)
index 0000000..5491193
--- /dev/null
@@ -0,0 +1,12 @@
+// errorcheck
+
+// Copyright 2014 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() {
+       s = "bob" // ERROR "undefined.*s"
+       _ = s // ERROR "undefined.*s"
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue6703a.go b/gcc/testsuite/go.test/test/fixedbugs/issue6703a.go
new file mode 100644 (file)
index 0000000..38c5956
--- /dev/null
@@ -0,0 +1,16 @@
+// errorcheck
+
+// Copyright 2014 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 for cycles in a function value.
+
+package funcvalue
+
+func fx() int {
+       _ = x
+       return 0
+}
+
+var x = fx // ERROR "initialization loop|depends upon itself"
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue6703b.go b/gcc/testsuite/go.test/test/fixedbugs/issue6703b.go
new file mode 100644 (file)
index 0000000..35438c3
--- /dev/null
@@ -0,0 +1,16 @@
+// errorcheck
+
+// Copyright 2014 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 for cycles in a function call.
+
+package funccall
+
+func fx() int {
+       _ = x
+       return 0
+}
+
+var x = fx() // ERROR "initialization loop|depends upon itself"
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue6703c.go b/gcc/testsuite/go.test/test/fixedbugs/issue6703c.go
new file mode 100644 (file)
index 0000000..ade40e3
--- /dev/null
@@ -0,0 +1,18 @@
+// errorcheck
+
+// Copyright 2014 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 for cycles in a method expression.
+
+package methexpr
+
+type T int
+
+func (T) m() int {
+       _ = x
+       return 0
+}
+
+var x = T.m // ERROR "initialization loop|depends upon itself"
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue6703d.go b/gcc/testsuite/go.test/test/fixedbugs/issue6703d.go
new file mode 100644 (file)
index 0000000..dd48163
--- /dev/null
@@ -0,0 +1,18 @@
+// errorcheck
+
+// Copyright 2014 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 for cycles in a method expression call.
+
+package methexprcall
+
+type T int
+
+func (T) m() int {
+       _ = x
+       return 0
+}
+
+var x = T.m(0) // ERROR "initialization loop|depends upon itself"
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue6703e.go b/gcc/testsuite/go.test/test/fixedbugs/issue6703e.go
new file mode 100644 (file)
index 0000000..d362d6e
--- /dev/null
@@ -0,0 +1,18 @@
+// errorcheck
+
+// Copyright 2014 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 for cycles in the method value of a value literal.
+
+package litmethvalue
+
+type T int
+
+func (T) m() int {
+       _ = x
+       return 0
+}
+
+var x = T(0).m // ERROR "initialization loop|depends upon itself"
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue6703f.go b/gcc/testsuite/go.test/test/fixedbugs/issue6703f.go
new file mode 100644 (file)
index 0000000..0b49026
--- /dev/null
@@ -0,0 +1,18 @@
+// errorcheck
+
+// Copyright 2014 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 for cycles in the method call of a value literal.
+
+package litmethcall
+
+type T int
+
+func (T) m() int {
+       _ = x
+       return 0
+}
+
+var x = T(0).m() // ERROR "initialization loop|depends upon itself"
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue6703g.go b/gcc/testsuite/go.test/test/fixedbugs/issue6703g.go
new file mode 100644 (file)
index 0000000..05ec740
--- /dev/null
@@ -0,0 +1,20 @@
+// errorcheck
+
+// Copyright 2014 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 for cycles in an embedded method expression.
+
+package embedmethexpr
+
+type T int
+
+func (T) m() int {
+       _ = x
+       return 0
+}
+
+type E struct{ T }
+
+var x = E.m // ERROR "initialization loop|depends upon itself" 
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue6703h.go b/gcc/testsuite/go.test/test/fixedbugs/issue6703h.go
new file mode 100644 (file)
index 0000000..f6b69e1
--- /dev/null
@@ -0,0 +1,20 @@
+// errorcheck
+
+// Copyright 2014 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 for cycles when calling an embedded method expression.
+
+package embedmethexprcall
+
+type T int
+
+func (T) m() int {
+       _ = x
+       return 0
+}
+
+type E struct{ T }
+
+var x = E.m(E{0}) // ERROR "initialization loop|depends upon itself" 
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue6703i.go b/gcc/testsuite/go.test/test/fixedbugs/issue6703i.go
new file mode 100644 (file)
index 0000000..fb580a2
--- /dev/null
@@ -0,0 +1,20 @@
+// errorcheck
+
+// Copyright 2014 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 for cycles in an embedded struct literal's method value.
+
+package embedlitmethvalue
+
+type T int
+
+func (T) m() int {
+       _ = x
+       return 0
+}
+
+type E struct{ T }
+
+var x = E{}.m // ERROR "initialization loop|depends upon itself" 
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue6703j.go b/gcc/testsuite/go.test/test/fixedbugs/issue6703j.go
new file mode 100644 (file)
index 0000000..b4c079f
--- /dev/null
@@ -0,0 +1,20 @@
+// errorcheck
+
+// Copyright 2014 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 for cycles in an embedded struct literal's method call.
+
+package embedlitmethcall
+
+type T int
+
+func (T) m() int {
+       _ = x
+       return 0
+}
+
+type E struct{ T }
+
+var x = E{}.m() // ERROR "initialization loop|depends upon itself"
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue6703k.go b/gcc/testsuite/go.test/test/fixedbugs/issue6703k.go
new file mode 100644 (file)
index 0000000..6f606e2
--- /dev/null
@@ -0,0 +1,21 @@
+// errorcheck
+
+// Copyright 2014 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 for cycles in a method value.
+
+package methvalue
+
+type T int
+
+func (T) m() int {
+       _ = x
+       return 0
+}
+
+var (
+       t T
+       x = t.m // ERROR "initialization loop|depends upon itself"
+)
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue6703l.go b/gcc/testsuite/go.test/test/fixedbugs/issue6703l.go
new file mode 100644 (file)
index 0000000..684c225
--- /dev/null
@@ -0,0 +1,21 @@
+// errorcheck
+
+// Copyright 2014 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 for cycles in a method call.
+
+package methcall
+
+type T int
+
+func (T) m() int {
+       _ = x
+       return 0
+}
+
+var (
+       t T
+       x = t.m() // ERROR "initialization loop|depends upon itself"
+)
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue6703m.go b/gcc/testsuite/go.test/test/fixedbugs/issue6703m.go
new file mode 100644 (file)
index 0000000..7d1b604
--- /dev/null
@@ -0,0 +1,25 @@
+// errorcheck
+
+// Copyright 2014 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 for cycles in the method value of a value returned from a function call.
+
+package funcmethvalue
+
+type T int
+
+func (T) m() int {
+       _ = x
+       return 0
+}
+
+func f() T {
+       return T(0)
+}
+
+var (
+       t T
+       x = f().m // ERROR "initialization loop|depends upon itself"
+)
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue6703n.go b/gcc/testsuite/go.test/test/fixedbugs/issue6703n.go
new file mode 100644 (file)
index 0000000..22646af
--- /dev/null
@@ -0,0 +1,25 @@
+// errorcheck
+
+// Copyright 2014 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 for cycles in the method call of a value returned from a function call.
+
+package funcmethcall
+
+type T int
+
+func (T) m() int {
+       _ = x
+       return 0
+}
+
+func f() T {
+       return T(0)
+}
+
+var (
+       t T
+       x = f().m() // ERROR "initialization loop|depends upon itself"
+)
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue6703o.go b/gcc/testsuite/go.test/test/fixedbugs/issue6703o.go
new file mode 100644 (file)
index 0000000..a11fdfd
--- /dev/null
@@ -0,0 +1,23 @@
+// errorcheck
+
+// Copyright 2014 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 for cycles in an embedded struct's method value.
+
+package embedmethvalue
+
+type T int
+
+func (T) m() int {
+       _ = x
+       return 0
+}
+
+type E struct{ T }
+
+var (
+       e E
+       x = e.m // ERROR "initialization loop|depends upon itself" 
+)
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue6703p.go b/gcc/testsuite/go.test/test/fixedbugs/issue6703p.go
new file mode 100644 (file)
index 0000000..3ac7a63
--- /dev/null
@@ -0,0 +1,23 @@
+// errorcheck
+
+// Copyright 2014 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 for cycles in an embedded struct's method call.
+
+package embedmethcall
+
+type T int
+
+func (T) m() int {
+       _ = x
+       return 0
+}
+
+type E struct{ T }
+
+var (
+       e E
+       x = e.m() // ERROR "initialization loop|depends upon itself" 
+)
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue6703q.go b/gcc/testsuite/go.test/test/fixedbugs/issue6703q.go
new file mode 100644 (file)
index 0000000..b087c15
--- /dev/null
@@ -0,0 +1,28 @@
+// errorcheck
+
+// Copyright 2014 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 for cycles in the method value of an embedded struct returned
+// from a function call.
+
+package funcembedmethvalue
+
+type T int
+
+func (T) m() int {
+       _ = x
+       return 0
+}
+
+func g() E {
+       return E{0}
+}
+
+type E struct{ T }
+
+var (
+       e E
+       x = g().m // ERROR "initialization loop|depends upon itself" 
+)
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue6703r.go b/gcc/testsuite/go.test/test/fixedbugs/issue6703r.go
new file mode 100644 (file)
index 0000000..de514f1
--- /dev/null
@@ -0,0 +1,28 @@
+// errorcheck
+
+// Copyright 2014 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 for cycles in the method call of an embedded struct returned
+// from a function call.
+
+package funcembedmethcall
+
+type T int
+
+func (T) m() int {
+       _ = x
+       return 0
+}
+
+func g() E {
+       return E{0}
+}
+
+type E struct{ T }
+
+var (
+       e E
+       x = g().m() // ERROR "initialization loop|depends upon itself" 
+)
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue6703s.go b/gcc/testsuite/go.test/test/fixedbugs/issue6703s.go
new file mode 100644 (file)
index 0000000..cd3c5b3
--- /dev/null
@@ -0,0 +1,18 @@
+// errorcheck
+
+// Copyright 2014 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 for cycles in a pointer method expression.
+
+package ptrmethexpr
+
+type T int
+
+func (*T) pm() int {
+       _ = x
+       return 0
+}
+
+var x = (*T).pm // ERROR "initialization loop|depends upon itself"
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue6703t.go b/gcc/testsuite/go.test/test/fixedbugs/issue6703t.go
new file mode 100644 (file)
index 0000000..62de37c
--- /dev/null
@@ -0,0 +1,18 @@
+// errorcheck
+
+// Copyright 2014 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 for cycles in the call of a pointer method expression.
+
+package ptrmethexprcall
+
+type T int
+
+func (*T) pm() int {
+       _ = x
+       return 0
+}
+
+var x = (*T).pm(nil) // ERROR "initialization loop|depends upon itself"
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue6703u.go b/gcc/testsuite/go.test/test/fixedbugs/issue6703u.go
new file mode 100644 (file)
index 0000000..961a000
--- /dev/null
@@ -0,0 +1,18 @@
+// errorcheck
+
+// Copyright 2014 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 for cycles in a pointer literal's method value.
+
+package ptrlitmethvalue
+
+type T int
+
+func (*T) pm() int {
+       _ = x
+       return 0
+}
+
+var x = (*T)(nil).pm // ERROR "initialization loop|depends upon itself"
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue6703v.go b/gcc/testsuite/go.test/test/fixedbugs/issue6703v.go
new file mode 100644 (file)
index 0000000..2409911
--- /dev/null
@@ -0,0 +1,18 @@
+// errorcheck
+
+// Copyright 2014 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 for cycles in a pointer literal's method call.
+
+package ptrlitmethcall
+
+type T int
+
+func (*T) pm() int {
+       _ = x
+       return 0
+}
+
+var x = (*T)(nil).pm() // ERROR "initialization loop|depends upon itself"
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue6703w.go b/gcc/testsuite/go.test/test/fixedbugs/issue6703w.go
new file mode 100644 (file)
index 0000000..b7b3d91
--- /dev/null
@@ -0,0 +1,21 @@
+// errorcheck
+
+// Copyright 2014 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 for cycles in a pointer value's method value.
+
+package ptrmethvalue
+
+type T int
+
+func (*T) pm() int {
+       _ = x
+       return 0
+}
+
+var (
+       p *T
+       x = p.pm // ERROR "initialization loop|depends upon itself"
+)
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue6703x.go b/gcc/testsuite/go.test/test/fixedbugs/issue6703x.go
new file mode 100644 (file)
index 0000000..48daf03
--- /dev/null
@@ -0,0 +1,21 @@
+// errorcheck
+
+// Copyright 2014 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 for cycles in a pointer value's method call.
+
+package ptrmethcall
+
+type T int
+
+func (*T) pm() int {
+       _ = x
+       return 0
+}
+
+var (
+       p *T
+       x = p.pm() // ERROR "initialization loop|depends upon itself"
+)
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue6703y.go b/gcc/testsuite/go.test/test/fixedbugs/issue6703y.go
new file mode 100644 (file)
index 0000000..278dfcd
--- /dev/null
@@ -0,0 +1,23 @@
+// errorcheck
+
+// Copyright 2014 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 for cycles in the method value of a pointer value returned
+// from a function call.
+
+package funcptrmethvalue
+
+type T int
+
+func (*T) pm() int {
+       _ = x
+       return 0
+}
+
+func pf() *T {
+       return nil
+}
+
+var x = pf().pm // ERROR "initialization loop|depends upon itself" 
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue6703z.go b/gcc/testsuite/go.test/test/fixedbugs/issue6703z.go
new file mode 100644 (file)
index 0000000..f81a3a8
--- /dev/null
@@ -0,0 +1,23 @@
+// errorcheck
+
+// Copyright 2014 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 for cycles in the method call of a pointer value returned
+// from a function call.
+
+package funcptrmethcall
+
+type T int
+
+func (*T) pm() int {
+       _ = x
+       return 0
+}
+
+func pf() *T {
+       return nil
+}
+
+var x = pf().pm() // ERROR "initialization loop|depends upon itself" 
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue6772.go b/gcc/testsuite/go.test/test/fixedbugs/issue6772.go
new file mode 100644 (file)
index 0000000..5bd15ba
--- /dev/null
@@ -0,0 +1,21 @@
+// errorcheck
+
+// Copyright 2016 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
+
+func f1() {
+       for a, a := range []int{1, 2, 3} { // ERROR "a.* repeated on left side of :="
+               println(a)
+       }
+}
+
+func f2() {
+       var a int
+       for a, a := range []int{1, 2, 3} { // ERROR "a.* repeated on left side of :="
+               println(a)
+       }
+       println(a)
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue6847.go b/gcc/testsuite/go.test/test/fixedbugs/issue6847.go
new file mode 100644 (file)
index 0000000..da300bc
--- /dev/null
@@ -0,0 +1,85 @@
+// compile
+
+// Copyright 2014 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 6847: select clauses involving implicit conversion
+// of channels trigger a spurious typechecking error during walk.
+
+package p
+
+type I1 interface {
+       String()
+}
+type I2 interface {
+       String()
+}
+
+func F() {
+       var (
+               cr <-chan int
+               cs chan<- int
+               c  chan int
+
+               ccr chan (<-chan int)
+               ccs chan chan<- int
+               cc  chan chan int
+
+               ok bool
+       )
+       // Send cases.
+       select {
+       case ccr <- cr:
+       case ccr <- c:
+       }
+       select {
+       case ccs <- cs:
+       case ccs <- c:
+       }
+       select {
+       case ccr <- c:
+       default:
+       }
+       // Receive cases.
+       select {
+       case cr = <-cc:
+       case cs = <-cc:
+       case c = <-cc:
+       }
+       select {
+       case cr = <-cc:
+       default:
+       }
+       select {
+       case cr, ok = <-cc:
+       case cs, ok = <-cc:
+       case c = <-cc:
+       }
+      // Interfaces.
+       var (
+               c1 chan I1
+               c2 chan I2
+               x1 I1
+               x2 I2
+       )
+       select {
+       case c1 <- x1:
+       case c1 <- x2:
+       case c2 <- x1:
+       case c2 <- x2:
+       }
+       select {
+       case x1 = <-c1:
+       case x1 = <-c2:
+       case x2 = <-c1:
+       case x2 = <-c2:
+       }
+       select {
+       case x1, ok = <-c1:
+       case x1, ok = <-c2:
+       case x2, ok = <-c1:
+       case x2, ok = <-c2:
+       }
+       _ = ok
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue6866.go b/gcc/testsuite/go.test/test/fixedbugs/issue6866.go
new file mode 100644 (file)
index 0000000..1080b27
--- /dev/null
@@ -0,0 +1,80 @@
+// run
+
+// Copyright 2015 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.
+
+// WARNING: GENERATED FILE - DO NOT MODIFY MANUALLY!
+// (To generate, in go/types directory: go test -run=Hilbert -H=2 -out="h2.src")
+
+// This program tests arbitrary precision constant arithmetic
+// by generating the constant elements of a Hilbert matrix H,
+// its inverse I, and the product P = H*I. The product should
+// be the identity matrix.
+package main
+
+func main() {
+       if !ok {
+               print()
+               return
+       }
+}
+
+// Hilbert matrix, n = 2
+const (
+       h0_0, h0_1 = 1.0 / (iota + 1), 1.0 / (iota + 2)
+       h1_0, h1_1
+)
+
+// Inverse Hilbert matrix
+const (
+       i0_0 = +1 * b2_1 * b2_1 * b0_0 * b0_0
+       i0_1 = -2 * b2_0 * b3_1 * b1_0 * b1_0
+
+       i1_0 = -2 * b3_1 * b2_0 * b1_1 * b1_1
+       i1_1 = +3 * b3_0 * b3_0 * b2_1 * b2_1
+)
+
+// Product matrix
+const (
+       p0_0 = h0_0*i0_0 + h0_1*i1_0
+       p0_1 = h0_0*i0_1 + h0_1*i1_1
+
+       p1_0 = h1_0*i0_0 + h1_1*i1_0
+       p1_1 = h1_0*i0_1 + h1_1*i1_1
+)
+
+// Verify that product is identity matrix
+const ok = p0_0 == 1 && p0_1 == 0 &&
+       p1_0 == 0 && p1_1 == 1 &&
+       true
+
+func print() {
+       println(p0_0, p0_1)
+       println(p1_0, p1_1)
+}
+
+// Binomials
+const (
+       b0_0 = f0 / (f0 * f0)
+
+       b1_0 = f1 / (f0 * f1)
+       b1_1 = f1 / (f1 * f0)
+
+       b2_0 = f2 / (f0 * f2)
+       b2_1 = f2 / (f1 * f1)
+       b2_2 = f2 / (f2 * f0)
+
+       b3_0 = f3 / (f0 * f3)
+       b3_1 = f3 / (f1 * f2)
+       b3_2 = f3 / (f2 * f1)
+       b3_3 = f3 / (f3 * f0)
+)
+
+// Factorials
+const (
+       f0 = 1
+       f1 = 1
+       f2 = f1 * 2
+       f3 = f2 * 3
+)
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue6889.go b/gcc/testsuite/go.test/test/fixedbugs/issue6889.go
new file mode 100644 (file)
index 0000000..efd8b76
--- /dev/null
@@ -0,0 +1,111 @@
+// errorcheck
+
+// Copyright 2014 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 6889: confusing error message: ovf in mpaddxx
+
+package main
+
+const (
+       f1  = 1
+       f2  = f1 * 2
+       f3  = f2 * 3
+       f4  = f3 * 4
+       f5  = f4 * 5
+       f6  = f5 * 6
+       f7  = f6 * 7
+       f8  = f7 * 8
+       f9  = f8 * 9
+       f10 = f9 * 10
+       f11 = f10 * 11
+       f12 = f11 * 12
+       f13 = f12 * 13
+       f14 = f13 * 14
+       f15 = f14 * 15
+       f16 = f15 * 16
+       f17 = f16 * 17
+       f18 = f17 * 18
+       f19 = f18 * 19
+       f20 = f19 * 20
+       f21 = f20 * 21
+       f22 = f21 * 22
+       f23 = f22 * 23
+       f24 = f23 * 24
+       f25 = f24 * 25
+       f26 = f25 * 26
+       f27 = f26 * 27
+       f28 = f27 * 28
+       f29 = f28 * 29
+       f30 = f29 * 30
+       f31 = f30 * 31
+       f32 = f31 * 32
+       f33 = f32 * 33
+       f34 = f33 * 34
+       f35 = f34 * 35
+       f36 = f35 * 36
+       f37 = f36 * 37
+       f38 = f37 * 38
+       f39 = f38 * 39
+       f40 = f39 * 40
+       f41 = f40 * 41
+       f42 = f41 * 42
+       f43 = f42 * 43
+       f44 = f43 * 44
+       f45 = f44 * 45
+       f46 = f45 * 46
+       f47 = f46 * 47
+       f48 = f47 * 48
+       f49 = f48 * 49
+       f50 = f49 * 50
+       f51 = f50 * 51
+       f52 = f51 * 52
+       f53 = f52 * 53
+       f54 = f53 * 54
+       f55 = f54 * 55
+       f56 = f55 * 56
+       f57 = f56 * 57
+       f58 = f57 * 58
+       f59 = f58 * 59
+       f60 = f59 * 60
+       f61 = f60 * 61
+       f62 = f61 * 62
+       f63 = f62 * 63
+       f64 = f63 * 64
+       f65 = f64 * 65
+       f66 = f65 * 66
+       f67 = f66 * 67
+       f68 = f67 * 68
+       f69 = f68 * 69
+       f70 = f69 * 70
+       f71 = f70 * 71
+       f72 = f71 * 72
+       f73 = f72 * 73
+       f74 = f73 * 74
+       f75 = f74 * 75
+       f76 = f75 * 76
+       f77 = f76 * 77
+       f78 = f77 * 78
+       f79 = f78 * 79
+       f80 = f79 * 80
+       f81 = f80 * 81
+       f82 = f81 * 82
+       f83 = f82 * 83
+       f84 = f83 * 84
+       f85 = f84 * 85
+       f86 = f85 * 86
+       f87 = f86 * 87
+       f88 = f87 * 88
+       f89 = f88 * 89
+       f90 = f89 * 90
+       f91 = f90 * 91
+       f92 = f91 * 92
+       f93 = f92 * 93
+       f94 = f93 * 94
+       f95 = f94 * 95
+       f96 = f95 * 96
+       f97 = f96 * 97
+       f98 = f97 * 98
+       f99 = f98 * 99 // GC_ERROR "overflow"
+)
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue6902.go b/gcc/testsuite/go.test/test/fixedbugs/issue6902.go
new file mode 100644 (file)
index 0000000..5c2c545
--- /dev/null
@@ -0,0 +1,21 @@
+// run
+
+// Copyright 2014 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 6902: confusing printing of large floating point constants
+
+package main
+
+import (
+       "os"
+)
+
+var x = -1e-10000
+
+func main() {
+       if x != 0 {
+               os.Exit(1)
+       }
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue6964.go b/gcc/testsuite/go.test/test/fixedbugs/issue6964.go
new file mode 100644 (file)
index 0000000..36a3c5b
--- /dev/null
@@ -0,0 +1,11 @@
+// errorcheck
+
+// Copyright 2013 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() {
+       _ = string(-4 + 2i + 2) // ERROR "-4 \+ 2i|invalid type conversion"
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue7023.dir/a.go b/gcc/testsuite/go.test/test/fixedbugs/issue7023.dir/a.go
new file mode 100644 (file)
index 0000000..cdb5432
--- /dev/null
@@ -0,0 +1,10 @@
+// Copyright 2014 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
+
+func Foo() {
+       goto bar
+bar:
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue7023.dir/b.go b/gcc/testsuite/go.test/test/fixedbugs/issue7023.dir/b.go
new file mode 100644 (file)
index 0000000..c6fe40d
--- /dev/null
@@ -0,0 +1,11 @@
+// Copyright 2014 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
+
+import (
+       "./a"
+)
+
+var f = a.Foo
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue7023.go b/gcc/testsuite/go.test/test/fixedbugs/issue7023.go
new file mode 100644 (file)
index 0000000..f18c611
--- /dev/null
@@ -0,0 +1,10 @@
+// compiledir
+
+// Copyright 2014 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 7023: corrupted export data when an inlined function
+// contains a goto.
+
+package ignored
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue7044.go b/gcc/testsuite/go.test/test/fixedbugs/issue7044.go
new file mode 100644 (file)
index 0000000..00c78c8
--- /dev/null
@@ -0,0 +1,43 @@
+// run
+
+// Copyright 2014 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 7044: bad AMOVFD and AMOVDF assembly generation on
+// arm for registers above 7.
+
+package main
+
+import (
+       "fmt"
+       "reflect"
+)
+
+func f() [16]float32 {
+       f0, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15 :=
+               float32(1), float32(1), float32(1), float32(1), float32(1), float32(1), float32(1), float32(1), float32(1), float32(1), float32(1), float32(1), float32(1), float32(1), float32(1), float32(1)
+       // Use all 16 registers to do float32 --> float64 conversion.
+       d0, d1, d2, d3, d4, d5, d6, d7, d8, d9, d10, d11, d12, d13, d14, d15 :=
+               float64(f0), float64(f1), float64(f2), float64(f3), float64(f4), float64(f5), float64(f6), float64(f7), float64(f8), float64(f9), float64(f10), float64(f11), float64(f12), float64(f13), float64(f14), float64(f15)
+       // Use all 16 registers to do float64 --> float32 conversion.
+       g0, g1, g2, g3, g4, g5, g6, g7, g8, g9, g10, g11, g12, g13, g14, g15 :=
+               float32(d0), float32(d1), float32(d2), float32(d3), float32(d4), float32(d5), float32(d6), float32(d7), float32(d8), float32(d9), float32(d10), float32(d11), float32(d12), float32(d13), float32(d14), float32(d15)
+       // Force another conversion, so that the previous conversion doesn't
+       // get optimized away into constructing the returned array. With current
+       // optimizations, constructing the returned array uses only
+       // a single register.
+       e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15 :=
+               float64(g0), float64(g1), float64(g2), float64(g3), float64(g4), float64(g5), float64(g6), float64(g7), float64(g8), float64(g9), float64(g10), float64(g11), float64(g12), float64(g13), float64(g14), float64(g15)
+       return [16]float32{
+               float32(e0), float32(e1), float32(e2), float32(e3), float32(e4), float32(e5), float32(e6), float32(e7), float32(e8), float32(e9), float32(e10), float32(e11), float32(e12), float32(e13), float32(e14), float32(e15),
+       }
+}
+
+func main() {
+       want := [16]float32{1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}
+       got := f()
+       if !reflect.DeepEqual(got, want) {
+               fmt.Printf("f() = %#v; want %#v\n", got, want)
+       }
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue7050.go b/gcc/testsuite/go.test/test/fixedbugs/issue7050.go
new file mode 100644 (file)
index 0000000..be7a118
--- /dev/null
@@ -0,0 +1,19 @@
+// run
+
+// Copyright 2014 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"
+       "os"
+)
+
+func main() {
+       _, err := os.Stdout.Write(nil)
+       if err != nil {
+               fmt.Printf("BUG: os.Stdout.Write(nil) = %v\n", err)
+       }
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue7083.go b/gcc/testsuite/go.test/test/fixedbugs/issue7083.go
new file mode 100644 (file)
index 0000000..79bfd3b
--- /dev/null
@@ -0,0 +1,22 @@
+// run
+
+package main
+
+import "runtime/debug"
+
+func f(m map[int]*string, i int) {
+       s := ""
+       m[i] = &s
+}
+
+func main() {
+       debug.SetGCPercent(0)
+       m := map[int]*string{}
+       for i := 0; i < 40; i++ {
+               f(m, i)
+               if len(*m[i]) != 0 {
+                       println("bad length", i, m[i], len(*m[i]))
+                       panic("bad length")
+               }
+       }
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue7129.go b/gcc/testsuite/go.test/test/fixedbugs/issue7129.go
new file mode 100644 (file)
index 0000000..2765200
--- /dev/null
@@ -0,0 +1,21 @@
+// errorcheck
+
+// Copyright 2014 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 7129: inconsistent "wrong arg type" error for multivalued g in f(g())
+
+package main
+
+func f(int) {}
+
+func g() bool { return true }
+
+func h(int, int) {}
+
+func main() {
+       f(g())        // ERROR "in argument to f|incompatible type"
+       f(true)       // ERROR "in argument to f|incompatible type"
+       h(true, true) // ERROR "in argument to h|incompatible type"
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue7150.go b/gcc/testsuite/go.test/test/fixedbugs/issue7150.go
new file mode 100644 (file)
index 0000000..7cddf48
--- /dev/null
@@ -0,0 +1,17 @@
+// errorcheck
+
+// Copyright 2014 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 7150: array index out of bounds error off by one
+
+package main
+
+func main() {
+       _ = [0]int{-1: 50}              // ERROR "index must be non-negative integer constant|index expression is negative"
+       _ = [0]int{0: 0}                // ERROR "index 0 out of bounds \[0:0\]|out of range"
+       _ = [0]int{5: 25}               // ERROR "index 5 out of bounds \[0:0\]|out of range"
+       _ = [10]int{2: 10, 15: 30}      // ERROR "index 15 out of bounds \[0:10\]|out of range"
+       _ = [10]int{5: 5, 1: 1, 12: 12} // ERROR "index 12 out of bounds \[0:10\]|out of range"
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue7153.go b/gcc/testsuite/go.test/test/fixedbugs/issue7153.go
new file mode 100644 (file)
index 0000000..e8b95d5
--- /dev/null
@@ -0,0 +1,11 @@
+// errorcheck
+
+// Copyright 2014 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 7153: array invalid index error duplicated on successive bad values
+
+package p
+
+var _ = []int{a: true, true} // ERROR "undefined: a" "cannot use true \(type untyped bool\) as type int in slice literal|undefined name .*a|incompatible type"
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue7223.go b/gcc/testsuite/go.test/test/fixedbugs/issue7223.go
new file mode 100644 (file)
index 0000000..0ec3476
--- /dev/null
@@ -0,0 +1,20 @@
+// errorcheck
+
+// Copyright 2014 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 bits1 uint = 10
+const bits2 uint = 10
+
+func main() {
+       _ = make([]byte, 1<<bits1)
+       _ = make([]byte, 1<<bits2)
+       _ = make([]byte, nil) // ERROR "non-integer.*len"
+       _ = make([]byte, nil, 2) // ERROR "non-integer.*len"
+       _ = make([]byte, 1, nil) // ERROR "non-integer.*cap"
+       _ = make([]byte, true) // ERROR "non-integer.*len"
+       _ = make([]byte, "abc") // ERROR "non-integer.*len"
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue7272.go b/gcc/testsuite/go.test/test/fixedbugs/issue7272.go
new file mode 100644 (file)
index 0000000..b10a8bf
--- /dev/null
@@ -0,0 +1,48 @@
+// compile
+
+// Copyright 2012 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 7272: test builtin functions in statement context and in
+// go/defer functions.
+
+package p
+
+func F() {
+       var a []int
+       var c chan int
+       var m map[int]int
+
+       close(c)
+       copy(a, a)
+       delete(m, 0)
+       panic(0)
+       print("foo")
+       println("bar")
+       recover()
+
+       (close(c))
+       (copy(a, a))
+       (delete(m, 0))
+       (panic(0))
+       (print("foo"))
+       (println("bar"))
+       (recover())
+
+       go close(c)
+       go copy(a, a)
+       go delete(m, 0)
+       go panic(0)
+       go print("foo")
+       go println("bar")
+       go recover()
+
+       defer close(c)
+       defer copy(a, a)
+       defer delete(m, 0)
+       defer panic(0)
+       defer print("foo")
+       defer println("bar")
+       defer recover()
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue7310.go b/gcc/testsuite/go.test/test/fixedbugs/issue7310.go
new file mode 100644 (file)
index 0000000..ba50e42
--- /dev/null
@@ -0,0 +1,15 @@
+// errorcheck
+
+// Copyright 2014 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.
+
+// Internal compiler crash used to stop errors during second copy.
+
+package main
+
+func main() {
+       _ = copy(nil, []int{}) // ERROR "use of untyped nil|left argument must be a slice"
+       _ = copy([]int{}, nil) // ERROR "use of untyped nil|second argument must be slice or string"
+       _ = 1 + true           // ERROR "mismatched types untyped int and untyped bool|incompatible types"
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue7316.go b/gcc/testsuite/go.test/test/fixedbugs/issue7316.go
new file mode 100644 (file)
index 0000000..0734641
--- /dev/null
@@ -0,0 +1,37 @@
+// runoutput
+
+// Copyright 2014 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 7316
+// This test exercises all types of numeric conversions, which was one
+// of the sources of etype mismatch during register allocation in 8g.
+
+package main
+
+import "fmt"
+
+const tpl = `
+func init() {
+       var i %s
+       j := %s(i)
+       _ = %s(j)
+}
+`
+
+func main() {
+       fmt.Println("package main")
+       ntypes := []string{
+               "byte", "rune", "uintptr",
+               "float32", "float64",
+               "int", "int8", "int16", "int32", "int64",
+               "uint", "uint8", "uint16", "uint32", "uint64",
+       }
+       for i, from := range ntypes {
+               for _, to := range ntypes[i:] {
+                       fmt.Printf(tpl, from, to, from)
+               }
+       }
+       fmt.Println("func main() {}")
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue7346.go b/gcc/testsuite/go.test/test/fixedbugs/issue7346.go
new file mode 100644 (file)
index 0000000..21fab2d
--- /dev/null
@@ -0,0 +1,14 @@
+// compile
+
+// Copyright 2014 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 7346 : internal error "doasm" error due to checknil
+// of a nil literal.
+
+package main
+
+func main() {
+       _ = *(*int)(nil)
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue7366.go b/gcc/testsuite/go.test/test/fixedbugs/issue7366.go
new file mode 100644 (file)
index 0000000..a6b786f
--- /dev/null
@@ -0,0 +1,21 @@
+// compile
+
+// Copyright 2014 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 7366: generates a temporary with ideal type
+// during comparison of small structs.
+
+package main
+
+type T struct {
+       data [10]byte
+}
+
+func main() {
+       var a T
+       var b T
+       if a == b {
+       }
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue7405.go b/gcc/testsuite/go.test/test/fixedbugs/issue7405.go
new file mode 100644 (file)
index 0000000..52e1176
--- /dev/null
@@ -0,0 +1,51 @@
+// compile
+
+// Copyright 2014 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 7405: the equality function for struct with many
+// embedded fields became more complex after fixing issue 7366,
+// leading to out of registers on 386.
+
+package p
+
+type T1 struct {
+       T2
+       T3
+       T4
+}
+
+type T2 struct {
+       Conn
+}
+
+type T3 struct {
+       PacketConn
+}
+
+type T4 struct {
+       PacketConn
+       T5
+}
+
+type T5 struct {
+       x int
+       T6
+}
+
+type T6 struct {
+       y, z int
+}
+
+type Conn interface {
+       A()
+}
+
+type PacketConn interface {
+       B()
+}
+
+func F(a, b T1) bool {
+       return a == b
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue7419.go b/gcc/testsuite/go.test/test/fixedbugs/issue7419.go
new file mode 100644 (file)
index 0000000..39b454c
--- /dev/null
@@ -0,0 +1,25 @@
+// run
+
+// Copyright 2014 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 7419: odd behavior for float constants underflowing to 0
+
+package main
+
+import (
+       "os"
+)
+
+var x = 1e-779137
+var y = 1e-779138
+
+func main() {
+       if x != 0 {
+               os.Exit(1)
+       }
+       if y != 0 {
+               os.Exit(2)
+       }
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue7538a.go b/gcc/testsuite/go.test/test/fixedbugs/issue7538a.go
new file mode 100644 (file)
index 0000000..b170150
--- /dev/null
@@ -0,0 +1,15 @@
+// errorcheck
+
+// Copyright 2014 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 7538: blank (_) labels handled incorrectly
+
+package p
+
+func f() {
+_:
+_:
+       goto _ // ERROR "not defined|undefined label"
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue7538b.go b/gcc/testsuite/go.test/test/fixedbugs/issue7538b.go
new file mode 100644 (file)
index 0000000..28cef5d
--- /dev/null
@@ -0,0 +1,13 @@
+// compile
+
+// Copyright 2014 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 7538: blank (_) labels handled incorrectly
+
+package p
+
+func f() {
+_:
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue7547.go b/gcc/testsuite/go.test/test/fixedbugs/issue7547.go
new file mode 100644 (file)
index 0000000..f75a330
--- /dev/null
@@ -0,0 +1,17 @@
+// compile
+
+// Copyright 2014 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 f() map[string]interface{} {
+       var p *map[string]map[string]interface{}
+       _ = p
+       return nil
+}
+
+func main() {
+       f()
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue7550.go b/gcc/testsuite/go.test/test/fixedbugs/issue7550.go
new file mode 100644 (file)
index 0000000..0c4cf93
--- /dev/null
@@ -0,0 +1,27 @@
+// run
+
+// Copyright 2014 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 shouldPanic(f func()) {
+        defer func() {
+                if recover() == nil {
+                        panic("not panicking")
+                }
+        }()
+        f()
+}
+
+func f() {
+        length := int(^uint(0) >> 1)
+        a := make([]struct{}, length)
+        b := make([]struct{}, length)
+        _ = append(a, b...)
+}
+
+func main() {
+       shouldPanic(f)
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue7590.go b/gcc/testsuite/go.test/test/fixedbugs/issue7590.go
new file mode 100644 (file)
index 0000000..607a3ae
--- /dev/null
@@ -0,0 +1,21 @@
+// compile
+
+// Copyright 2014 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 7590: gccgo incorrectly traverses nested composite literals.
+
+package p
+
+type S struct {
+       F int
+}
+
+var M = map[string]S{
+       "a": { F: 1 },
+}
+
+var P = M["a"]
+
+var F = P.F
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue7648.dir/a.go b/gcc/testsuite/go.test/test/fixedbugs/issue7648.dir/a.go
new file mode 100644 (file)
index 0000000..c76aaa6
--- /dev/null
@@ -0,0 +1,11 @@
+// Copyright 2014 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
+
+const (
+       sinPi4 = 0.70710678118654752440084436210484903928483593768847
+       A = complex(sinPi4, -sinPi4)
+)
+
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue7648.dir/b.go b/gcc/testsuite/go.test/test/fixedbugs/issue7648.dir/b.go
new file mode 100644 (file)
index 0000000..b9223ed
--- /dev/null
@@ -0,0 +1,11 @@
+// Copyright 2014 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
+
+import "a"
+
+func f() {
+       println(a.A)
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue7648.go b/gcc/testsuite/go.test/test/fixedbugs/issue7648.go
new file mode 100644 (file)
index 0000000..b391c4a
--- /dev/null
@@ -0,0 +1,9 @@
+// compiledir
+
+// Copyright 2014 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 7648: spurious "bad negated constant" for complex constants.
+
+package ignored
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue7740.go b/gcc/testsuite/go.test/test/fixedbugs/issue7740.go
new file mode 100644 (file)
index 0000000..8f1afe8
--- /dev/null
@@ -0,0 +1,35 @@
+// run
+
+// Copyright 2015 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.
+
+// This test computes the precision of the compiler's internal multiprecision floats.
+
+package main
+
+import (
+       "fmt"
+       "math"
+       "runtime"
+)
+
+const ulp = (1.0 + (2.0 / 3.0)) - (5.0 / 3.0)
+
+func main() {
+       // adjust precision depending on compiler
+       var prec float64
+       switch runtime.Compiler {
+       case "gc":
+               prec = 512
+       case "gccgo":
+               prec = 256
+       default:
+               // unknown compiler
+               return
+       }
+       p := 1 - math.Log(math.Abs(ulp))/math.Log(2)
+       if math.Abs(p-prec) > 1e-10 {
+               fmt.Printf("BUG: got %g; want %g\n", p, prec)
+       }
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue7742.go b/gcc/testsuite/go.test/test/fixedbugs/issue7742.go
new file mode 100644 (file)
index 0000000..dc167c2
--- /dev/null
@@ -0,0 +1,18 @@
+// compile
+
+// Copyright 2014 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 7742: cannot use &autotmp_0001 (type *map[string]string) as type *string in function argument
+
+package main
+
+var (
+       m map[string]string
+       v string
+)
+
+func main() {
+       m[v], _ = v, v
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue7746.go b/gcc/testsuite/go.test/test/fixedbugs/issue7746.go
new file mode 100644 (file)
index 0000000..7454962
--- /dev/null
@@ -0,0 +1,133 @@
+// errorcheck
+
+// Copyright 2015 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
+
+const (
+       c0   = 1 << 100
+       c1   = c0 * c0
+       c2   = c1 * c1
+       c3   = c2 * c2 // GC_ERROR "overflow"
+       c4   = c3 * c3
+       c5   = c4 * c4
+       c6   = c5 * c5
+       c7   = c6 * c6
+       c8   = c7 * c7
+       c9   = c8 * c8
+       c10  = c9 * c9
+       c11  = c10 * c10
+       c12  = c11 * c11
+       c13  = c12 * c12
+       c14  = c13 * c13 // GCCGO_ERROR "overflow"
+       c15  = c14 * c14
+       c16  = c15 * c15
+       c17  = c16 * c16
+       c18  = c17 * c17
+       c19  = c18 * c18
+       c20  = c19 * c19
+       c21  = c20 * c20
+       c22  = c21 * c21
+       c23  = c22 * c22
+       c24  = c23 * c23
+       c25  = c24 * c24
+       c26  = c25 * c25
+       c27  = c26 * c26
+       c28  = c27 * c27
+       c29  = c28 * c28
+       c30  = c29 * c29
+       c31  = c30 * c30
+       c32  = c31 * c31
+       c33  = c32 * c32
+       c34  = c33 * c33
+       c35  = c34 * c34
+       c36  = c35 * c35
+       c37  = c36 * c36
+       c38  = c37 * c37
+       c39  = c38 * c38
+       c40  = c39 * c39
+       c41  = c40 * c40
+       c42  = c41 * c41
+       c43  = c42 * c42
+       c44  = c43 * c43
+       c45  = c44 * c44
+       c46  = c45 * c45
+       c47  = c46 * c46
+       c48  = c47 * c47
+       c49  = c48 * c48
+       c50  = c49 * c49
+       c51  = c50 * c50
+       c52  = c51 * c51
+       c53  = c52 * c52
+       c54  = c53 * c53
+       c55  = c54 * c54
+       c56  = c55 * c55
+       c57  = c56 * c56
+       c58  = c57 * c57
+       c59  = c58 * c58
+       c60  = c59 * c59
+       c61  = c60 * c60
+       c62  = c61 * c61
+       c63  = c62 * c62
+       c64  = c63 * c63
+       c65  = c64 * c64
+       c66  = c65 * c65
+       c67  = c66 * c66
+       c68  = c67 * c67
+       c69  = c68 * c68
+       c70  = c69 * c69
+       c71  = c70 * c70
+       c72  = c71 * c71
+       c73  = c72 * c72
+       c74  = c73 * c73
+       c75  = c74 * c74
+       c76  = c75 * c75
+       c77  = c76 * c76
+       c78  = c77 * c77
+       c79  = c78 * c78
+       c80  = c79 * c79
+       c81  = c80 * c80
+       c82  = c81 * c81
+       c83  = c82 * c82
+       c84  = c83 * c83
+       c85  = c84 * c84
+       c86  = c85 * c85
+       c87  = c86 * c86
+       c88  = c87 * c87
+       c89  = c88 * c88
+       c90  = c89 * c89
+       c91  = c90 * c90
+       c92  = c91 * c91
+       c93  = c92 * c92
+       c94  = c93 * c93
+       c95  = c94 * c94
+       c96  = c95 * c95
+       c97  = c96 * c96
+       c98  = c97 * c97
+       c99  = c98 * c98
+       c100 = c99 * c99
+)
+
+func main() {
+       println(c1 / c1)
+       println(c2 / c2)
+       println(c3 / c3)
+       println(c4 / c4)
+       println(c5 / c5)
+       println(c6 / c6)
+       println(c7 / c7)
+       println(c8 / c8)
+       println(c9 / c9)
+       println(c10 / c10)
+       println(c20 / c20)
+       println(c30 / c30)
+       println(c40 / c40)
+       println(c50 / c50)
+       println(c60 / c60)
+       println(c70 / c70)
+       println(c80 / c80)
+       println(c90 / c90)
+       println(c100 / c100)
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue7760.go b/gcc/testsuite/go.test/test/fixedbugs/issue7760.go
new file mode 100644 (file)
index 0000000..7e1d035
--- /dev/null
@@ -0,0 +1,25 @@
+// errorcheck
+
+// Copyright 2014 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.
+
+// Verify that pointers can't be used as constants.
+
+package main
+
+import "unsafe"
+
+type myPointer unsafe.Pointer
+
+const _ = unsafe.Pointer(uintptr(1)) // ERROR "is not (a )?constant|invalid constant type"
+const _ = myPointer(uintptr(1)) // ERROR "is not (a )?constant|invalid constant type"
+
+const _ = (*int)(unsafe.Pointer(uintptr(1))) // ERROR "is not (a )?constant|invalid constant type"
+const _ = (*int)(myPointer(uintptr(1))) // ERROR "is not (a )?constant|invalid constant type"
+
+const _ = uintptr(unsafe.Pointer(uintptr(1))) // ERROR "is not (a )?constant|expression is not constant"
+const _ = uintptr(myPointer(uintptr(1))) // ERROR "is not (a )?constant|expression is no constant"
+
+const _ = []byte("") // ERROR "is not (a )?constant|invalid constant type"
+const _ = []rune("") // ERROR "is not (a )?constant|invalid constant type"
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue7794.go b/gcc/testsuite/go.test/test/fixedbugs/issue7794.go
new file mode 100644 (file)
index 0000000..f31de94
--- /dev/null
@@ -0,0 +1,12 @@
+// compile
+
+// Copyright 2014 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() {
+       var a [10]int
+       const ca = len(a)
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue7863.go b/gcc/testsuite/go.test/test/fixedbugs/issue7863.go
new file mode 100644 (file)
index 0000000..da2ed05
--- /dev/null
@@ -0,0 +1,60 @@
+// run
+
+// Copyright 2014 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"
+)
+
+type Foo int64
+
+func (f *Foo) F() int64 {
+       return int64(*f)
+}
+
+type Bar int64
+
+func (b Bar) F() int64 {
+       return int64(b)
+}
+
+type Baz int32
+
+func (b Baz) F() int64 {
+       return int64(b)
+}
+
+func main() {
+       foo := Foo(123)
+       f := foo.F
+       if foo.F() != f() {
+               bug()
+               fmt.Println("foo.F", foo.F(), f())
+       }
+       bar := Bar(123)
+       f = bar.F
+       if bar.F() != f() {
+               bug()
+               fmt.Println("bar.F", bar.F(), f()) // duh!
+       }
+
+       baz := Baz(123)
+       f = baz.F
+       if baz.F() != f() {
+               bug()
+               fmt.Println("baz.F", baz.F(), f())
+       }
+}
+
+var bugged bool
+
+func bug() {
+       if !bugged {
+               bugged = true
+               fmt.Println("BUG")
+       }
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue7867.go b/gcc/testsuite/go.test/test/fixedbugs/issue7867.go
new file mode 100644 (file)
index 0000000..166506e
--- /dev/null
@@ -0,0 +1,43 @@
+// runoutput
+
+// Copyright 2014 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 7867.
+
+package main
+
+import "fmt"
+
+const tpl = `
+func Test%d(t %s) {
+       _ = t
+       _ = t
+}
+`
+
+func main() {
+       fmt.Println("package main")
+       types := []string{
+               // These types always passed
+               "bool", "int", "rune",
+               "*int", "uintptr",
+               "float32", "float64",
+               "chan struct{}",
+               "map[string]struct{}",
+               "func()", "func(string)error",
+
+               // These types caused compilation failures
+               "complex64", "complex128",
+               "struct{}", "struct{n int}", "struct{e error}", "struct{m map[string]string}",
+               "string",
+               "[4]byte",
+               "[]byte",
+               "interface{}", "error",
+       }
+       for i, typ := range types {
+               fmt.Printf(tpl, i, typ)
+       }
+       fmt.Println("func main() {}")
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue7884.go b/gcc/testsuite/go.test/test/fixedbugs/issue7884.go
new file mode 100644 (file)
index 0000000..ab7a858
--- /dev/null
@@ -0,0 +1,15 @@
+// compile
+
+// Copyright 2014 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() {
+       var ii interface{} = 5
+       zz, err := ii.(interface{})
+       fmt.Println(zz, err)
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue7921.go b/gcc/testsuite/go.test/test/fixedbugs/issue7921.go
new file mode 100644 (file)
index 0000000..5dce557
--- /dev/null
@@ -0,0 +1,57 @@
+// +build !gcflags_noopt
+// errorcheck -0 -m
+
+// Copyright 2018 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 foo
+
+import "bytes"
+
+// In order to get desired results, we need a combination of
+// both escape analysis and inlining.
+
+func bufferNotEscape() string {
+       // b itself does not escape, only its buf field will be
+       // copied during String() call, but object "handle" itself
+       // can be stack-allocated.
+       var b bytes.Buffer
+       b.WriteString("123")
+       b.Write([]byte{'4'}) // ERROR "\[\]byte{...} does not escape$"
+       return b.String()    // ERROR "inlining call to bytes.\(\*Buffer\).String$" "string\(bytes.b.buf\[bytes.b.off:\]\) escapes to heap$"
+}
+
+func bufferNoEscape2(xs []string) int { // ERROR "xs does not escape$"
+       b := bytes.NewBuffer(make([]byte, 0, 64)) // ERROR "&bytes.Buffer{...} does not escape$" "make\(\[\]byte, 0, 64\) does not escape$" "inlining call to bytes.NewBuffer$"
+       for _, x := range xs {
+               b.WriteString(x)
+       }
+       return b.Len() // ERROR "inlining call to bytes.\(\*Buffer\).Len$"
+}
+
+func bufferNoEscape3(xs []string) string { // ERROR "xs does not escape$"
+       b := bytes.NewBuffer(make([]byte, 0, 64)) // ERROR "&bytes.Buffer{...} does not escape$" "make\(\[\]byte, 0, 64\) does not escape$" "inlining call to bytes.NewBuffer$"
+       for _, x := range xs {
+               b.WriteString(x)
+               b.WriteByte(',')
+       }
+       return b.String() // ERROR "inlining call to bytes.\(\*Buffer\).String$" "string\(bytes.b.buf\[bytes.b.off:\]\) escapes to heap$"
+}
+
+func bufferNoEscape4() []byte {
+       var b bytes.Buffer
+       b.Grow(64) // ERROR "bufferNoEscape4 ignoring self-assignment in bytes.b.buf = bytes.b.buf\[:bytes.m·3\]$" "inlining call to bytes.\(\*Buffer\).Grow$"
+       useBuffer(&b)
+       return b.Bytes() // ERROR "inlining call to bytes.\(\*Buffer\).Bytes$"
+}
+
+func bufferNoEscape5() { // ERROR "can inline bufferNoEscape5$"
+       b := bytes.NewBuffer(make([]byte, 0, 128)) // ERROR "&bytes.Buffer{...} does not escape$" "make\(\[\]byte, 0, 128\) does not escape$" "inlining call to bytes.NewBuffer$"
+       useBuffer(b)
+}
+
+//go:noinline
+func useBuffer(b *bytes.Buffer) { // ERROR "b does not escape$"
+       b.WriteString("1234")
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue7944.go b/gcc/testsuite/go.test/test/fixedbugs/issue7944.go
new file mode 100644 (file)
index 0000000..960065b
--- /dev/null
@@ -0,0 +1,40 @@
+// run
+
+// Copyright 2014 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 7944:
+// Liveness bitmaps said b was live at call to g,
+// but no one told the register optimizer.
+
+package main
+
+import "runtime"
+
+func f(b []byte) {
+       for len(b) > 0 {
+               n := len(b)
+               n = f1(n)
+               f2(b[n:])
+               b = b[n:]
+       }
+       g()
+}
+
+func f1(n int) int {
+       runtime.GC()
+       return n
+}
+
+func f2(b []byte) {
+       runtime.GC()
+}
+
+func g() {
+       runtime.GC()
+}
+
+func main() {
+       f(make([]byte, 100))
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue7995.go b/gcc/testsuite/go.test/test/fixedbugs/issue7995.go
new file mode 100644 (file)
index 0000000..af77a6d
--- /dev/null
@@ -0,0 +1,25 @@
+// run
+
+// Copyright 2014 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 7995: globals not flushed quickly enough.
+
+package main
+
+import "fmt"
+
+var (
+       p = 1
+       q = &p
+)
+
+func main() {
+       p = 50
+       *q = 100
+       s := fmt.Sprintln(p, *q)
+       if s != "100 100\n" {
+               println("BUG:", s)
+       }
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue7995b.dir/x1.go b/gcc/testsuite/go.test/test/fixedbugs/issue7995b.dir/x1.go
new file mode 100644 (file)
index 0000000..bafecf5
--- /dev/null
@@ -0,0 +1,12 @@
+package x1
+
+import "fmt"
+
+var P int
+
+//go:noinline
+func F(x *int) string {
+       P = 50
+       *x = 100
+       return fmt.Sprintln(P, *x)
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue7995b.dir/x2.go b/gcc/testsuite/go.test/test/fixedbugs/issue7995b.dir/x2.go
new file mode 100644 (file)
index 0000000..eea23ea
--- /dev/null
@@ -0,0 +1,10 @@
+package main
+
+import "./x1"
+
+func main() {
+       s := x1.F(&x1.P)
+       if s != "100 100\n" {
+               println("BUG:", s)
+       }
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue7995b.go b/gcc/testsuite/go.test/test/fixedbugs/issue7995b.go
new file mode 100644 (file)
index 0000000..2f57371
--- /dev/null
@@ -0,0 +1,9 @@
+// rundir
+
+// Copyright 2014 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 7995: globals not flushed quickly enough.
+
+package ignored
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue7996.go b/gcc/testsuite/go.test/test/fixedbugs/issue7996.go
new file mode 100644 (file)
index 0000000..1ee6fc7
--- /dev/null
@@ -0,0 +1,14 @@
+// compile
+
+// Copyright 2014 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.
+
+// /tmp/x.go:5: illegal constant expression: bool == interface {}
+
+package p
+
+var m = map[interface{}]struct{}{
+       nil:  {},
+       true: {},
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue7997.go b/gcc/testsuite/go.test/test/fixedbugs/issue7997.go
new file mode 100644 (file)
index 0000000..a342189
--- /dev/null
@@ -0,0 +1,53 @@
+// compile
+
+// Copyright 2014 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.
+
+// /tmp/x.go:3: internal error: f &p (type *int) recorded as live on entry
+
+package p
+
+func f(ch chan int) *int {
+       select {
+       case p1x := <-ch:
+               return &p1x
+       default:
+               // ok
+       }
+       select {
+       case p1 := <-ch:
+               return &p1
+       default:
+               // ok
+       }
+       select {
+       case p2 := <-ch:
+               return &p2
+       case p3 := <-ch:
+               return &p3
+       default:
+               // ok
+       }
+       select {
+       case p4, ok := <-ch:
+               if ok {
+                       return &p4
+               }
+       default:
+               // ok
+       }
+       select {
+       case p5, ok := <-ch:
+               if ok {
+                       return &p5
+               }
+       case p6, ok := <-ch:
+               if !ok {
+                       return &p6
+               }
+       default:
+               // ok
+       }
+       return nil
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue7998.go b/gcc/testsuite/go.test/test/fixedbugs/issue7998.go
new file mode 100644 (file)
index 0000000..8da39e8
--- /dev/null
@@ -0,0 +1,23 @@
+// compile
+
+// Copyright 2014 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.
+
+// /tmp/x.go:5: cannot use _ as value
+
+package p
+
+func f(ch chan int) bool {
+       select {
+       case _, ok := <-ch:
+               return ok
+       }
+       _, ok := <-ch
+       _ = ok
+       select {
+       case _, _ = <-ch:
+               return true
+       }
+       return false
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue8004.go b/gcc/testsuite/go.test/test/fixedbugs/issue8004.go
new file mode 100644 (file)
index 0000000..548ee1c
--- /dev/null
@@ -0,0 +1,59 @@
+// run
+
+// Copyright 2014 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 (
+       "reflect"
+       "runtime"
+       "unsafe"
+)
+
+func main() {
+       test1()
+       test2()
+}
+
+func test1() {
+       var all []interface{}
+       for i := 0; i < 100; i++ {
+               p := new([]int)
+               *p = append(*p, 1, 2, 3, 4)
+               h := (*reflect.SliceHeader)(unsafe.Pointer(p))
+               all = append(all, h, p)
+       }
+       runtime.GC()
+       for i := 0; i < 100; i++ {
+               p := *all[2*i+1].(*[]int)
+               if p[0] != 1 || p[1] != 2 || p[2] != 3 || p[3] != 4 {
+                       println("BUG test1: bad slice at index", i, p[0], p[1], p[2], p[3])
+                       return
+               }
+       }
+}
+
+type T struct {
+       H *reflect.SliceHeader
+       P *[]int
+}
+
+func test2() {
+       var all []T
+       for i := 0; i < 100; i++ {
+               p := new([]int)
+               *p = append(*p, 1, 2, 3, 4)
+               h := (*reflect.SliceHeader)(unsafe.Pointer(p))
+               all = append(all, T{H: h}, T{P: p})
+       }
+       runtime.GC()
+       for i := 0; i < 100; i++ {
+               p := *all[2*i+1].P
+               if p[0] != 1 || p[1] != 2 || p[2] != 3 || p[3] != 4 {
+                       println("BUG test2: bad slice at index", i, p[0], p[1], p[2], p[3])
+                       return
+               }
+       }
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue8011.go b/gcc/testsuite/go.test/test/fixedbugs/issue8011.go
new file mode 100644 (file)
index 0000000..57af2a9
--- /dev/null
@@ -0,0 +1,18 @@
+// run
+
+// Copyright 2014 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() {
+       c := make(chan chan int, 1)
+       c1 := make(chan int, 1)
+       c1 <- 42
+       c <- c1
+       x := <-<-c
+       if x != 42 {
+               println("BUG:", x, "!= 42")
+       }
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue8017.go b/gcc/testsuite/go.test/test/fixedbugs/issue8017.go
new file mode 100644 (file)
index 0000000..9afcdf0
--- /dev/null
@@ -0,0 +1,26 @@
+// compile
+
+// Copyright 2014 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.
+
+// Issues 8017 and 8058: walk modifies nodes generated
+// by slicelit and causes an internal error afterwards
+// when gen_as_init parses it back.
+
+package main
+
+func F() {
+       var ch chan int
+       select {
+       case <-ch:
+       case <-make(chan int, len([2][]int{([][]int{})[len(ch)], []int{}})):
+       }
+}
+
+func G() {
+       select {
+       case <-([1][]chan int{[]chan int{}})[0][0]:
+       default:
+       }
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue8028.go b/gcc/testsuite/go.test/test/fixedbugs/issue8028.go
new file mode 100644 (file)
index 0000000..9f2649a
--- /dev/null
@@ -0,0 +1,27 @@
+// compile
+
+// Copyright 2014 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 8028. Used to fail in -race mode with "non-orig name" error.
+
+package p
+
+var (
+       t2 = T{F, "s1"}
+       t1 = T{F, "s2"}
+
+       tt = [...]T{t1, t2}
+)
+
+type I interface{}
+
+type T struct {
+       F func() I
+       S string
+}
+
+type E struct{}
+
+func F() I { return new(E) }
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue8036.go b/gcc/testsuite/go.test/test/fixedbugs/issue8036.go
new file mode 100644 (file)
index 0000000..82ba7f7
--- /dev/null
@@ -0,0 +1,45 @@
+// run
+
+// Copyright 2014 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 8036. Stores necessary for stack scan being eliminated as redundant by optimizer.
+
+package main
+
+import "runtime"
+
+type T struct {
+       X *int
+       Y *int
+       Z *int
+}
+
+type TI [3]uintptr
+
+//go:noinline
+func G() (t TI) {
+       t[0] = 1
+       t[1] = 2
+       t[2] = 3
+       return
+}
+
+//go:noinline
+func F() (t T) {
+       t.X = newint()
+       t.Y = t.X
+       t.Z = t.Y
+       return
+}
+
+func newint() *int {
+       runtime.GC()
+       return nil
+}
+
+func main() {
+       G() // leave non-pointers where F's return values go
+       F()
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue8039.go b/gcc/testsuite/go.test/test/fixedbugs/issue8039.go
new file mode 100644 (file)
index 0000000..ee00c60
--- /dev/null
@@ -0,0 +1,23 @@
+// run
+
+// Copyright 2014 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 8039. defer copy(x, <-c) did not rewrite <-c properly.
+
+package main
+
+func f(s []int) {
+       c := make(chan []int, 1)
+       c <- []int{1}
+       defer copy(s, <-c)
+}
+
+func main() {
+       x := make([]int, 1)
+       f(x)
+       if x[0] != 1 {
+               println("BUG", x[0])
+       }
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue8047.go b/gcc/testsuite/go.test/test/fixedbugs/issue8047.go
new file mode 100644 (file)
index 0000000..5ac4a0e
--- /dev/null
@@ -0,0 +1,29 @@
+// run
+
+// Copyright 2014 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 8047.  Stack copier shouldn't crash if there
+// is a nil defer.
+
+package main
+
+func stackit(n int) {
+       if n == 0 {
+               return
+       }
+       stackit(n - 1)
+}
+
+func main() {
+       defer func() {
+               // catch & ignore panic from nil defer below
+               err := recover()
+               if err == nil {
+                       panic("defer of nil func didn't panic")
+               }
+       }()
+       defer ((func())(nil))()
+       stackit(1000)
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue8047b.go b/gcc/testsuite/go.test/test/fixedbugs/issue8047b.go
new file mode 100644 (file)
index 0000000..5eaf9c5
--- /dev/null
@@ -0,0 +1,26 @@
+// run
+
+// Copyright 2014 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 8047. Defer setup during panic shouldn't crash for nil defer.
+
+package main
+
+func main() {
+       defer func() {
+               // This recover recovers the panic caused by the nil defer func
+               // g(). The original panic(1) was already aborted/replaced by this
+               // new panic, so when this recover is done, the program completes
+               // normally.
+               recover()
+       }()
+       f()
+}
+
+func f() {
+       var g func()
+       defer g()
+       panic(1)
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue8048.go b/gcc/testsuite/go.test/test/fixedbugs/issue8048.go
new file mode 100644 (file)
index 0000000..577f606
--- /dev/null
@@ -0,0 +1,107 @@
+// run
+
+// Copyright 2014 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 8048. Incorrect handling of liveness when walking stack
+// containing faulting frame.
+
+package main
+
+import "runtime"
+
+func main() {
+       test1()
+       test2()
+       test3()
+}
+
+func test1() {
+       // test1f will panic without its own defer.
+       // The runtime.GC checks that we can walk the stack
+       // at that point and not get confused.
+       // The recover lets test1 exit normally.
+       defer func() {
+               runtime.GC()
+               recover()
+       }()
+       test1f()
+}
+
+func test1f() {
+       // Because b == false, the if does not execute,
+       // so x == nil, so the println(*x) faults reading
+       // from nil. The compiler will lay out the code
+       // so that the if body occurs above the *x,
+       // so if the liveness info at the *x is used, it will
+       // find the liveness at the call to runtime.GC.
+       // It will think y is live, but y is uninitialized,
+       // and the runtime will crash detecting a bad slice.
+       // The runtime should see that there are no defers
+       // corresponding to this panicked frame and ignore
+       // the frame entirely.
+       var x *int
+       var b bool
+       if b {
+               y := make([]int, 1)
+               runtime.GC()
+               x = &y[0]
+       }
+       println(*x)
+}
+
+func test2() {
+       // Same as test1, but the fault happens in the function with the defer.
+       // The runtime should see the defer and garbage collect the frame
+       // as if the PC were immediately after the defer statement.
+       defer func() {
+               runtime.GC()
+               recover()
+       }()
+       var x *int
+       var b bool
+       if b {
+               y := make([]int, 1)
+               runtime.GC()
+               x = &y[0]
+       }
+       println(*x)
+}
+
+func test3() {
+       // Like test1 but avoid array index, which does not
+       // move to end of function on ARM.
+       defer func() {
+               runtime.GC()
+               recover()
+       }()
+       test3setup()
+       test3f()
+}
+
+func test3setup() {
+       var x uintptr
+       var b bool
+       b = true
+       if b {
+               y := uintptr(123)
+               runtime.GC()
+               x = y
+       }
+       runtime.GC()
+       globl = x
+}
+
+var globl uintptr
+
+func test3f() {
+       var x *int
+       var b bool
+       if b {
+               y := new(int)
+               runtime.GC()
+               x = y
+       }
+       println(*x)
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue8060.dir/a.go b/gcc/testsuite/go.test/test/fixedbugs/issue8060.dir/a.go
new file mode 100644 (file)
index 0000000..22ba69e
--- /dev/null
@@ -0,0 +1,7 @@
+// Copyright 2014 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
+
+var A = []*[2][1]float64{}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue8060.dir/b.go b/gcc/testsuite/go.test/test/fixedbugs/issue8060.dir/b.go
new file mode 100644 (file)
index 0000000..85fb6ec
--- /dev/null
@@ -0,0 +1,13 @@
+// Copyright 2014 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
+
+import "a"
+
+var X = a.A
+
+func b() {
+       _ = [3][1]float64{}
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue8060.go b/gcc/testsuite/go.test/test/fixedbugs/issue8060.go
new file mode 100644 (file)
index 0000000..ec52659
--- /dev/null
@@ -0,0 +1,9 @@
+// compiledir
+
+// Copyright 2014 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 8060: internal compiler error.
+
+package ignored
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue8073.go b/gcc/testsuite/go.test/test/fixedbugs/issue8073.go
new file mode 100644 (file)
index 0000000..d47481c
--- /dev/null
@@ -0,0 +1,15 @@
+// compile
+
+// Copyright 2014 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 8073.
+// was "internal compiler error: overflow: float64 integer constant"
+
+package main
+
+func main() {
+       var x int
+       _ = float64(x * 0)
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue8074.go b/gcc/testsuite/go.test/test/fixedbugs/issue8074.go
new file mode 100644 (file)
index 0000000..604a4f9
--- /dev/null
@@ -0,0 +1,16 @@
+// compile
+
+// Copyright 2014 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 8074.
+// was "cannot take the address of 1"
+
+package main
+
+func main() {
+       a := make([]byte, 10)
+       m := make(map[float64][]byte)
+       go copy(a, m[1.0])
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue8076.go b/gcc/testsuite/go.test/test/fixedbugs/issue8076.go
new file mode 100644 (file)
index 0000000..543ccc1
--- /dev/null
@@ -0,0 +1,17 @@
+// compile
+
+// Copyright 2014 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 8076. nilwalkfwd walked forward forever
+// on the instruction loop following the dereference.
+
+package main
+
+func main() {
+       _ = *(*int)(nil)
+L:
+       _ = 0
+       goto L
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue8079.go b/gcc/testsuite/go.test/test/fixedbugs/issue8079.go
new file mode 100644 (file)
index 0000000..994999b
--- /dev/null
@@ -0,0 +1,11 @@
+// compile
+
+// Copyright 2014 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 8079: gccgo crashes when compiling interface with blank type name.
+
+package p
+
+type _ interface{}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue8132.go b/gcc/testsuite/go.test/test/fixedbugs/issue8132.go
new file mode 100644 (file)
index 0000000..b28a84c
--- /dev/null
@@ -0,0 +1,32 @@
+// run
+
+// Copyright 2014 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 8132. stack walk handling of panic stack was confused
+// about what was legal.
+
+package main
+
+import "runtime"
+
+var p *int
+
+func main() {
+       func() {
+               defer func() {
+                       runtime.GC()
+                       recover()
+               }()
+               var x [8192]byte
+               func(x [8192]byte) {
+                       defer func() {
+                               if err := recover(); err != nil {
+                                       println(*p)
+                               }
+                       }()
+                       println(*p)
+               }(x)
+       }()
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue8139.go b/gcc/testsuite/go.test/test/fixedbugs/issue8139.go
new file mode 100644 (file)
index 0000000..6e5607d
--- /dev/null
@@ -0,0 +1,50 @@
+// run
+
+// Copyright 2014 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 8139. The x.(T) assertions used to write 1 (unexpected)
+// return byte for the 0-byte return value T.
+
+package main
+
+import "fmt"
+
+type T struct{}
+
+func (T) M() {}
+
+type M interface {
+       M()
+}
+
+var e interface{} = T{}
+var i M = T{}
+var b bool
+
+func f1() int {
+       if b {
+               return f1() // convince inliner not to inline
+       }
+       z := 0x11223344
+       _ = e.(T)
+       return z
+}
+
+func f2() int {
+       if b {
+               return f1() // convince inliner not to inline
+       }
+       z := 0x11223344
+       _ = i.(T)
+       return z
+}
+
+func main() {
+       x := f1()
+       y := f2()
+       if x != 0x11223344 || y != 0x11223344 {
+               fmt.Printf("BUG: x=%#x y=%#x, want 0x11223344 for both\n", x, y)
+       }
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue8154.go b/gcc/testsuite/go.test/test/fixedbugs/issue8154.go
new file mode 100644 (file)
index 0000000..3ffad34
--- /dev/null
@@ -0,0 +1,14 @@
+// compile
+
+// Copyright 2015 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 8154: cmd/5g: ICE in walkexpr walk.c
+
+package main
+
+func main() {
+       c := make(chan int)
+       _ = [1][]func(){[]func(){func() { <-c }}}
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue8155.go b/gcc/testsuite/go.test/test/fixedbugs/issue8155.go
new file mode 100644 (file)
index 0000000..56a6738
--- /dev/null
@@ -0,0 +1,48 @@
+// run
+
+// Copyright 2014 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 8155.
+// Alignment of stack prologue zeroing was wrong on 64-bit Native Client
+// (because of 32-bit pointers).
+
+package main
+
+import "runtime"
+
+func bad(b bool) uintptr {
+       var p **int
+       var x1 uintptr
+       x1 = 1
+       if b {
+               var x [11]*int
+               p = &x[0]
+       }
+       if b {
+               var x [1]*int
+               p = &x[0]
+       }
+       runtime.GC()
+       if p != nil {
+               x1 = uintptr(**p)
+       }
+       return x1
+}
+
+func poison() uintptr {
+       runtime.GC()
+       var x [20]uintptr
+       var s uintptr
+       for i := range x {
+               x[i] = uintptr(i+1)
+               s += x[i]
+       }
+       return s
+}
+
+func main() {
+       poison()
+       bad(false)
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue8158.go b/gcc/testsuite/go.test/test/fixedbugs/issue8158.go
new file mode 100644 (file)
index 0000000..150b338
--- /dev/null
@@ -0,0 +1,41 @@
+// run
+
+// Copyright 2014 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"
+       "time"
+)
+
+func main() {
+       c := make(chan bool, 1)
+       go f1(c)
+       <-c
+       time.Sleep(10 * time.Millisecond)
+       go f2(c)
+       <-c
+}
+
+func f1(done chan bool) {
+       defer func() {
+               recover()
+               done <- true
+               runtime.Goexit() // left stack-allocated Panic struct on gp->panic stack
+       }()
+       panic("p")
+}
+
+func f2(done chan bool) {
+       defer func() {
+               recover()
+               done <- true
+               runtime.Goexit()
+       }()
+       time.Sleep(10 * time.Millisecond) // overwrote Panic struct with Timer struct
+       runtime.GC()                      // walked gp->panic list, found mangled Panic struct, crashed
+       panic("p")
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue8183.go b/gcc/testsuite/go.test/test/fixedbugs/issue8183.go
new file mode 100644 (file)
index 0000000..caac667
--- /dev/null
@@ -0,0 +1,23 @@
+// errorcheck
+
+// Copyright 2015 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.
+
+// Tests correct reporting of line numbers for errors involving iota,
+// Issue #8183.
+package foo
+
+const (
+       ok = byte(iota + 253)
+       bad
+       barn
+       bard // ERROR "constant 256 overflows byte|integer constant overflow"
+)
+
+const (
+       c = len([1 - iota]int{})
+       d
+       e // ERROR "array bound must be non-negative|negative array bound"
+       f // ERROR "array bound must be non-negative|negative array bound"
+)
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue8280.dir/a.go b/gcc/testsuite/go.test/test/fixedbugs/issue8280.dir/a.go
new file mode 100644 (file)
index 0000000..588536e
--- /dev/null
@@ -0,0 +1,3 @@
+package a
+
+var Bar = func() (_ int) { return 0 }
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue8280.dir/b.go b/gcc/testsuite/go.test/test/fixedbugs/issue8280.dir/b.go
new file mode 100644 (file)
index 0000000..c46c554
--- /dev/null
@@ -0,0 +1,5 @@
+package b
+
+import "./a"
+
+var foo = a.Bar
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue8280.go b/gcc/testsuite/go.test/test/fixedbugs/issue8280.go
new file mode 100644 (file)
index 0000000..91256c8
--- /dev/null
@@ -0,0 +1,9 @@
+// compiledir
+
+// Copyright 2014 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 8280: cannot import package exporting a func var returning a result named _
+
+package ignored
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue8311.go b/gcc/testsuite/go.test/test/fixedbugs/issue8311.go
new file mode 100644 (file)
index 0000000..b5fd5da
--- /dev/null
@@ -0,0 +1,16 @@
+// errorcheck
+
+// Copyright 2014 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 8311.
+// error for x++ should say x++ not x += 1
+
+package p
+
+func f() {
+       var x []byte
+       x++ // ERROR "invalid operation: x[+][+]|non-numeric type"
+
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue8325.go b/gcc/testsuite/go.test/test/fixedbugs/issue8325.go
new file mode 100644 (file)
index 0000000..6b0fc25
--- /dev/null
@@ -0,0 +1,31 @@
+// run
+
+// Copyright 2014 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 8325: corrupted byte operations during optimization
+// pass.
+
+package main
+
+const alphanum = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"
+
+func main() {
+       var bytes = []byte{10, 20, 30, 40, 50}
+
+       for i, b := range bytes {
+               bytes[i] = alphanum[b%byte(len(alphanum))]
+       }
+
+       for _, b := range bytes {
+               switch {
+               case '0' <= b && b <= '9',
+                       'A' <= b && b <= 'Z':
+               default:
+                       println("found a bad character", string(b))
+                       panic("BUG")
+               }
+
+       }
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue8336.go b/gcc/testsuite/go.test/test/fixedbugs/issue8336.go
new file mode 100644 (file)
index 0000000..419fdf1
--- /dev/null
@@ -0,0 +1,29 @@
+// run
+
+// Copyright 2014 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 8336. Order of evaluation of receive channels in select.
+
+package main
+
+type X struct {
+       c chan int
+}
+
+func main() {
+       defer func() {
+               recover()
+       }()
+       var x *X
+       select {
+       case <-x.c: // should fault and panic before foo is called
+       case <-foo():
+       }
+}
+
+func foo() chan int {
+       println("BUG: foo must not be called")
+       return make(chan int)
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue8347.go b/gcc/testsuite/go.test/test/fixedbugs/issue8347.go
new file mode 100644 (file)
index 0000000..6394a95
--- /dev/null
@@ -0,0 +1,27 @@
+// run
+
+// Copyright 2014 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() {
+       c := make(chan bool, 1)
+       ok := true
+       for i := 0; i < 12; i++ {
+               select {
+               case _, ok = <-c:
+                       if i < 10 && !ok {
+                               panic("BUG")
+                       }
+               default:
+               }
+               if i < 10 && !ok {
+                       panic("BUG")
+               }
+               if i >= 10 && ok {
+                       close(c)
+               }
+       }
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue8385.go b/gcc/testsuite/go.test/test/fixedbugs/issue8385.go
new file mode 100644 (file)
index 0000000..f3d395e
--- /dev/null
@@ -0,0 +1,42 @@
+// errorcheck
+
+// Copyright 2014 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 8385: provide a more descriptive error when a method expression
+// is called without a receiver.
+
+package main
+
+type Fooer interface {
+       Foo(i, j int)
+}
+
+func f(x int) {
+}
+
+type I interface {
+       M(int)
+}
+type T struct{}
+
+func (t T) M(x int) {
+}
+
+func g() func(int)
+
+func main() {
+       Fooer.Foo(5, 6) // ERROR "not enough arguments in call to method expression Fooer.Foo|incompatible type|not enough arguments"
+
+       var i I
+       var t *T
+
+       g()()    // ERROR "not enough arguments in call to g\(\)|not enough arguments"
+       f()      // ERROR "not enough arguments in call to f|not enough arguments"
+       i.M()    // ERROR "not enough arguments in call to i\.M|not enough arguments"
+       I.M()    // ERROR "not enough arguments in call to method expression I\.M|not enough arguments"
+       t.M()    // ERROR "not enough arguments in call to t\.M|not enough arguments"
+       T.M()    // ERROR "not enough arguments in call to method expression T\.M|not enough arguments"
+       (*T).M() // ERROR "not enough arguments in call to method expression \(\*T\)\.M|not enough arguments"
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue8438.go b/gcc/testsuite/go.test/test/fixedbugs/issue8438.go
new file mode 100644 (file)
index 0000000..f433e36
--- /dev/null
@@ -0,0 +1,17 @@
+// errorcheck
+
+// Copyright 2017 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 we don't print duplicate errors for string ->
+// array-literal conversion
+
+package main
+
+func main() {
+       _ = []byte{"foo"}   // ERROR "cannot use|incompatible type"
+       _ = []int{"foo"}    // ERROR "cannot use|incompatible type"
+       _ = []rune{"foo"}   // ERROR "cannot use|incompatible type"
+       _ = []string{"foo"} // OK
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue8440.go b/gcc/testsuite/go.test/test/fixedbugs/issue8440.go
new file mode 100644 (file)
index 0000000..e9c5b54
--- /dev/null
@@ -0,0 +1,11 @@
+// errorcheck
+
+// Copyright 2017 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() {
+       n.foo = 6 // ERROR "undefined: n in n.foo|undefined name .*n"
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue8475.go b/gcc/testsuite/go.test/test/fixedbugs/issue8475.go
new file mode 100644 (file)
index 0000000..5b22067
--- /dev/null
@@ -0,0 +1,25 @@
+// build
+
+// Copyright 2014 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 8745: comma-ok assignments should produce untyped bool as 2nd result.
+
+package main
+
+type mybool bool
+
+func main() {
+       var ok mybool
+       _ = ok
+
+       var i interface{}
+       _, ok = i.(int)
+
+       var m map[int]int
+       _, ok = m[0]
+
+       var c chan int
+       _, ok = <-c
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue8501.go b/gcc/testsuite/go.test/test/fixedbugs/issue8501.go
new file mode 100644 (file)
index 0000000..90ba096
--- /dev/null
@@ -0,0 +1,18 @@
+// errorcheck
+
+// Copyright 2014 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 T struct {
+       f float64
+}
+
+var t T
+
+func F() {
+       _ = complex(1.0) // ERROR "invalid operation|not enough arguments"
+       _ = complex(t.f) // ERROR "invalid operation|not enough arguments"
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue8613.go b/gcc/testsuite/go.test/test/fixedbugs/issue8613.go
new file mode 100644 (file)
index 0000000..ffa75a4
--- /dev/null
@@ -0,0 +1,38 @@
+// run
+
+// Copyright 2016 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 out int
+var zero int
+
+func main() {
+       wantPanic("test1", func() {
+               out = 1 / zero
+       })
+       wantPanic("test2", func() {
+               _ = 1 / zero
+       })
+       wantPanic("test3", func() {
+               v := 0
+               _ = 1 / v
+       })
+       wantPanic("test4", func() { divby(0) })
+}
+
+func wantPanic(test string, fn func()) {
+       defer func() {
+               if e := recover(); e == nil {
+                       panic(test + ": expected panic")
+               }
+       }()
+       fn()
+}
+
+//go:noinline
+func divby(v int) {
+       _ = 1 / v
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue8620.go b/gcc/testsuite/go.test/test/fixedbugs/issue8620.go
new file mode 100644 (file)
index 0000000..4754604
--- /dev/null
@@ -0,0 +1,30 @@
+// run
+
+// Copyright 2014 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 8620. Used to fail with -race.
+
+package main
+
+func min(a, b int) int {
+       if a < b {
+               return a
+       }
+       return b
+}
+
+func test(s1, s2 []struct{}) {
+       n := min(len(s1), len(s2))
+       if copy(s1, s2) != n {
+               panic("bad copy result")
+       }
+}
+
+func main() {
+       var b [100]struct{}
+       test(b[:], b[:])
+       test(b[1:], b[:])
+       test(b[:], b[2:])
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue8745.go b/gcc/testsuite/go.test/test/fixedbugs/issue8745.go
new file mode 100644 (file)
index 0000000..fee2ca7
--- /dev/null
@@ -0,0 +1,13 @@
+// errorcheck
+
+// Copyright 2015 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 the error says s[2] is a byte, not a uint8.
+
+package p
+
+func f(s string) {
+       var _ float64 = s[2] // ERROR "cannot use.*type byte.*as type float64"
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue8761.go b/gcc/testsuite/go.test/test/fixedbugs/issue8761.go
new file mode 100644 (file)
index 0000000..7f458f7
--- /dev/null
@@ -0,0 +1,26 @@
+// compile
+
+// Copyright 2014 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 8761
+// used to confuse code generator into using temporary before initialization.
+// caused 'variable live at entry' error in liveness analysis.
+
+package p
+
+func _() {
+       type C chan int
+       _ = [1][]C{[]C{make(chan int)}}
+}
+
+func _() {
+       type C interface{}
+       _ = [1][]C{[]C{recover()}}
+}
+
+func _() {
+       type C *int
+       _ = [1][]C{[]C{new(int)}}
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue8836.go b/gcc/testsuite/go.test/test/fixedbugs/issue8836.go
new file mode 100644 (file)
index 0000000..039b9c7
--- /dev/null
@@ -0,0 +1,24 @@
+// errorcheck
+
+// Copyright 2015 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.
+
+// Checking that line number is correct in error message.
+
+package main
+
+type Cint int
+
+func foobar(*Cint, Cint, Cint, *Cint)
+
+func main() {
+       a := Cint(1)
+
+       foobar(
+               &a,
+               0,
+               0,
+               42, // ERROR ".*"
+       )
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue8947.go b/gcc/testsuite/go.test/test/fixedbugs/issue8947.go
new file mode 100644 (file)
index 0000000..703207d
--- /dev/null
@@ -0,0 +1,53 @@
+// run
+
+// Copyright 2014 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.
+
+// Some uses of zeroed constants in non-assignment
+// expressions broke with our more aggressive zeroing
+// of assignments (internal compiler errors).
+
+package main
+
+func f1() {
+       type T [2]int
+       p := T{0, 1}
+       switch p {
+       case T{0, 0}:
+               panic("wrong1")
+       case T{0, 1}:
+               // ok
+       default:
+               panic("wrong2")
+       }
+
+       if p == (T{0, 0}) {
+               panic("wrong3")
+       } else if p == (T{0, 1}) {
+               // ok
+       } else {
+               panic("wrong4")
+       }
+}
+
+type T struct {
+       V int
+}
+
+var X = T{}.V
+
+func f2() {
+       var x = T{}.V
+       if x != 0 {
+               panic("wrongx")
+       }
+       if X != 0 {
+               panic("wrongX")
+       }
+}
+
+func main() {
+       f1()
+       f2()
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue8961.go b/gcc/testsuite/go.test/test/fixedbugs/issue8961.go
new file mode 100644 (file)
index 0000000..22b0f04
--- /dev/null
@@ -0,0 +1,20 @@
+// run
+
+// Copyright 2014 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 8961. Empty composite literals to small globals were not filled in
+package main
+
+type small struct { a int }
+var foo small
+
+func main() {
+       foo.a = 1
+       foo = small{}
+       if foo.a != 0 {
+               println("expected foo.a to be 0, was", foo.a)
+               panic("composite literal not filled in")
+       }
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue9006.go b/gcc/testsuite/go.test/test/fixedbugs/issue9006.go
new file mode 100644 (file)
index 0000000..a61574b
--- /dev/null
@@ -0,0 +1,37 @@
+// run
+
+// Copyright 2014 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 {
+       X int
+}
+
+func NewT1(x int) T1 { return T1{x} }
+
+type T2 int
+
+func NewT2(x int) T2 { return T2(x) }
+
+func main() {
+       switch (T1{}) {
+       case NewT1(1):
+               panic("bad1")
+       case NewT1(0):
+               // ok
+       default:
+               panic("bad2")
+       }
+
+       switch T2(0) {
+       case NewT2(2):
+               panic("bad3")
+       case NewT2(0):
+               // ok
+       default:
+               panic("bad4")
+       }
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue9017.go b/gcc/testsuite/go.test/test/fixedbugs/issue9017.go
new file mode 100644 (file)
index 0000000..5659785
--- /dev/null
@@ -0,0 +1,57 @@
+// errorcheck
+
+// Copyright 2014 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 9017: Method selector shouldn't automatically dereference a named pointer type.
+
+package main
+
+type T struct{ x int }
+
+func (T) mT() {}
+
+type S struct {
+       T
+}
+
+func (S) mS() {}
+
+type P *S
+
+type I interface {
+       mT()
+}
+
+func main() {
+       var s S
+       s.T.mT()
+       s.mT() // == s.T.mT()
+
+       var i I
+       _ = i
+       i = s.T
+       i = s
+
+       var ps = &s
+       ps.mS()
+       ps.T.mT()
+       ps.mT() // == ps.T.mT()
+
+       i = ps.T
+       i = ps
+
+       var p P = ps
+       (*p).mS()
+       p.mS() // ERROR "undefined"
+
+       i = *p
+       i = p // ERROR "cannot use|incompatible types"
+
+       p.T.mT()
+       p.mT() // ERROR "undefined"
+
+       i = p.T
+       i = p // ERROR "cannot use|incompatible types"
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue9036.go b/gcc/testsuite/go.test/test/fixedbugs/issue9036.go
new file mode 100644 (file)
index 0000000..e3d394f
--- /dev/null
@@ -0,0 +1,31 @@
+// errorcheck
+
+// Copyright 2015 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.
+
+// Expects to see error messages on 'p' exponents
+// for non-hexadecimal floats.
+
+package main
+
+import "fmt"
+
+const (
+       x1 = 1.1    // float
+       x2 = 1e10   // float
+       x3 = 0x1e10 // integer (e is a hex digit)
+)
+
+const x4 = 0x1p10 // valid hexadecimal float
+const x5 = 1p10   // ERROR "'p' exponent requires hexadecimal mantissa|invalid prefix"
+const x6 = 0P0    // ERROR "'P' exponent requires hexadecimal mantissa|invalid prefix"
+
+func main() {
+       fmt.Printf("%g %T\n", x1, x1)
+       fmt.Printf("%g %T\n", x2, x2)
+       fmt.Printf("%g %T\n", x3, x3)
+       fmt.Printf("%g %T\n", x4, x4)
+       fmt.Printf("%g %T\n", x5, x5)
+       fmt.Printf("%g %T\n", x6, x6)
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue9076.go b/gcc/testsuite/go.test/test/fixedbugs/issue9076.go
new file mode 100644 (file)
index 0000000..1613d5e
--- /dev/null
@@ -0,0 +1,15 @@
+// errorcheck
+
+// Copyright 2014 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 9076: cmd/gc shows computed values in error messages instead of original expression.
+
+package main
+
+import "unsafe"
+
+const Hundred = 100
+var _ int32 = 100/unsafe.Sizeof(int(0)) + 1 // ERROR "100 \/ unsafe.Sizeof\(int\(0\)\) \+ 1|incompatible type"
+var _ int32 = Hundred/unsafe.Sizeof(int(0)) + 1 // ERROR "Hundred \/ unsafe.Sizeof\(int\(0\)\) \+ 1|incompatible type"
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue9083.go b/gcc/testsuite/go.test/test/fixedbugs/issue9083.go
new file mode 100644 (file)
index 0000000..d4762f8
--- /dev/null
@@ -0,0 +1,23 @@
+// errorcheck
+
+// Copyright 2014 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 9083: map/chan error messages show non-explicit capacity.
+
+package main
+
+// untyped constant
+const zero = 0
+
+func main() {
+       var x int
+       x = make(map[int]int) // ERROR "cannot use make\(map\[int\]int\)|incompatible"
+       x = make(map[int]int, 0) // ERROR "cannot use make\(map\[int\]int, 0\)|incompatible"
+       x = make(map[int]int, zero) // ERROR "cannot use make\(map\[int\]int, zero\)|incompatible"
+       x = make(chan int) // ERROR "cannot use make\(chan int\)|incompatible"
+       x = make(chan int, 0) // ERROR "cannot use make\(chan int, 0\)|incompatible"
+       x = make(chan int, zero) // ERROR "cannot use make\(chan int, zero\)|incompatible"
+       _ = x
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue9110.go b/gcc/testsuite/go.test/test/fixedbugs/issue9110.go
new file mode 100644 (file)
index 0000000..086be77
--- /dev/null
@@ -0,0 +1,91 @@
+// run
+
+// Copyright 2014 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.
+
+// Scenario that used to leak arbitrarily many SudoG structs.
+// See golang.org/issue/9110.
+
+package main
+
+import (
+       "runtime"
+       "runtime/debug"
+       "sync"
+       "time"
+)
+
+func main() {
+       runtime.GOMAXPROCS(1)
+       debug.SetGCPercent(1000000) // only GC when we ask for GC
+
+       var stats, stats1, stats2 runtime.MemStats
+
+       release := func() {}
+       for i := 0; i < 20; i++ {
+               if i == 10 {
+                       // Should be warmed up by now.
+                       runtime.ReadMemStats(&stats1)
+               }
+
+               c := make(chan int)
+               for i := 0; i < 10; i++ {
+                       go func() {
+                               select {
+                               case <-c:
+                               case <-c:
+                               case <-c:
+                               }
+                       }()
+               }
+               time.Sleep(1 * time.Millisecond)
+               release()
+
+               close(c) // let select put its sudog's into the cache
+               time.Sleep(1 * time.Millisecond)
+
+               // pick up top sudog
+               var cond1 sync.Cond
+               var mu1 sync.Mutex
+               cond1.L = &mu1
+               go func() {
+                       mu1.Lock()
+                       cond1.Wait()
+                       mu1.Unlock()
+               }()
+               time.Sleep(1 * time.Millisecond)
+
+               // pick up next sudog
+               var cond2 sync.Cond
+               var mu2 sync.Mutex
+               cond2.L = &mu2
+               go func() {
+                       mu2.Lock()
+                       cond2.Wait()
+                       mu2.Unlock()
+               }()
+               time.Sleep(1 * time.Millisecond)
+
+               // put top sudog back
+               cond1.Broadcast()
+               time.Sleep(1 * time.Millisecond)
+
+               // drop cache on floor
+               runtime.GC()
+
+               // release cond2 after select has gotten to run
+               release = func() {
+                       cond2.Broadcast()
+                       time.Sleep(1 * time.Millisecond)
+               }
+       }
+
+       runtime.GC()
+
+       runtime.ReadMemStats(&stats2)
+
+       if int(stats2.HeapObjects)-int(stats1.HeapObjects) > 20 { // normally at most 1 or 2; was 300 with leak
+               print("BUG: object leak: ", stats.HeapObjects, " -> ", stats1.HeapObjects, " -> ", stats2.HeapObjects, "\n")
+       }
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue9321.go b/gcc/testsuite/go.test/test/fixedbugs/issue9321.go
new file mode 100644 (file)
index 0000000..2b2807a
--- /dev/null
@@ -0,0 +1,37 @@
+// run
+
+// Copyright 2014 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 (
+       "bytes"
+       "runtime"
+       "runtime/pprof"
+       "sync"
+)
+
+func test() {
+       var wg sync.WaitGroup
+       wg.Add(2)
+       test := func() {
+               for i := 0; i < 10; i++ {
+                       buf := &bytes.Buffer{}
+                       pprof.Lookup("goroutine").WriteTo(buf, 2)
+               }
+               wg.Done()
+       }
+
+       go test()
+       go test()
+       wg.Wait()
+}
+
+func main() {
+       runtime.GOMAXPROCS(4)
+       for i := 0; i < 10; i++ {
+               test()
+       }
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue9355.dir/a.go b/gcc/testsuite/go.test/test/fixedbugs/issue9355.dir/a.go
new file mode 100644 (file)
index 0000000..84500c8
--- /dev/null
@@ -0,0 +1,16 @@
+package main
+
+var x struct {
+       a, b, c int64
+       d       struct{ p, q, r int32 }
+       e       [8]byte
+       f       [4]struct{ p, q, r int32 }
+}
+
+var y = &x.b
+var z = &x.d.q
+
+var b [10]byte
+var c = &b[5]
+
+var w = &x.f[3].r
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue9355.go b/gcc/testsuite/go.test/test/fixedbugs/issue9355.go
new file mode 100644 (file)
index 0000000..ab3369d
--- /dev/null
@@ -0,0 +1,67 @@
+// run
+
+// Copyright 2014 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"
+       "io/ioutil"
+       "os"
+       "os/exec"
+       "path/filepath"
+       "regexp"
+       "runtime"
+)
+
+func main() {
+       if runtime.Compiler != "gc" || runtime.GOOS == "js" {
+               return
+       }
+
+       err := os.Chdir(filepath.Join("fixedbugs", "issue9355.dir"))
+       check(err)
+
+       f, err := ioutil.TempFile("", "issue9355-*.o")
+       if err != nil {
+               fmt.Println(err)
+               os.Exit(1)
+       }
+       f.Close()
+
+       out := run("go", "tool", "compile", "-o", f.Name(), "-S", "a.go")
+       os.Remove(f.Name())
+
+       // 6g/8g print the offset as dec, but 5g/9g print the offset as hex.
+       patterns := []string{
+               `rel 0\+\d t=1 \"\"\.x\+8\r?\n`,       // y = &x.b
+               `rel 0\+\d t=1 \"\"\.x\+(28|1c)\r?\n`, // z = &x.d.q
+               `rel 0\+\d t=1 \"\"\.b\+5\r?\n`,       // c = &b[5]
+               `rel 0\+\d t=1 \"\"\.x\+(88|58)\r?\n`, // w = &x.f[3].r
+       }
+       for _, p := range patterns {
+               if ok, err := regexp.Match(p, out); !ok || err != nil {
+                       println(string(out))
+                       panic("can't find pattern " + p)
+               }
+       }
+}
+
+func run(cmd string, args ...string) []byte {
+       out, err := exec.Command(cmd, args...).CombinedOutput()
+       if err != nil {
+               fmt.Println(string(out))
+               fmt.Println(err)
+               os.Exit(1)
+       }
+       return out
+}
+
+func check(err error) {
+       if err != nil {
+               fmt.Println("BUG:", err)
+               os.Exit(1)
+       }
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue9370.go b/gcc/testsuite/go.test/test/fixedbugs/issue9370.go
new file mode 100644 (file)
index 0000000..6cc8d5b
--- /dev/null
@@ -0,0 +1,127 @@
+// errorcheck
+
+// Copyright 2014 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.
+
+// Verify that concrete/interface comparisons are
+// typechecked correctly by the compiler.
+
+package main
+
+type I interface {
+       Method()
+}
+
+type C int
+
+func (C) Method() {}
+
+type G func()
+
+func (G) Method() {}
+
+var (
+       e interface{}
+       i I
+       c C
+       n int
+       f func()
+       g G
+)
+
+var (
+       _ = e == c
+       _ = e != c
+       _ = e >= c // ERROR "invalid operation.*not defined|invalid comparison"
+       _ = c == e
+       _ = c != e
+       _ = c >= e // ERROR "invalid operation.*not defined|invalid comparison"
+
+       _ = i == c
+       _ = i != c
+       _ = i >= c // ERROR "invalid operation.*not defined|invalid comparison"
+       _ = c == i
+       _ = c != i
+       _ = c >= i // ERROR "invalid operation.*not defined|invalid comparison"
+
+       _ = e == n
+       _ = e != n
+       _ = e >= n // ERROR "invalid operation.*not defined|invalid comparison"
+       _ = n == e
+       _ = n != e
+       _ = n >= e // ERROR "invalid operation.*not defined|invalid comparison"
+
+       // i and n are not assignable to each other
+       _ = i == n // ERROR "invalid operation.*mismatched types|incompatible types"
+       _ = i != n // ERROR "invalid operation.*mismatched types|incompatible types"
+       _ = i >= n // ERROR "invalid operation.*mismatched types|incompatible types"
+       _ = n == i // ERROR "invalid operation.*mismatched types|incompatible types"
+       _ = n != i // ERROR "invalid operation.*mismatched types|incompatible types"
+       _ = n >= i // ERROR "invalid operation.*mismatched types|incompatible types"
+
+       _ = e == 1
+       _ = e != 1
+       _ = e >= 1 // ERROR "invalid operation.*not defined|invalid comparison"
+       _ = 1 == e
+       _ = 1 != e
+       _ = 1 >= e // ERROR "invalid operation.*not defined|invalid comparison"
+
+       _ = i == 1 // ERROR "invalid operation.*mismatched types|incompatible types"
+       _ = i != 1 // ERROR "invalid operation.*mismatched types|incompatible types"
+       _ = i >= 1 // ERROR "invalid operation.*mismatched types|incompatible types"
+       _ = 1 == i // ERROR "invalid operation.*mismatched types|incompatible types"
+       _ = 1 != i // ERROR "invalid operation.*mismatched types|incompatible types"
+       _ = 1 >= i // ERROR "invalid operation.*mismatched types|incompatible types"
+
+       _ = e == f // ERROR "invalid operation.*not defined|invalid operation"
+       _ = e != f // ERROR "invalid operation.*not defined|invalid operation"
+       _ = e >= f // ERROR "invalid operation.*not defined|invalid comparison"
+       _ = f == e // ERROR "invalid operation.*not defined|invalid operation"
+       _ = f != e // ERROR "invalid operation.*not defined|invalid operation"
+       _ = f >= e // ERROR "invalid operation.*not defined|invalid comparison"
+
+       _ = i == f // ERROR "invalid operation.*mismatched types|incompatible types"
+       _ = i != f // ERROR "invalid operation.*mismatched types|incompatible types"
+       _ = i >= f // ERROR "invalid operation.*mismatched types|incompatible types"
+       _ = f == i // ERROR "invalid operation.*mismatched types|incompatible types"
+       _ = f != i // ERROR "invalid operation.*mismatched types|incompatible types"
+       _ = f >= i // ERROR "invalid operation.*mismatched types|incompatible types"
+
+       _ = e == g // ERROR "invalid operation.*not defined|invalid operation"
+       _ = e != g // ERROR "invalid operation.*not defined|invalid operation"
+       _ = e >= g // ERROR "invalid operation.*not defined|invalid comparison"
+       _ = g == e // ERROR "invalid operation.*not defined|invalid operation"
+       _ = g != e // ERROR "invalid operation.*not defined|invalid operation"
+       _ = g >= e // ERROR "invalid operation.*not defined|invalid comparison"
+
+       _ = i == g // ERROR "invalid operation.*not defined|invalid operation"
+       _ = i != g // ERROR "invalid operation.*not defined|invalid operation"
+       _ = i >= g // ERROR "invalid operation.*not defined|invalid comparison"
+       _ = g == i // ERROR "invalid operation.*not defined|invalid operation"
+       _ = g != i // ERROR "invalid operation.*not defined|invalid operation"
+       _ = g >= i // ERROR "invalid operation.*not defined|invalid comparison"
+
+       _ = _ == e // ERROR "cannot use .*_.* as value"
+       _ = _ == i // ERROR "cannot use .*_.* as value"
+       _ = _ == c // ERROR "cannot use .*_.* as value"
+       _ = _ == n // ERROR "cannot use .*_.* as value"
+       _ = _ == f // ERROR "cannot use .*_.* as value"
+       _ = _ == g // ERROR "cannot use .*_.* as value"
+
+       _ = e == _ // ERROR "cannot use .*_.* as value"
+       _ = i == _ // ERROR "cannot use .*_.* as value"
+       _ = c == _ // ERROR "cannot use .*_.* as value"
+       _ = n == _ // ERROR "cannot use .*_.* as value"
+       _ = f == _ // ERROR "cannot use .*_.* as value"
+       _ = g == _ // ERROR "cannot use .*_.* as value"
+
+       _ = _ == _ // ERROR "cannot use .*_.* as value"
+
+       _ = e ^ c // ERROR "invalid operation.*mismatched types|incompatible types"
+       _ = c ^ e // ERROR "invalid operation.*mismatched types|incompatible types"
+       _ = 1 ^ e // ERROR "invalid operation.*mismatched types|incompatible types"
+       _ = e ^ 1 // ERROR "invalid operation.*mismatched types|incompatible types"
+       _ = 1 ^ c
+       _ = c ^ 1
+)
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue9432.go b/gcc/testsuite/go.test/test/fixedbugs/issue9432.go
new file mode 100644 (file)
index 0000000..e8946a5
--- /dev/null
@@ -0,0 +1,15 @@
+// errorcheck
+
+// Copyright 2014 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.
+
+// gc used to recurse infinitely when dowidth is applied
+// to a broken recursive type again.
+// See golang.org/issue/9432.
+package p
+
+type foo struct { // ERROR "invalid recursive type"
+       bar  foo
+       blah foo
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue9521.go b/gcc/testsuite/go.test/test/fixedbugs/issue9521.go
new file mode 100644 (file)
index 0000000..1ad40bd
--- /dev/null
@@ -0,0 +1,18 @@
+// errorcheck
+
+// Copyright 2015 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.
+
+// Test that an incorrect use of the blank identifier is caught.
+// Does not compile.
+
+package main
+
+func f() (_, _ []int)         { return }
+func g() (x []int, y float64) { return }
+
+func main() {
+       _ = append(f()) // ERROR "cannot use \[\]int value as type int in append|incompatible type"
+       _ = append(g()) // ERROR "cannot use float64 value as type int in append|incompatible type"
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue9537.dir/a.go b/gcc/testsuite/go.test/test/fixedbugs/issue9537.dir/a.go
new file mode 100644 (file)
index 0000000..818c9eb
--- /dev/null
@@ -0,0 +1,25 @@
+// Copyright 2015 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
+
+type X struct {
+       T [32]byte
+}
+
+func (x *X) Get() []byte {
+       t := x.T
+       return t[:]
+}
+
+func (x *X) RetPtr(i int) *int {
+       i++
+       return &i
+}
+
+func (x *X) RetRPtr(i int) (r1 int, r2 *int) {
+       r1 = i + 1
+       r2 = &r1
+       return
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue9537.dir/b.go b/gcc/testsuite/go.test/test/fixedbugs/issue9537.dir/b.go
new file mode 100644 (file)
index 0000000..52e64c8
--- /dev/null
@@ -0,0 +1,43 @@
+// Copyright 2015 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 (
+       "bytes"
+
+       "./a"
+)
+
+type X struct {
+       *a.X
+}
+
+type Intf interface {
+       Get()        []byte
+       RetPtr(int)  *int
+       RetRPtr(int) (int, *int)
+}
+
+func main() {
+       x := &a.X{T: [32]byte{1, 2, 3, 4}}
+       var ix Intf = X{x}
+       t1 := ix.Get()
+       t2 := x.Get()
+       if !bytes.Equal(t1, t2) {
+               panic(t1)
+       }
+
+       p1 := ix.RetPtr(5)
+       p2 := x.RetPtr(7)
+       if *p1 != 6 || *p2 != 8 {
+               panic(*p1)
+       }
+
+       r1, r2 := ix.RetRPtr(10)
+       r3, r4 := x.RetRPtr(13)
+       if r1 != 11 || *r2 != 11 || r3 != 14 || *r4 != 14 {
+               panic("bad RetRPtr")
+       }
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue9537.go b/gcc/testsuite/go.test/test/fixedbugs/issue9537.go
new file mode 100644 (file)
index 0000000..ac2d41b
--- /dev/null
@@ -0,0 +1,10 @@
+// rundir
+
+// Copyright 2015 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 9537: Compiler does not run escape analysis on an inlined
+// generated method wrapper.
+
+package ignored
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue9604.go b/gcc/testsuite/go.test/test/fixedbugs/issue9604.go
new file mode 100644 (file)
index 0000000..cd9e9e4
--- /dev/null
@@ -0,0 +1,29 @@
+// run
+
+// Copyright 2015 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 uint16 = 0xffff
+var y uint16 = 0xfffe
+var a uint16 = 0x7000
+var b uint16 = 0x9000
+
+func main() {
+       // Make sure we truncate to smaller-width types after evaluating expressions.
+       // This is a problem for arm where there is no 16-bit comparison op.
+       if ^x != 0 {
+               panic("^uint16(0xffff) != 0")
+       }
+       if ^y != 1 {
+               panic("^uint16(0xfffe) != 1")
+       }
+       if -x != 1 {
+               panic("-uint16(0xffff) != 1")
+       }
+       if a+b != 0 {
+               panic("0x7000+0x9000 != 0")
+       }
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue9604b.go b/gcc/testsuite/go.test/test/fixedbugs/issue9604b.go
new file mode 100644 (file)
index 0000000..d32116b
--- /dev/null
@@ -0,0 +1,180 @@
+// runoutput
+
+// Copyright 2015 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.
+
+// terribly slow on wasm
+// +build !wasm
+
+package main
+
+import (
+       "fmt"
+       "math/big"
+       "unsafe"
+)
+
+var one = big.NewInt(1)
+
+type _type struct {
+       name   string
+       bits   uint
+       signed bool
+}
+
+// testvalues returns a list of all test values for this type.
+func (t *_type) testvalues() []*big.Int {
+       var a []*big.Int
+
+       a = append(a, big.NewInt(0))
+       a = append(a, big.NewInt(1))
+       a = append(a, big.NewInt(2))
+       if t.signed {
+               a = append(a, big.NewInt(-1))
+               a = append(a, big.NewInt(-2))
+               r := big.NewInt(1)
+               a = append(a, r.Lsh(r, t.bits-1).Sub(r, big.NewInt(1)))
+               r = big.NewInt(1)
+               a = append(a, r.Lsh(r, t.bits-1).Sub(r, big.NewInt(2)))
+               r = big.NewInt(1)
+               a = append(a, r.Lsh(r, t.bits-1).Neg(r))
+               r = big.NewInt(1)
+               a = append(a, r.Lsh(r, t.bits-1).Neg(r).Add(r, big.NewInt(1)))
+       } else {
+               r := big.NewInt(1)
+               a = append(a, r.Lsh(r, t.bits).Sub(r, big.NewInt(1)))
+               r = big.NewInt(1)
+               a = append(a, r.Lsh(r, t.bits).Sub(r, big.NewInt(2)))
+       }
+       return a
+}
+
+// trunc truncates a value to the range of the given type.
+func (t *_type) trunc(x *big.Int) *big.Int {
+       r := new(big.Int)
+       m := new(big.Int)
+       m.Lsh(one, t.bits)
+       m.Sub(m, one)
+       r.And(x, m)
+       if t.signed && r.Bit(int(t.bits)-1) == 1 {
+               m.Neg(one)
+               m.Lsh(m, t.bits)
+               r.Or(r, m)
+       }
+       return r
+}
+
+var types = []_type{
+       _type{"byte", 8, false},
+       _type{"int8", 8, true},
+       _type{"uint8", 8, false},
+       _type{"rune", 32, true},
+       _type{"int16", 16, true},
+       _type{"uint16", 16, false},
+       _type{"int32", 32, true},
+       _type{"uint32", 32, false},
+       _type{"int64", 64, true},
+       _type{"uint64", 64, false},
+       _type{"int", 8 * uint(unsafe.Sizeof(int(0))), true},
+       _type{"uint", 8 * uint(unsafe.Sizeof(uint(0))), false},
+       _type{"uintptr", 8 * uint(unsafe.Sizeof((*byte)(nil))), false},
+}
+
+type binop struct {
+       name string
+       eval func(x, y *big.Int) *big.Int
+}
+
+var binops = []binop{
+       binop{"+", func(x, y *big.Int) *big.Int { return new(big.Int).Add(x, y) }},
+       binop{"-", func(x, y *big.Int) *big.Int { return new(big.Int).Sub(x, y) }},
+       binop{"*", func(x, y *big.Int) *big.Int { return new(big.Int).Mul(x, y) }},
+       binop{"/", func(x, y *big.Int) *big.Int { return new(big.Int).Quo(x, y) }},
+       binop{"%", func(x, y *big.Int) *big.Int { return new(big.Int).Rem(x, y) }},
+       binop{"&", func(x, y *big.Int) *big.Int { return new(big.Int).And(x, y) }},
+       binop{"|", func(x, y *big.Int) *big.Int { return new(big.Int).Or(x, y) }},
+       binop{"^", func(x, y *big.Int) *big.Int { return new(big.Int).Xor(x, y) }},
+       binop{"&^", func(x, y *big.Int) *big.Int { return new(big.Int).AndNot(x, y) }},
+}
+
+type unop struct {
+       name string
+       eval func(x *big.Int) *big.Int
+}
+
+var unops = []unop{
+       unop{"+", func(x *big.Int) *big.Int { return new(big.Int).Set(x) }},
+       unop{"-", func(x *big.Int) *big.Int { return new(big.Int).Neg(x) }},
+       unop{"^", func(x *big.Int) *big.Int { return new(big.Int).Not(x) }},
+}
+
+type shiftop struct {
+       name string
+       eval func(x *big.Int, i uint) *big.Int
+}
+
+var shiftops = []shiftop{
+       shiftop{"<<", func(x *big.Int, i uint) *big.Int { return new(big.Int).Lsh(x, i) }},
+       shiftop{">>", func(x *big.Int, i uint) *big.Int { return new(big.Int).Rsh(x, i) }},
+}
+
+// valname returns the name of n as can be used as part of a variable name.
+func valname(n *big.Int) string {
+       s := fmt.Sprintf("%d", n)
+       if s[0] == '-' {
+               s = "neg" + s[1:]
+       }
+       return s
+}
+
+func main() {
+       fmt.Println("package main")
+
+       // We make variables to hold all the different values we'd like to use.
+       // We use global variables to prevent any constant folding.
+       for _, t := range types {
+               for _, n := range t.testvalues() {
+                       fmt.Printf("var %s_%s %s = %d\n", t.name, valname(n), t.name, n)
+               }
+       }
+
+       fmt.Println("func main() {")
+
+       for _, t := range types {
+               // test binary ops
+               for _, op := range binops {
+                       for _, x := range t.testvalues() {
+                               for _, y := range t.testvalues() {
+                                       if (op.name == "/" || op.name == "%") && y.Sign() == 0 {
+                                               continue
+                                       }
+                                       r := t.trunc(op.eval(x, y))
+                                       eqn := fmt.Sprintf("%s_%s %s %s_%s != %d", t.name, valname(x), op.name, t.name, valname(y), r)
+                                       fmt.Printf("\tif %s { println(\"bad: %s\") }\n", eqn, eqn)
+                               }
+                       }
+               }
+               // test unary ops
+               for _, op := range unops {
+                       for _, x := range t.testvalues() {
+                               r := t.trunc(op.eval(x))
+                               eqn := fmt.Sprintf("%s %s_%s != %d", op.name, t.name, valname(x), r)
+                               fmt.Printf("\tif %s { println(\"bad: %s\") }\n", eqn, eqn)
+                       }
+               }
+               // test shifts
+               for _, op := range shiftops {
+                       for _, x := range t.testvalues() {
+
+                               for _, i := range []uint{0, 1, t.bits - 2, t.bits - 1, t.bits, t.bits + 1} {
+                                       r := t.trunc(op.eval(x, i))
+                                       eqn := fmt.Sprintf("%s_%s %s %d != %d", t.name, valname(x), op.name, i, r)
+                                       fmt.Printf("\tif %s { println(\"bad: %s\") }\n", eqn, eqn)
+                               }
+                       }
+               }
+       }
+
+       fmt.Println("}")
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue9608.dir/issue9608.go b/gcc/testsuite/go.test/test/fixedbugs/issue9608.dir/issue9608.go
new file mode 100644 (file)
index 0000000..ca82ded
--- /dev/null
@@ -0,0 +1,82 @@
+// Copyright 2015 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 fail() // unimplemented, to test dead code elimination
+
+// Test dead code elimination in if statements
+func init() {
+       if false {
+               fail()
+       }
+       if 0 == 1 {
+               fail()
+       }
+}
+
+// Test dead code elimination in ordinary switch statements
+func init() {
+       const x = 0
+       switch x {
+       case 1:
+               fail()
+       }
+
+       switch 1 {
+       case x:
+               fail()
+       }
+
+       switch {
+       case false:
+               fail()
+       }
+
+       const a = "a"
+       switch a {
+       case "b":
+               fail()
+       }
+
+       const snowman = '☃'
+       switch snowman {
+       case '☀':
+               fail()
+       }
+
+       const zero = float64(0.0)
+       const one = float64(1.0)
+       switch one {
+       case -1.0:
+               fail()
+       case zero:
+               fail()
+       }
+
+       switch 1.0i {
+       case 1:
+               fail()
+       case -1i:
+               fail()
+       }
+
+       const no = false
+       switch no {
+       case true:
+               fail()
+       }
+
+       // Test dead code elimination in large ranges.
+       switch 5 {
+       case 3, 4, 5, 6, 7:
+       case 0, 1, 2:
+               fail()
+       default:
+               fail()
+       }
+}
+
+func main() {
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue9608.go b/gcc/testsuite/go.test/test/fixedbugs/issue9608.go
new file mode 100644 (file)
index 0000000..92592d7
--- /dev/null
@@ -0,0 +1,14 @@
+// rundir
+
+// Copyright 2015 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 9608: dead code elimination in switch statements.
+
+// This has to be done as a package rather than as a file,
+// because run.go runs files with 'go run', which passes the
+// -complete flag to compiler, causing it to complain about
+// the intentionally unimplemented function fail.
+
+package ignored
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue9634.go b/gcc/testsuite/go.test/test/fixedbugs/issue9634.go
new file mode 100644 (file)
index 0000000..2d5aae4
--- /dev/null
@@ -0,0 +1,18 @@
+// errorcheck
+
+// Copyright 2015 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 9634: Structs are incorrectly unpacked when passed as an argument
+// to append.
+
+package main
+
+func main() {
+       s := struct{
+               t []int
+               u int
+       }{}
+       _ = append(s, 0) // ERROR "must be a slice|must be slice"
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue9691.go b/gcc/testsuite/go.test/test/fixedbugs/issue9691.go
new file mode 100644 (file)
index 0000000..39c3dfa
--- /dev/null
@@ -0,0 +1,21 @@
+// run
+
+// Copyright 2015 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() {
+       s := "foo"
+       b := []byte(s)
+       m := make(map[string]int)
+       // Test that map index can be used in range
+       // and that slicebytetostringtmp is not used in this context.
+       for m[string(b)] = range s {
+       }
+       b[0] = 'b'
+       if m["foo"] != 2 {
+               panic("bad")
+       }
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue9731.go b/gcc/testsuite/go.test/test/fixedbugs/issue9731.go
new file mode 100644 (file)
index 0000000..9237d65
--- /dev/null
@@ -0,0 +1,21 @@
+// compile
+
+// Copyright 2014 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
+
+func f(x interface{}) {
+       switch x := x.(type) {
+       case int:
+               func() {
+                       _ = x
+               }()
+       case map[int]int:
+               func() {
+                       for range x {
+                       }
+               }()
+       }
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue9738.go b/gcc/testsuite/go.test/test/fixedbugs/issue9738.go
new file mode 100644 (file)
index 0000000..85319d7
--- /dev/null
@@ -0,0 +1,20 @@
+// run
+
+// Copyright 2015 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 F() (x int) {
+       defer func() {
+               if x != 42 {
+                       println("BUG: x =", x)
+               }
+       }()
+       return 42
+}
+
+func main() {
+       F()
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue9862.go b/gcc/testsuite/go.test/test/fixedbugs/issue9862.go
new file mode 100644 (file)
index 0000000..3572512
--- /dev/null
@@ -0,0 +1,15 @@
+// skip
+
+// Copyright 2015 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 a [1<<31 - 1024]byte
+
+func main() {
+       if a[0] != 0 {
+               panic("bad array")
+       }
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue9862_run.go b/gcc/testsuite/go.test/test/fixedbugs/issue9862_run.go
new file mode 100644 (file)
index 0000000..299e809
--- /dev/null
@@ -0,0 +1,27 @@
+// +build !nacl,!js
+// run
+
+// Copyright 2015 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 for compile or link error.
+
+package main
+
+import (
+       "os/exec"
+       "strings"
+)
+
+func main() {
+       out, err := exec.Command("go", "run", "fixedbugs/issue9862.go").CombinedOutput()
+       outstr := string(out)
+       if err == nil {
+               println("go run issue9862.go succeeded, should have failed\n", outstr)
+               return
+       }
+       if !strings.Contains(outstr, "symbol too large") {
+               println("go run issue9862.go gave unexpected error; want symbol too large:\n", outstr)
+       }
+}