Open rathann opened 5 years ago
Interesting, I don't see the same behavior when I run locally (using make gcc-i686
). The travis builders also test this configuration (see https://travis-ci.org/WebAssembly/wabt). What compiler are you using?
This is on Fedora rawhide (development branch).
gcc version 9.0.1 20190312 (Red Hat 9.0.1-0.10) (GCC)
test/interp/unary.txt
is fixed by #1046. The rest is still failing the same way.
$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/i686-redhat-linux/9/lto-wrapper
Target: i686-redhat-linux
Configured with: ../configure --enable-bootstrap --enable-languages=c,c++,fortran,objc,obj-c++,ada,go,d,lto --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-shared --enable-threads=posix --enable-checking=release --enable-multilib --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-gcc-major-version-only --with-linker-hash-style=gnu --enable-plugin --enable-initfini-array --with-isl --enable-gnu-indirect-function --enable-cet --with-tune=generic --with-arch=i686 --build=i686-redhat-linux
Thread model: posix
gcc version 9.0.1 20190328 (Red Hat 9.0.1-0.12) (GCC)
CXXFLAGS used: -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m32 -march=i686 -mtune=generic -msse2 -mfpmath=sse -mstackrealign -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection
Interestingly, test/interp/unary.txt
is still failing with gcc-8.3.1 (Fedora 29), even with #1046 applied.
- test/interp/unary.txt
STDOUT MISMATCH:
--- expected
+++ actual
@@ -21,7 +21,7 @@
f64_abs() => f64:100.000000
f64_sqrt_neg_is_nan() => i32:1
f64_sqrt_100() => f64:10.000000
-f64_ceil() => f64:-0.000000
+f64_ceil() => f64:0.000000
f64_floor() => f64:-1.000000
f64_trunc() => f64:-0.000000
f64_nearest_lo() => f64:1.000000
Yes, #1046 only canonicalized NaNs. It looks like std::ceil(-0.75) == 0.0
here, but that's odd since the same test is performed on f32 (float
) and it seems to work properly.
Testing w/ gcc in Compiler Explorer seems to produce the correct value too (negative zero).
I don't know how faithful Compiler Explorer is and I'm no compiler expert. Two things may explain the difference:
CXXFLAGS
.I'm only guessing though. The issue is 100% reproducible on Fedora 29.
I did some more builds and it looks like it's reproducible on Fedora 30 with gcc-9.0.1, too.
Thanks for the info -- I'll get an image to test against.
Meanwhile, I can no longer reproduce this on Fedora 30+. Fedora 29 is nearing end of life, so I don't think it's worth spending time on.
Thanks for the update @rathann.
The following 5 tests are still failing with 1.0.15 on i686 on Fedora 31 (gcc-9.3.1):
test/wasm2c/spec/conversions.txt
test/wasm2c/spec/float_exprs.txt
test/wasm2c/spec/float_literals.txt
test/wasm2c/spec/float_memory.txt
test/wasm2c/spec/float_misc.txt
and I've got 5 new failures:
- test/spec/float_exprs.txt
expected error code 0, got 12.
STDOUT MISMATCH:
--- expected
+++ actual
@@ -8,4 +8,16 @@
init(i32:16, f64:15.300000) =>
init(i32:24, f64:15.400000) =>
run(i32:32, f64:3.000000) =>
-804/804 tests passed.
+out/test/spec/float_exprs.wast:1028: mismatch in result 0 of assert_return: expected f32:-nan, got f32:-nan
+out/test/spec/float_exprs.wast:1032: mismatch in result 0 of assert_return: expected f32:-nan, got f32:-nan
+out/test/spec/float_exprs.wast:1044: mismatch in result 0 of assert_return: expected f64:-nan, got f64:-nan
+out/test/spec/float_exprs.wast:1048: mismatch in result 0 of assert_return: expected f64:-nan, got f64:-nan
+out/test/spec/float_exprs.wast:1107: mismatch in result 0 of assert_return: expected f32:-nan, got f32:-nan
+out/test/spec/float_exprs.wast:1111: mismatch in result 0 of assert_return: expected f32:-nan, got f32:-nan
+out/test/spec/float_exprs.wast:1123: mismatch in result 0 of assert_return: expected f64:-nan, got f64:-nan
+out/test/spec/float_exprs.wast:1127: mismatch in result 0 of assert_return: expected f64:-nan, got f64:-nan
+out/test/spec/float_exprs.wast:2337: mismatch in result 0 of assert_return: expected i32:4286591504, got i32:4290785808
+out/test/spec/float_exprs.wast:2338: mismatch in result 0 of assert_return: expected i32:2139107856, got i32:2143302160
+out/test/spec/float_exprs.wast:2347: mismatch in result 0 of assert_return: expected i64:18442240474082193936, got i64:18444492273895879184
+out/test/spec/float_exprs.wast:2348: mismatch in result 0 of assert_return: expected i64:9218868437227418128, got i64:9221120237041103376
+792/804 tests passed.
- test/spec/float_misc.txt
expected error code 0, got 16.
STDOUT MISMATCH:
--- expected
+++ actual
@@ -1 +1,17 @@
-440/440 tests passed.
+out/test/spec/float_misc.wast:592: mismatch in result 0 of assert_return: expected f32:nan, got f32:nan
+out/test/spec/float_misc.wast:593: mismatch in result 0 of assert_return: expected f32:nan, got f32:nan
+out/test/spec/float_misc.wast:594: mismatch in result 0 of assert_return: expected f64:nan, got f64:nan
+out/test/spec/float_misc.wast:595: mismatch in result 0 of assert_return: expected f64:nan, got f64:nan
+out/test/spec/float_misc.wast:597: mismatch in result 0 of assert_return: expected f32:-nan, got f32:-nan
+out/test/spec/float_misc.wast:598: mismatch in result 0 of assert_return: expected f32:nan, got f32:nan
+out/test/spec/float_misc.wast:599: mismatch in result 0 of assert_return: expected f64:-nan, got f64:-nan
+out/test/spec/float_misc.wast:600: mismatch in result 0 of assert_return: expected f64:nan, got f64:nan
+out/test/spec/float_misc.wast:602: mismatch in result 0 of assert_return: expected f32:nan, got f32:nan
+out/test/spec/float_misc.wast:603: mismatch in result 0 of assert_return: expected f32:-nan, got f32:-nan
+out/test/spec/float_misc.wast:604: mismatch in result 0 of assert_return: expected f32:nan, got f32:nan
+out/test/spec/float_misc.wast:605: mismatch in result 0 of assert_return: expected f32:-nan, got f32:-nan
+out/test/spec/float_misc.wast:606: mismatch in result 0 of assert_return: expected f64:nan, got f64:nan
+out/test/spec/float_misc.wast:607: mismatch in result 0 of assert_return: expected f64:-nan, got f64:-nan
+out/test/spec/float_misc.wast:608: mismatch in result 0 of assert_return: expected f64:nan, got f64:nan
+out/test/spec/float_misc.wast:609: mismatch in result 0 of assert_return: expected f64:-nan, got f64:-nan
+424/440 tests passed.
...
- test/spec/local_tee.txt
expected error code 0, got 1.
STDOUT MISMATCH:
--- expected
+++ actual
@@ -1,3 +1,4 @@
+out/test/spec/local_tee.wast:338: mismatch in result 0 of assert_return: expected f32:-nan, got f32:-nan
out/test/spec/local_tee.wast:371: assert_invalid passed:
error: type mismatch in implicit return, expected [i64] but got [i32]
000001f: error: EndFunctionBody callback failed
@@ -121,4 +122,4 @@
out/test/spec/local_tee.wast:637: assert_invalid passed:
error: type mismatch in local.tee, expected [f64] but got [i64]
0000020: error: OnLocalTeeExpr callback failed
-96/96 tests passed.
+95/96 tests passed.
...
- test/spec/simd/simd_f32x4_arith.txt
expected error code 0, got 2.
STDOUT MISMATCH:
--- expected
+++ actual
@@ -1,3 +1,13 @@
+out/test/spec/simd/simd_f32x4_arith.wast:5225: mismatch in lane 0 of result 0 of assert_return: expected f32:-nan, got f32:-nan
+out/test/spec/simd/simd_f32x4_arith.wast:5225: mismatch in lane 1 of result 0 of assert_return: expected f32:-nan, got f32:-nan
+out/test/spec/simd/simd_f32x4_arith.wast:5225: mismatch in lane 2 of result 0 of assert_return: expected f32:-nan, got f32:-nan
+out/test/spec/simd/simd_f32x4_arith.wast:5225: mismatch in lane 3 of result 0 of assert_return: expected f32:-nan, got f32:-nan
+out/test/spec/simd/simd_f32x4_arith.wast:5225: mismatch in result 0 of assert_return: expected v128 f32:-nanf32:-nanf32:-nanf32:-nan, got v128 i32x4:0xffe00000 0xffe00000 0xffe00000 0xffe00000
+out/test/spec/simd/simd_f32x4_arith.wast:5227: mismatch in lane 0 of result 0 of assert_return: expected f32:nan, got f32:nan
+out/test/spec/simd/simd_f32x4_arith.wast:5227: mismatch in lane 1 of result 0 of assert_return: expected f32:nan, got f32:nan
+out/test/spec/simd/simd_f32x4_arith.wast:5227: mismatch in lane 2 of result 0 of assert_return: expected f32:nan, got f32:nan
+out/test/spec/simd/simd_f32x4_arith.wast:5227: mismatch in lane 3 of result 0 of assert_return: expected f32:nan, got f32:nan
+out/test/spec/simd/simd_f32x4_arith.wast:5227: mismatch in result 0 of assert_return: expected v128 f32:nanf32:nanf32:nanf32:nan, got v128 i32x4:0x7fe00000 0x7fe00000 0x7fe00000 0x7fe00000
out/test/spec/simd/simd_f32x4_arith.wast:5295: assert_invalid passed:
error: type mismatch in f32x4.neg, expected [v128] but got [i32]
000001d: error: OnUnaryExpr callback failed
@@ -46,4 +56,4 @@
out/test/spec/simd/simd_f32x4_arith.wast:5377: assert_invalid passed:
error: type mismatch in f32x4.div, expected [v128, v128] but got []
000001b: error: OnBinaryExpr callback failed
-1819/1819 tests passed.
+1817/1819 tests passed.
...
- test/spec/simd/simd_f64x2_arith.txt
expected error code 0, got 2.
STDOUT MISMATCH:
--- expected
+++ actual
@@ -1,3 +1,9 @@
+out/test/spec/simd/simd_f64x2_arith.wast:5225: mismatch in lane 0 of result 0 of assert_return: expected f64:-nan, got f64:-nan
+out/test/spec/simd/simd_f64x2_arith.wast:5225: mismatch in lane 1 of result 0 of assert_return: expected f64:-nan, got f64:-nan
+out/test/spec/simd/simd_f64x2_arith.wast:5225: mismatch in result 0 of assert_return: expected v128 f64:-nanf64:-nan, got v128 i32x4:0x00000000 0xfffc0000 0x00000000 0xfffc0000
+out/test/spec/simd/simd_f64x2_arith.wast:5227: mismatch in lane 0 of result 0 of assert_return: expected f64:nan, got f64:nan
+out/test/spec/simd/simd_f64x2_arith.wast:5227: mismatch in lane 1 of result 0 of assert_return: expected f64:nan, got f64:nan
+out/test/spec/simd/simd_f64x2_arith.wast:5227: mismatch in result 0 of assert_return: expected v128 f64:nanf64:nan, got v128 i32x4:0x00000000 0x7ffc0000 0x00000000 0x7ffc0000
out/test/spec/simd/simd_f64x2_arith.wast:5302: assert_invalid passed:
error: type mismatch in f64x2.neg, expected [v128] but got [i64]
000001d: error: OnUnaryExpr callback failed
@@ -46,4 +52,4 @@
out/test/spec/simd/simd_f64x2_arith.wast:5384: assert_invalid passed:
error: type mismatch in f64x2.div, expected [v128, v128] but got []
000001b: error: OnBinaryExpr callback failed
-1822/1822 tests passed.
+1820/1822 tests passed.
Still reproducible with 1.0.23 on Fedora rawhide. Same 10 failures are occurring.
New failures on Fedora rawhide (36) with gcc-12 pre-release:
spec/float_exprs.txt
spec/local_tee.txt
Log extract:
- test/spec/float_exprs.txt
expected error code 0, got 12.
STDOUT MISMATCH:
--- expected
+++ actual
@@ -8,4 +8,16 @@
init(i32:16, f64:15.300000) =>
init(i32:24, f64:15.400000) =>
run(i32:32, f64:3.000000) =>
-804/804 tests passed.
+out/test/spec/float_exprs.wast:1028: mismatch in result 0 of assert_return: expected f32:-nan, got f32:-nan
+out/test/spec/float_exprs.wast:1032: mismatch in result 0 of assert_return: expected f32:-nan, got f32:-nan
+out/test/spec/float_exprs.wast:1044: mismatch in result 0 of assert_return: expected f64:-nan, got f64:-nan
+out/test/spec/float_exprs.wast:1048: mismatch in result 0 of assert_return: expected f64:-nan, got f64:-nan
+out/test/spec/float_exprs.wast:1107: mismatch in result 0 of assert_return: expected f32:-nan, got f32:-nan
+out/test/spec/float_exprs.wast:1111: mismatch in result 0 of assert_return: expected f32:-nan, got f32:-nan
+out/test/spec/float_exprs.wast:1123: mismatch in result 0 of assert_return: expected f64:-nan, got f64:-nan
+out/test/spec/float_exprs.wast:1127: mismatch in result 0 of assert_return: expected f64:-nan, got f64:-nan
+out/test/spec/float_exprs.wast:2337: mismatch in result 0 of assert_return: expected i32:4286591504, got i32:4290785808
+out/test/spec/float_exprs.wast:2338: mismatch in result 0 of assert_return: expected i32:2139107856, got i32:2143302160
+out/test/spec/float_exprs.wast:2347: mismatch in result 0 of assert_return: expected i64:18442240474082193936, got i64:18444492273895879184
+out/test/spec/float_exprs.wast:2348: mismatch in result 0 of assert_return: expected i64:9218868437227418128, got i64:9221120237041103376
+792/804 tests passed.
...
- test/spec/local_tee.txt
expected error code 0, got 1.
STDOUT MISMATCH:
--- expected
+++ actual
@@ -1,3 +1,4 @@
+out/test/spec/local_tee.wast:338: mismatch in result 0 of assert_return: expected f32:-nan, got f32:-nan
out/test/spec/local_tee.wast:371: assert_invalid passed:
out/test/spec/local_tee/local_tee.1.wasm:000001e: error: type mismatch in implicit return, expected [i64] but got [i32]
000001f: error: EndFunctionBody callback failed
@@ -121,4 +122,4 @@
out/test/spec/local_tee.wast:637: assert_invalid passed:
0000000: error: local variable out of range (max 3)
0000023: error: OnLocalTeeExpr callback failed
-96/96 tests passed.
+95/96 tests passed.
I'm not sure what's going on with spec/local_tee.txt, because expected
and got
values look identical to me (f32:-nan
).
@binji any clues?
Some more failures in 1.0.30:
- test/wasm2c/old-spec/select.txt
expected error code 0, got 1.
STDERR MISMATCH:
--- expected
+++ actual
@@ -0,0 +1,13 @@
+Traceback (most recent call last):
+ File "/builddir/build/BUILD/wabt-1.0.30/test/run-spec-wasm2c.py", line 545, in <module>
+ sys.exit(main(sys.argv[1:]))
+ File "/builddir/build/BUILD/wabt-1.0.30/test/run-spec-wasm2c.py", line 539, in main
+ utils.Executable(main_exe, forward_stdout=True).RunWithArgs()
+ File "/builddir/build/BUILD/wabt-1.0.30/test/utils.py", line 96, in RunWithArgs
+ raise error
+utils.Error: Error running "out/test/wasm2c/old-spec/select/select" (1):
+None
+out/test/wasm2c/old-spec/select/select-main.c:335: assertion failed: in Z_select_0_wasmZ_select_f32(&Z_select_0_wasm_instance, make_nan_f32(0x020304), 1.f, 1u): expected nan, got nan.
+out/test/wasm2c/old-spec/select/select-main.c:353: assertion failed: in Z_select_0_wasmZ_select_f32(&Z_select_0_wasm_instance, 2.f, make_nan_f32(0x020304), 0u): expected nan, got nan.
+out/test/wasm2c/old-spec/select/select-main.c:359: assertion failed: in Z_select_0_wasmZ_select_f64(&Z_select_0_wasm_instance, make_nan_f64(0x020304), 1.0000000000000000L, 1u): expected nan, got nan.
+out/test/wasm2c/old-spec/select/select-main.c:377: assertion failed: in Z_select_0_wasmZ_select_f64(&Z_select_0_wasm_instance, 2.0000000000000000L, make_nan_f64(0x020304), 0u): expected nan, got nan.
STDOUT MISMATCH:
--- expected
+++ actual
@@ -1 +1 @@
-94/94 tests passed.
+90/94 tests passed.
...
- test/wasm2c/spec/local_tee.txt
expected error code 0, got 1.
STDERR MISMATCH:
--- expected
+++ actual
@@ -0,0 +1,10 @@
+Traceback (most recent call last):
+ File "/builddir/build/BUILD/wabt-1.0.30/test/run-spec-wasm2c.py", line 545, in <module>
+ sys.exit(main(sys.argv[1:]))
+ File "/builddir/build/BUILD/wabt-1.0.30/test/run-spec-wasm2c.py", line 539, in main
+ utils.Executable(main_exe, forward_stdout=True).RunWithArgs()
+ File "/builddir/build/BUILD/wabt-1.0.30/test/utils.py", line 96, in RunWithArgs
+ raise error
+utils.Error: Error running "out/test/wasm2c/spec/local_tee/local_tee" (1):
+None
+out/test/wasm2c/spec/local_tee/local_tee-main.c:440: assertion failed: in Z_local_tee_0_wasmZ_asZ2DunaryZ2Doperand(&Z_local_tee_0_wasm_instance, 0.f): expected -nan, got -nan.
STDOUT MISMATCH:
--- expected
+++ actual
@@ -1 +1 @@
-55/55 tests passed.
+54/55 tests passed.
Two new test failures in 1.0.33 test suite on i686:
- test/wasm2c/spec/memory64/float_memory64.txt
expected error code 0, got 1.
STDERR MISMATCH:
--- expected
+++ actual
@@ -0,0 +1,22 @@
+Traceback (most recent call last):
+ File "/builddir/build/BUILD/wabt-1.0.33/test/run-spec-wasm2c.py", line 649, in <module>
+ sys.exit(main(sys.argv[1:]))
+ ^^^^^^^^^^^^^^^^^^
+ File "/builddir/build/BUILD/wabt-1.0.33/test/run-spec-wasm2c.py", line 643, in main
+ utils.Executable(main_exe, forward_stdout=True).RunWithArgs()
+ File "/builddir/build/BUILD/wabt-1.0.33/test/utils.py", line 95, in RunWithArgs
+ raise error
+utils.Error: Error running "out/test/wasm2c/spec/memory64/float_memory64/float_memory64" (1):
+None
+out/test/wasm2c/spec/memory64/float_memory64/float_memory64-main.c:385: assertion failed: in w2c_float__memory64__0__wasm_f320x2Eload(&float__memory64__0__wasm_instance): expected nan, got nan.
+out/test/wasm2c/spec/memory64/float_memory64/float_memory64-main.c:403: assertion failed: in w2c_float__memory64__0__wasm_f320x2Eload(&float__memory64__0__wasm_instance): expected nan, got nan.
+out/test/wasm2c/spec/memory64/float_memory64/float_memory64-main.c:421: assertion failed: in w2c_float__memory64__0__wasm_f320x2Eload(&float__memory64__0__wasm_instance): expected nan, got nan.
+out/test/wasm2c/spec/memory64/float_memory64/float_memory64-main.c:430: assertion failed: in w2c_float__memory64__1__wasm_f640x2Eload(&float__memory64__1__wasm_instance): expected nan, got nan.
+out/test/wasm2c/spec/memory64/float_memory64/float_memory64-main.c:448: assertion failed: in w2c_float__memory64__1__wasm_f640x2Eload(&float__memory64__1__wasm_instance): expected nan, got nan.
+out/test/wasm2c/spec/memory64/float_memory64/float_memory64-main.c:466: assertion failed: in w2c_float__memory64__1__wasm_f640x2Eload(&float__memory64__1__wasm_instance): expected nan, got nan.
+out/test/wasm2c/spec/memory64/float_memory64/float_memory64-main.c:475: assertion failed: in w2c_float__memory64__2__wasm_f320x2Eload(&float__memory64__2__wasm_instance): expected nan, got nan.
+out/test/wasm2c/spec/memory64/float_memory64/float_memory64-main.c:493: assertion failed: in w2c_float__memory64__2__wasm_f320x2Eload(&float__memory64__2__wasm_instance): expected nan, got nan.
+out/test/wasm2c/spec/memory64/float_memory64/float_memory64-main.c:511: assertion failed: in w2c_float__memory64__2__wasm_f320x2Eload(&float__memory64__2__wasm_instance): expected nan, got nan.
+out/test/wasm2c/spec/memory64/float_memory64/float_memory64-main.c:520: assertion failed: in w2c_float__memory64__3__wasm_f640x2Eload(&float__memory64__3__wasm_instance): expected nan, got nan.
+out/test/wasm2c/spec/memory64/float_memory64/float_memory64-main.c:538: assertion failed: in w2c_float__memory64__3__wasm_f640x2Eload(&float__memory64__3__wasm_instance): expected nan, got nan.
+out/test/wasm2c/spec/memory64/float_memory64/float_memory64-main.c:556: assertion failed: in w2c_float__memory64__3__wasm_f640x2Eload(&float__memory64__3__wasm_instance): expected nan, got nan.
STDOUT MISMATCH:
--- expected
+++ actual
@@ -1 +1 @@
-60/60 tests passed.
+48/60 tests passed.
and
- test/wasm2c/spec/multi-memory/float_memory0.txt
expected error code 0, got 1.
STDERR MISMATCH:
--- expected
+++ actual
@@ -0,0 +1,16 @@
+Traceback (most recent call last):
+ File "/builddir/build/BUILD/wabt-1.0.33/test/run-spec-wasm2c.py", line 649, in <module>
+ sys.exit(main(sys.argv[1:]))
+ ^^^^^^^^^^^^^^^^^^
+ File "/builddir/build/BUILD/wabt-1.0.33/test/run-spec-wasm2c.py", line 643, in main
+ utils.Executable(main_exe, forward_stdout=True).RunWithArgs()
+ File "/builddir/build/BUILD/wabt-1.0.33/test/utils.py", line 95, in RunWithArgs
+ raise error
+utils.Error: Error running "out/test/wasm2c/spec/multi-memory/float_memory0/float_memory0" (1):
+None
+out/test/wasm2c/spec/multi-memory/float_memory0/float_memory0-main.c:377: assertion failed: in w2c_float__memory0__0__wasm_f320x2Eload(&float__memory0__0__wasm_instance): expected nan, got nan.
+out/test/wasm2c/spec/multi-memory/float_memory0/float_memory0-main.c:395: assertion failed: in w2c_float__memory0__0__wasm_f320x2Eload(&float__memory0__0__wasm_instance): expected nan, got nan.
+out/test/wasm2c/spec/multi-memory/float_memory0/float_memory0-main.c:413: assertion failed: in w2c_float__memory0__0__wasm_f320x2Eload(&float__memory0__0__wasm_instance): expected nan, got nan.
+out/test/wasm2c/spec/multi-memory/float_memory0/float_memory0-main.c:422: assertion failed: in w2c_float__memory0__1__wasm_f640x2Eload(&float__memory0__1__wasm_instance): expected nan, got nan.
+out/test/wasm2c/spec/multi-memory/float_memory0/float_memory0-main.c:440: assertion failed: in w2c_float__memory0__1__wasm_f640x2Eload(&float__memory0__1__wasm_instance): expected nan, got nan.
+out/test/wasm2c/spec/multi-memory/float_memory0/float_memory0-main.c:458: assertion failed: in w2c_float__memory0__1__wasm_f640x2Eload(&float__memory0__1__wasm_instance): expected nan, got nan.
STDOUT MISMATCH:
--- expected
+++ actual
@@ -1 +1 @@
-20/20 tests passed.
+14/20 tests passed.
I'm seeing similar errors in https://github.com/turbolent/w2c2. Has anyone investigated why these tests fail?
I think the root cause might be something like, "The SSE2 floating-point instructions largely conform to IEEE 754 (and the Wasm semantics wrt canonical/arithmetic NaNs), but x87 doesn't. So if somebody cares about i686 (which is a 32-bit x86 architecture without SSE2, so the compiler is generating x87 instructions for floating-point), the declarations file would need a lot more TLC to make the floating-point operations match the IEEE and Wasm semantics."
If we just care about 32-bit x86 (but not necessarily the base i686) and are willing to restrict to chips that have SSE2 (e.g. Pentium-M, Pentium 4, and later), then compiling with -msse2 -mfpmath=sse
might help.
If somebody cares about conforming to the spec exactly on pre-SSE2 32-bit x86, it would be helpful to have commit-by-commit CI on this architecture so we can avoid screwing it up in the future. And somebody will need access to a test machine and will have to do the work of adapting the declarations file to make it conform on x87.
I wonder if we could #error out with a useful error message when building for x86 without SSE2? Perhaps with a link it this bug
I think the root cause might be something like, "The SSE2 floating-point instructions largely conform to IEEE 754 (and the Wasm semantics wrt canonical/arithmetic NaNs), but x87 doesn't. [...]
If we just care about 32-bit x86 (but not necessarily the base i686) and are willing to restrict to chips that have SSE2 (e.g. Pentium-M, Pentium 4, and later), then compiling with
-msse2 -mfpmath=sse
might help.
FWIW, Fedora has required SSE2 for years and we don't even build x86 32-bit kernels anymore. We're building for i686 with the following CFLAGS: "-m32 -march=i686 -mtune=generic -msse2 -mfpmath=sse" (and some others), so the above failures occur with SSE2 fpmath enabled already.
It's cool that Fedora's building WABT with those CFLAGS, but to get the wasm2c tests to build their output with those CFLAGS, I think they have to be added to the WASM2C_CFLAGS
environment variable before running the tests. (The .github/workflows/build.yml file has some examples of this.) I'm curious if that helps?
If that doesn't do the trick, then bigger picture, I think for this to get fixed, we'd probably need access to a test machine (and ideally commit-by-commit CI) with this architecture to figure out what's really going on and apply the necessary TLC to the declarations... :-/
It's cool that Fedora's building WABT with those CFLAGS, but to get the wasm2c tests to build their output with those CFLAGS, I think they have to be added to the
WASM2C_CFLAGS
environment variable before running the tests. (The .github/workflows/build.yml file has some examples of this.) I'm curious if that helps?
Good point! I'll try that, thanks.
If that doesn't do the trick, then bigger picture, I think for this to get fixed, we'd probably need access to a test machine (and ideally commit-by-commit CI) with this architecture to figure out what's really going on and apply the necessary TLC to the declarations... :-/
You can do this on any x86_64 with multiarch gcc and i686 flags. This could be set up in GitHub Actions to run in a 32bit Debian container, for example. Fedora x86_64 gcc is capable of building 32-bit binaries, too.
New failure with 1.0.36:
- test/regress/empty-quoted-module.txt
STDERR MISMATCH:
--- expected
+++ actual
@@ -1,3 +1,3 @@
-out/test/regress/empty-quoted-module.txt:3:2: error: error in quoted module: @0x100000001: empty module
+out/test/regress/empty-quoted-module.txt:3:2: error: error in quoted module: @0x00000001: empty module
(module quote "")
^^^^^^
It's cool that Fedora's building WABT with those CFLAGS, but to get the wasm2c tests to build their output with those CFLAGS, I think they have to be added to the
WASM2C_CFLAGS
environment variable before running the tests. (The .github/workflows/build.yml file has some examples of this.) I'm curious if that helps?Good point! I'll try that, thanks.
FWIW, running the tests with WASM2C_CFLAGS="-msse2 -mfpmath=sse"
makes no difference. The above mentioned tests still fail.
Running the 1.0.10 testsuite (
test/run-tests.py
) on x86 32bit (i686) yields the following failed tests:I suspect all but the first are due to lower float precision.