summaryrefslogtreecommitdiff
path: root/src/wast-parser.cc
diff options
context:
space:
mode:
authorSam Clegg <sbc@chromium.org>2019-10-21 09:20:11 -0700
committerGitHub <noreply@github.com>2019-10-21 09:20:11 -0700
commit73f141d49a8759993e0a79c3a0e86dd23784378c (patch)
tree321809077736da909b45b982eb22dea14e092080 /src/wast-parser.cc
parent03816aa9c193bf8076de0d5d7a11941f60ff3353 (diff)
downloadwabt-73f141d49a8759993e0a79c3a0e86dd23784378c.tar.gz
wabt-73f141d49a8759993e0a79c3a0e86dd23784378c.tar.bz2
wabt-73f141d49a8759993e0a79c3a0e86dd23784378c.zip
Check for redefinitions of elem segments (#1193)
Fixes: #1187
Diffstat (limited to 'src/wast-parser.cc')
-rw-r--r--src/wast-parser.cc14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/wast-parser.cc b/src/wast-parser.cc
index 517b70bc..ca21584f 100644
--- a/src/wast-parser.cc
+++ b/src/wast-parser.cc
@@ -932,9 +932,17 @@ Result WastParser::ParseElemModuleField(Module* module) {
EXPECT(Lpar);
Location loc = GetLocation();
EXPECT(Elem);
- std::string name;
- ParseBindVarOpt(&name);
- auto field = MakeUnique<ElemSegmentModuleField>(loc, name);
+ std::string segment_name;
+ ParseBindVarOpt(&segment_name);
+ // With MVP text format the name here was intended to refer to the table
+ // that the elem segment was part of, but we never did anything with this name
+ // since there was only one table anyway.
+ // With bulk-memory enabled this introduces a new name for the particualr
+ // elem segment.
+ if (!options_->features.bulk_memory_enabled()) {
+ segment_name = "";
+ }
+ auto field = MakeUnique<ElemSegmentModuleField>(loc, segment_name);
if (ParseRefTypeOpt(&field->elem_segment.elem_type)) {
field->elem_segment.passive = true;