Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(243)

Side by Side Diff: test/fixedbugs/issue4518.go

Issue 6932045: code review 6932045: cmd/6g: fix componentgen for funarg structs. (Closed)
Patch Set: diff -r c2a84616b24e https://go.googlecode.com/hg/ Created 11 years, 3 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/cmd/6g/cgen.c ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // run
2
3 // Copyright 2012 The Go Authors. All rights reserved.
4 // Use of this source code is governed by a BSD-style
5 // license that can be found in the LICENSE file.
6
7 // Issue 4518. In some circumstances "return F(...)"
8 // where F has multiple returns is miscompiled by 6g due to
9 // bold assumptions in componentgen.
10
11 package main
12
13 func DontInline() {}
14
15 func F(e interface{}) (int, int) {
16 DontInline()
17 return 3, 7
18 }
19
20 func G() (int, int) {
21 DontInline()
22 return 3, 7
23 }
24
25 func bogus1(d interface{}) (int, int) {
26 switch {
27 default:
28 return F(d)
29 }
30 return 0, 0
31 }
32
33 func bogus2() (int, int) {
34 switch {
35 default:
36 return F(3)
37 }
38 return 0, 0
39 }
40
41 func bogus3(d interface{}) (int, int) {
42 switch {
43 default:
44 return G()
45 }
46 return 0, 0
47 }
48
49 func bogus4() (int, int) {
50 switch {
51 default:
52 return G()
53 }
54 return 0, 0
55 }
56
57 func check(a, b int) {
58 if a != 3 || b != 7 {
59 println(a, b)
60 panic("a != 3 || b != 7")
61 }
62 }
63
64 func main() {
65 check(bogus1(42))
66 check(bogus2())
67 }
OLDNEW
« no previous file with comments | « src/cmd/6g/cgen.c ('k') | no next file » | no next file with comments »

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b