diff options
Diffstat (limited to 'test/lit/binary/name-overlap.test')
-rw-r--r-- | test/lit/binary/name-overlap.test | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/test/lit/binary/name-overlap.test b/test/lit/binary/name-overlap.test new file mode 100644 index 000000000..7f5318737 --- /dev/null +++ b/test/lit/binary/name-overlap.test @@ -0,0 +1,22 @@ +;; NOTE: Assertions have been generated by update_lit_checks.py --all-items and should not be edited. +;; RUN: wasm-opt %s.wasm -S -o - | filecheck %s + +;; Test that we emit deduplicated names even in the corner case that one item +;; is in the names section and the other is not, and the latter's temp name +;; coincides with the name the name section gives for the first. Specifically, +;; the input wasm looks like this: +;; +;; (module +;; (global $global$1 i32 (i32.const 1)) ;; In names section. +;; (global $........ i32 (i32.const 0)) ;; *Not* in names section. +;; ) +;; +;; We give them temp names $global$0, $global$1 to begin with, then apply the +;; names section which turns the first's name into $global$1 - identical to the +;; second. We must then deduplicate the second name to avoid a collision. (Note +;; that we leave the name from the names section as it is, and only adjust the +;; temp name.) + +;; CHECK: (global $global$1 i32 (i32.const 1)) +;; CHECK-NEXT: (global $global$1.1 i32 (i32.const 0)) + |