From 33f758c6b43f52ea5d74cc9579c63e62de4ec33d Mon Sep 17 00:00:00 2001 From: Ben Smith Date: Wed, 15 Aug 2018 14:26:00 -0700 Subject: Fix: set_global on immutable global is invalid (#895) There is a spec test for this, but spectest-interp only runs the validator in `binary-reader-interp.cc`, which is different than the validator in `validator.cc`. This is necessarily so, since some checks only make sense when the module is linked or instantiated. This fixes issue #894. --- test/roundtrip/fold-getset-global.txt | 8 ++++---- test/roundtrip/generate-global-names.txt | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'test/roundtrip') diff --git a/test/roundtrip/fold-getset-global.txt b/test/roundtrip/fold-getset-global.txt index 122c2a60..0766f397 100644 --- a/test/roundtrip/fold-getset-global.txt +++ b/test/roundtrip/fold-getset-global.txt @@ -1,8 +1,8 @@ ;;; TOOL: run-roundtrip ;;; ARGS: --stdout --fold-exprs (module - (global i32 (i32.const 1)) - (global f32 (f32.const 1.5)) + (global (mut i32) (i32.const 1)) + (global (mut f32) (f32.const 1.5)) (func $fold-get-global (result i32) get_global 1 @@ -36,6 +36,6 @@ (i32.const 1))) (set_global 1 (f32.const 0x1p+1 (;=2;)))) - (global (;0;) i32 (i32.const 1)) - (global (;1;) f32 (f32.const 0x1.8p+0 (;=1.5;)))) + (global (;0;) (mut i32) (i32.const 1)) + (global (;1;) (mut f32) (f32.const 0x1.8p+0 (;=1.5;)))) ;;; STDOUT ;;) diff --git a/test/roundtrip/generate-global-names.txt b/test/roundtrip/generate-global-names.txt index a0e0ce78..e97bbf21 100644 --- a/test/roundtrip/generate-global-names.txt +++ b/test/roundtrip/generate-global-names.txt @@ -2,7 +2,7 @@ ;;; ARGS: --stdout --generate-names (module (global i32 (i32.const 42)) - (global f32 (f32.const -1.5)) + (global (mut f32) (f32.const -1.5)) (func (result i32) f32.const 3.0 set_global 1 @@ -15,5 +15,5 @@ set_global $g1 get_global $g0) (global $g0 i32 (i32.const 42)) - (global $g1 f32 (f32.const -0x1.8p+0 (;=-1.5;)))) + (global $g1 (mut f32) (f32.const -0x1.8p+0 (;=-1.5;)))) ;;; STDOUT ;;) -- cgit v1.2.3