~john-koepi/ubuntu/trusty/golang/default

« back to all changes in this revision

Viewing changes to test/fixedbugs/bug093.go

  • Committer: Bazaar Package Importer
  • Author(s): Ondřej Surý
  • Date: 2011-04-20 17:36:48 UTC
  • Revision ID: james.westby@ubuntu.com-20110420173648-ifergoxyrm832trd
Tags: upstream-2011.03.07.1
Import upstream version 2011.03.07.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// $G $D/$F.go && $L $F.$A && ./$A.out || echo BUG: fails incorrectly
 
2
 
 
3
// Copyright 2009 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
package main
 
8
 
 
9
type S struct {
 
10
}
 
11
 
 
12
func (p *S) M() {
 
13
        print("M\n");
 
14
}
 
15
 
 
16
type I interface {
 
17
        M();
 
18
}
 
19
 
 
20
func main() {
 
21
        var p *S = nil;
 
22
        var i I = p;  // this should be possible even though p is nil: we still know the type
 
23
        i.M();  // should be possible since we know the type, and don't ever use the receiver
 
24
}
 
25
 
 
26
 
 
27
/*
 
28
throw: ifaces2i: nil pointer
 
29
SIGSEGV: segmentation violation
 
30
Faulting address: 0x0
 
31
pc: 0x1b7d
 
32
 
 
33
0x1b7d?zi
 
34
        throw(30409, 0, 0, ...)
 
35
        throw(0x76c9, 0x0, 0x0, ...)
 
36
0x207f?zi
 
37
        sys·ifaces2i(31440, 0, 31480, ...)
 
38
        sys·ifaces2i(0x7ad0, 0x7af8, 0x0, ...)
 
39
0x136f?zi
 
40
        main·main(1, 0, 1606416424, ...)
 
41
        main·main(0x1, 0x7fff5fbff828, 0x0, ...)
 
42
 
 
43
rax     0x1
 
44
rbx     0x1
 
45
rcx     0x33b5
 
46
rdx     0x0
 
47
rdi     0x1
 
48
rsi     0x7684
 
49
rbp     0x7684
 
50
rsp     0xafb8
 
51
r8      0x0
 
52
r9      0x0
 
53
r10     0x1002
 
54
r11     0x206
 
55
r12     0x0
 
56
r13     0x0
 
57
r14     0x7c48
 
58
r15     0xa000
 
59
rip     0x1b7d
 
60
rflags  0x10202
 
61
cs      0x27
 
62
fs      0x10
 
63
gs      0x48
 
64
*/