Skip to content

Commit a2366fe

Browse files
committed
fix rustwasm#326 (help-wanted)
1 parent d62b5ca commit a2366fe

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

ir/ir.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ impl ItemsBuilder {
5050
self.items.insert(id, item);
5151

5252
let old_value = self.parsed.insert(id);
53+
// panic happen as this is call 2 times with 7,
5354
assert!(
5455
old_value,
5556
"should not parse the same key into multiple items"

parser/wasm_parse/mod.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,12 +125,18 @@ impl<'a> Parse<'a> for wasmparser::ModuleReader<'a> {
125125
section.get_data_section_reader()?.parse_items(items, idx)?;
126126
}
127127
wasmparser::SectionCode::DataCount => {
128+
let msg = "the last iteration of the loop take 7 as id";
129+
dbg!(msg, idx);
128130
DataCountSection(section).parse_items(items, idx)?;
129131
}
130132
wasmparser::SectionCode::Code | wasmparser::SectionCode::Function => {
131133
unreachable!("unexpected code or function section found");
132134
}
133135
};
136+
if idx == 7 {
137+
let msg = "At some point just after the debug above this also is 7 so the panic";
138+
dbg!(msg, &idx);
139+
}
134140
let id = Id::section(idx);
135141
let added = items.size_added() - start;
136142
let size = sizes
@@ -799,8 +805,10 @@ impl<'a> Parse<'a> for DataCountSection<'a> {
799805
) -> Result<(), traits::Error> {
800806
let range = self.0.range();
801807
let size = (range.end - range.start) as u32;
808+
//dbg!("section", &idx);
802809
let id = Id::section(idx);
803810
let name = "\"data count\" section";
811+
//dbg!("YEAH", &id);
804812
items.add_root(ir::Item::new(id, name, size, ir::Misc::new()));
805813
Ok(())
806814
}

0 commit comments

Comments
 (0)