summaryrefslogtreecommitdiff
path: root/appl/cmd/limbo/com.b
diff options
context:
space:
mode:
Diffstat (limited to 'appl/cmd/limbo/com.b')
-rw-r--r--appl/cmd/limbo/com.b8
1 files changed, 6 insertions, 2 deletions
diff --git a/appl/cmd/limbo/com.b b/appl/cmd/limbo/com.b
index c14cd923..320d209c 100644
--- a/appl/cmd/limbo/com.b
+++ b/appl/cmd/limbo/com.b
@@ -388,10 +388,14 @@ fncom(decl: ref Decl)
scom(n.left);
}
pushblock();
- in := genrawop(src, IRET, nil, nil, nil);
+ valued := decl.ty.tof != tnone;
+ if(valued)
+ in := genrawop(src, IRAISE, nil, nil, nil);
+ else
+ in = genrawop(src, IRET, nil, nil, nil);
popblock();
reach(decl.pc);
- if(in.reach != byte 0 && decl.ty.tof != tnone)
+ if(valued && in.reach != byte 0)
error(src.start, "no return at end of function " + dotconv(decl));
# decl.endpc = lastinst;
if(labdep != 0)