-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Main return 0 #189
Main return 0 #189
Conversation
cl/compile.go
Outdated
@@ -246,10 +250,13 @@ func (p *context) compileFuncDecl(pkg llssa.Package, f *ssa.Function) (llssa.Fun | |||
argc := types.NewParam(token.NoPos, pkgTypes, "", types.Typ[types.Int32]) | |||
argv := types.NewParam(token.NoPos, pkgTypes, "", argvTy) | |||
params := types.NewTuple(argc, argv) | |||
sig = types.NewSignatureType(nil, nil, nil, params, nil, false) | |||
ret := types.NewParam(token.NoPos, pkgTypes, "", types.Typ[types.Int]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
main func return c int, not go int.
cl/compile.go
Outdated
@@ -779,6 +786,10 @@ func (p *context) compileInstr(b llssa.Builder, instr ssa.Instruction) { | |||
results[i] = p.compileValue(b, r) | |||
} | |||
} | |||
if p.inMain(instr) { | |||
results = make([]llssa.Expr, 1) | |||
results[0] = p.prog.IntVal(0, p.prog.Int()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use prog.CInt() instead of prog.Int()
cl/compile.go
Outdated
@@ -237,7 +241,7 @@ func (p *context) compileFuncDecl(pkg llssa.Package, f *ssa.Function) (llssa.Fun | |||
ctx := makeClosureCtx(pkgTypes, f.FreeVars) | |||
sig = llssa.FuncAddCtx(ctx, sig) | |||
} else { | |||
if debugInstr { | |||
if debugInstr && sig != nil && sig.Recv() != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why change this?
[Git-flow] Hi @tsingbx, There are some suggestions for your information: Rebase suggestions
Which seems insignificant, recommend to use For other If you have any questions about this comment, feel free to raise an issue here: |
No description provided.