summaryrefslogtreecommitdiff
path: root/src/wasm/wasm-debug.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/wasm/wasm-debug.cpp')
-rw-r--r--src/wasm/wasm-debug.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/wasm/wasm-debug.cpp b/src/wasm/wasm-debug.cpp
index e90dc6d48..112c805d8 100644
--- a/src/wasm/wasm-debug.cpp
+++ b/src/wasm/wasm-debug.cpp
@@ -1001,6 +1001,16 @@ static void updateLoc(llvm::DWARFYAML::Data& yaml,
assert(newStart >= newBase && newEnd >= newBase);
newStart -= newBase;
newEnd -= newBase;
+ if (newStart == 0 && newEnd == 0) {
+ // After mapping to the new positions, and after relativizing to the
+ // base, if we end up with (0, 0) then we must emit something else, as
+ // that would be interpreted as the end of a list. As it is an empty
+ // span, the actual value doesn't matter, it just has to be != 0.
+ // This can happen if the very first span in a compile unit is an
+ // empty span, in which case relative to the base of the compile unit
+ // we would have (0, 0).
+ newStart = newEnd = IGNOREABLE_LOCATION;
+ }
}
// The loc start and end markers have been preserved. However, TODO
// instructions in the middle may have moved around, making the loc no