summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/s2wasm.h1
-rw-r--r--test/dot_s/basics.wast45
2 files changed, 46 insertions, 0 deletions
diff --git a/src/s2wasm.h b/src/s2wasm.h
index 03bab0ba5..a04ab65bd 100644
--- a/src/s2wasm.h
+++ b/src/s2wasm.h
@@ -372,6 +372,7 @@ private:
// this may also be a loop beginning
if (*s == 'l') {
auto curr = allocator.alloc<Loop>();
+ bstack.back()->list.push_back(curr);
curr->out = name;
mustMatch("loop");
curr->in = getStr();
diff --git a/test/dot_s/basics.wast b/test/dot_s/basics.wast
index 192fe3dbc..db607575e 100644
--- a/test/dot_s/basics.wast
+++ b/test/dot_s/basics.wast
@@ -30,6 +30,51 @@
)
$BB0_4
)
+ (loop $BB0_1 $BB0_4
+ (block
+ (set_local $$0
+ (i32.add
+ (get_local $$0)
+ (i32.gt_s
+ (i32.const 10)
+ (get_local $$0)
+ )
+ )
+ )
+ (block $BB0_3
+ (br_if
+ (i32.ne
+ (i32.rem_s
+ (i32.const 5)
+ (get_local $$0)
+ )
+ (i32.const 3)
+ )
+ $BB0_3
+ )
+ (set_local $$0
+ (i32.add
+ (get_local $$0)
+ (i32.rem_s
+ (i32.const 111)
+ (get_local $$0)
+ )
+ )
+ )
+ )
+ (br_if
+ (i32.eq
+ (i32.rem_s
+ (i32.const 7)
+ (get_local $$0)
+ )
+ (i32.const 0)
+ )
+ $BB0_5
+ )
+ (br $BB0_1)
+ )
+ )
)
(set_local $$0
(i32.add