summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2016-10-12 11:32:19 -0700
committerGitHub <noreply@github.com>2016-10-12 11:32:19 -0700
commita08ccc3cdc2e53354f0eaeba419655b641b2b056 (patch)
tree23e046ab21ac13c5b1ba522463bf0b6fc3e1da98
parent2aad55d7fd4c8ad99d06937ab6838b0a0455e10a (diff)
downloadbinaryen-a08ccc3cdc2e53354f0eaeba419655b641b2b056.tar.gz
binaryen-a08ccc3cdc2e53354f0eaeba419655b641b2b056.tar.bz2
binaryen-a08ccc3cdc2e53354f0eaeba419655b641b2b056.zip
fix bug where we set memory max to the initial value if the max wasn't specified (#760)
-rw-r--r--src/wasm-s-parser.h2
-rw-r--r--test/empty_imported_table.wast4
-rw-r--r--test/empty_imported_table.wast.fromBinary5
-rw-r--r--test/empty_imported_table.wast.fromBinary.noDebugInfo5
-rw-r--r--test/imported_memory.wast3
-rw-r--r--test/imported_memory.wast.fromBinary4
-rw-r--r--test/imported_memory.wast.fromBinary.noDebugInfo4
-rw-r--r--test/imported_memory_growth.wast3
-rw-r--r--test/imported_memory_growth.wast.fromBinary4
-rw-r--r--test/imported_memory_growth.wast.fromBinary.noDebugInfo4
10 files changed, 36 insertions, 2 deletions
diff --git a/src/wasm-s-parser.h b/src/wasm-s-parser.h
index 3e09d4f6f..fda413f80 100644
--- a/src/wasm-s-parser.h
+++ b/src/wasm-s-parser.h
@@ -1689,8 +1689,6 @@ private:
}
if (j < inner.size()) {
wasm.memory.max = atoi(inner[j++]->c_str());
- } else {
- wasm.memory.max = wasm.memory.initial;
}
}
wasm.addImport(im.release());
diff --git a/test/empty_imported_table.wast b/test/empty_imported_table.wast
new file mode 100644
index 000000000..7662c068e
--- /dev/null
+++ b/test/empty_imported_table.wast
@@ -0,0 +1,4 @@
+(module
+ (import "env" "table" (table 0 0 anyfunc))
+ (memory $0 0)
+)
diff --git a/test/empty_imported_table.wast.fromBinary b/test/empty_imported_table.wast.fromBinary
new file mode 100644
index 000000000..5edee3018
--- /dev/null
+++ b/test/empty_imported_table.wast.fromBinary
@@ -0,0 +1,5 @@
+(module
+ (import "env" "table" (table 0 0 anyfunc))
+ (memory $0 0)
+)
+
diff --git a/test/empty_imported_table.wast.fromBinary.noDebugInfo b/test/empty_imported_table.wast.fromBinary.noDebugInfo
new file mode 100644
index 000000000..5edee3018
--- /dev/null
+++ b/test/empty_imported_table.wast.fromBinary.noDebugInfo
@@ -0,0 +1,5 @@
+(module
+ (import "env" "table" (table 0 0 anyfunc))
+ (memory $0 0)
+)
+
diff --git a/test/imported_memory.wast b/test/imported_memory.wast
new file mode 100644
index 000000000..fb3c45f5a
--- /dev/null
+++ b/test/imported_memory.wast
@@ -0,0 +1,3 @@
+(module
+ (import "env" "memory" (memory $0 256 256))
+)
diff --git a/test/imported_memory.wast.fromBinary b/test/imported_memory.wast.fromBinary
new file mode 100644
index 000000000..bcbd85473
--- /dev/null
+++ b/test/imported_memory.wast.fromBinary
@@ -0,0 +1,4 @@
+(module
+ (import "env" "memory" (memory $0 256 256))
+)
+
diff --git a/test/imported_memory.wast.fromBinary.noDebugInfo b/test/imported_memory.wast.fromBinary.noDebugInfo
new file mode 100644
index 000000000..bcbd85473
--- /dev/null
+++ b/test/imported_memory.wast.fromBinary.noDebugInfo
@@ -0,0 +1,4 @@
+(module
+ (import "env" "memory" (memory $0 256 256))
+)
+
diff --git a/test/imported_memory_growth.wast b/test/imported_memory_growth.wast
new file mode 100644
index 000000000..d13b95853
--- /dev/null
+++ b/test/imported_memory_growth.wast
@@ -0,0 +1,3 @@
+(module
+ (import "env" "memory" (memory $0 256))
+)
diff --git a/test/imported_memory_growth.wast.fromBinary b/test/imported_memory_growth.wast.fromBinary
new file mode 100644
index 000000000..426313d7f
--- /dev/null
+++ b/test/imported_memory_growth.wast.fromBinary
@@ -0,0 +1,4 @@
+(module
+ (import "env" "memory" (memory $0 256))
+)
+
diff --git a/test/imported_memory_growth.wast.fromBinary.noDebugInfo b/test/imported_memory_growth.wast.fromBinary.noDebugInfo
new file mode 100644
index 000000000..426313d7f
--- /dev/null
+++ b/test/imported_memory_growth.wast.fromBinary.noDebugInfo
@@ -0,0 +1,4 @@
+(module
+ (import "env" "memory" (memory $0 256))
+)
+