Fix C goto generation for while without continue.

This commit is contained in:
Nigel Tao committed 2017-06-10 14:58:47 +10:00
1 parent 98a07921b1
commit 8e279c51bf
3 files changed
+9 -3

No files matched your search

+4 -1
View File
@@ -759,7 +759,10 @@ func (g *gen) writeStatement(n *a.Node, depth uint32) error {
case a.KJump:
n := n.Jump()
jt := g.perFunc.jumpTargets[n.JumpTarget()]
jt, err := g.jumpTarget(n.JumpTarget())
if err != nil {
return err
}
keyword := "continue"
if n.Keyword().Key() == t.KeyBreak {
keyword = "break"
+3 -1
View File
@@ -269,13 +269,15 @@ label_0_continue:;
goto cleanup0;
} else if (v_code <= v_save_code) {
v_s = 4095;
while (v_s != 0) {
while (true) {
if (v_s == 0) {
status = puffs_gif_error_bad_gif_image;
goto cleanup0;
}
v_s -= 1;
goto label_1_break;
}
label_1_break:;
} else {
status = puffs_gif_error_bad_gif_image;
goto cleanup0;
+2 -1
View File
@@ -64,13 +64,14 @@ pub func lzw_decoder.decode?(dst ptr buf1, src ptr buf1, src_final bool)() {
} else if code <= save_code {
var s u32[..4095] = 4095
while s != 0,
while true,
inv n_bits < 8,
{
if s == 0 {
return error "bad GIF image"
}
s -= 1
break
}
// TODO: implement.