mewmew / uc

A compiler for the µC language.
57 stars 5 forks source link

parser: Crash while parsing testdata/quiet/lexer/l03.c #34

Closed mewmew closed 8 years ago

mewmew commented 8 years ago
u@x1 ~/D/g/s/g/m/uc> uparse testdata/quiet/lexer/l03.c
Parsing "testdata/quiet/lexer/l03.c"

…

S39 ident(4,i) reduce:21(Locals : empty <<  >>)
S63 ident(4,i) reduce:22(Locals : VarDecl ";" Locals    <<  >>)
S38 ident(4,i) shift:42
pos: 30
typ: 20
lit: =

S42 =(20,=) reduce:58(Expr15 : ident    << astx.NewIdent(X[0]) >>)
S61 =(20,=) reduce:54(Expr14 : Expr15   <<  >>)
S60 =(20,=) reduce:51(Expr13L : Expr14  <<  >>)
S58 =(20,=) reduce:48(Expr12L : Expr13L <<  >>)
S57 =(20,=) reduce:43(Expr10L : Expr12L <<  >>)
S56 =(20,=) reduce:40(Expr9L : Expr10L  <<  >>)
S55 =(20,=) reduce:38(Expr5L : Expr9L   <<  >>)
S54 =(20,=) reduce:36(Expr2R : Expr5L   <<  >>)
S53 =(20,=) shift:91
pos: 32
typ: 8
lit: 123456789

S91 int_lit(8,123456789) shift:44
pos: 41
typ: 3
lit: ;

S44 ;(3,;) reduce:57(Expr15 : int_lit   << astx.NewBasicLit(X[1], token.IntLit) >>)
panic: runtime error: index out of range

goroutine 1 [running]:
panic(0x4eab00, 0xc8200100c0)
    /home/u/go/src/runtime/panic.go:500 +0x18a
github.com/mewmew/uc/gocc/parser.glob.func58(0xc820060120, 0x1, 0x5a, 0xc820081c50, 0x1, 0x52, 0x0)
    /home/u/Desktop/go/src/github.com/mewmew/uc/gocc/parser/productionstable.go:604 +0x74
github.com/mewmew/uc/gocc/parser.(*Parser).Parse(0xc820081ea0, 0x582240, 0xc8200862f0, 0xc820060080, 0x0, 0x64, 0x1)
    /home/u/Desktop/go/src/github.com/mewmew/uc/gocc/parser/parser.go:204 +0x88e
main.parseFile(0x7ffec6002b0e, 0x1a, 0x0, 0x0)
    /home/u/Desktop/go/src/github.com/mewmew/uc/cmd/uparse/uparse.go:69 +0x430
main.main()
    /home/u/Desktop/go/src/github.com/mewmew/uc/cmd/uparse/uparse.go:42 +0x80
u@x1 ~/D/g/s/g/m/uc>