summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorHeejin Ahn <aheejin@users.noreply.github.com>2016-08-05 08:41:48 -0700
committerDerek Schuff <dschuff@chromium.org>2016-08-05 08:41:48 -0700
commit49b99e6675424ff0866a670ed83f2393330198dd (patch)
tree28cbf686628df7d46f05574faaa20921cb77af22 /test
parente8da13d1e4d0b553ef103d196e83a93f0e64ed8a (diff)
downloadbinaryen-49b99e6675424ff0866a670ed83f2393330198dd.tar.gz
binaryen-49b99e6675424ff0866a670ed83f2393330198dd.tar.bz2
binaryen-49b99e6675424ff0866a670ed83f2393330198dd.zip
Fix a parsing bug introduced by #615 (#661)
Name lhs = getStrToSep(); if (!skipEqual()){ s = strchr(s, '\n'); if (!s) break; continue; } The above code snippet introduced by #615 has a bug when there is only one word (e.g. ".text") in a line. If there is only one word in a line, skipEqual() also skips the newline character at the end of the line, and strchr(s, '\n') moves the cursor to the end of the next line, effectively skipping the whole next line.
Diffstat (limited to 'test')
-rw-r--r--test/dot_s/text_before_type.s19
-rw-r--r--test/dot_s/text_before_type.wast12
2 files changed, 31 insertions, 0 deletions
diff --git a/test/dot_s/text_before_type.s b/test/dot_s/text_before_type.s
new file mode 100644
index 000000000..7c341078a
--- /dev/null
+++ b/test/dot_s/text_before_type.s
@@ -0,0 +1,19 @@
+ .text
+ .file "/tmp/tmpGckQku/foo.bc"
+ .hidden main
+ .globl main
+ .type main,@function
+main:
+ .result i32
+ call foo@FUNCTION
+ i32.const $push0=, 0
+ .endfunc
+.Lfunc_end1:
+ .size main, .Lfunc_end1-main
+ .text
+ .type foo,@function
+foo:
+ .endfunc
+.Lfunc_end0:
+ .size foo, .Lfunc_end0-foo
+
diff --git a/test/dot_s/text_before_type.wast b/test/dot_s/text_before_type.wast
new file mode 100644
index 000000000..7238f7b7b
--- /dev/null
+++ b/test/dot_s/text_before_type.wast
@@ -0,0 +1,12 @@
+(module
+ (memory 1)
+ (export "memory" memory)
+ (export "main" $main)
+ (func $main (result i32)
+ (call $foo)
+ (i32.const 0)
+ )
+ (func $foo
+ )
+)
+;; METADATA: { "asmConsts": {},"staticBump": 12, "initializers": [] }