Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test failures on x86 32bit (i686) #1044

Open
rathann opened this issue Mar 15, 2019 · 25 comments
Open

test failures on x86 32bit (i686) #1044

rathann opened this issue Mar 15, 2019 · 25 comments

Comments

@rathann
Copy link
Contributor

rathann commented Mar 15, 2019

Running the 1.0.10 testsuite (test/run-tests.py) on x86 32bit (i686) yields the following failed tests:

- 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
...
- test/wasm2c/spec/conversions.txt
  expected error code 0, got 1.
  STDERR MISMATCH:
  --- expected
  +++ actual
  @@ -0,0 +1,17 @@
  +Traceback (most recent call last):
  +  File "/builddir/build/BUILD/wabt-1.0.10/test/run-spec-wasm2c.py", line 407, in <module>
  +    sys.exit(main(sys.argv[1:]))
  +  File "/builddir/build/BUILD/wabt-1.0.10/test/run-spec-wasm2c.py", line 400, in main
  +    forward_stdout=True).RunWithArgs()
  +  File "/builddir/build/BUILD/wabt-1.0.10/test/utils.py", line 104, in RunWithArgs
  +    raise error
  +utils.Error: Error running "out/test/wasm2c/spec/conversions/conversions":
  +conversions-main.c:1394: assertion failed: in Z_conversions_0Z_i32Z2Ereinterpret_f32Z_if(make_nan_f32(0x200000)): expected 2141192192, got 2145386496.
  +conversions-main.c:1397: assertion failed: in Z_conversions_0Z_i32Z2Ereinterpret_f32Z_if(-make_nan_f32(0x200000)): expected 4288675840, got 4292870144.
  +conversions-main.c:1439: assertion failed: in Z_conversions_0Z_i64Z2Ereinterpret_f64Z_jd(make_nan_f64(0x4000000000000)): expected 9219994337134247936, got 9222246136947933184.
  +conversions-main.c:1442: assertion failed: in Z_conversions_0Z_i64Z2Ereinterpret_f64Z_jd(-make_nan_f64(0x4000000000000)): expected 18443366373989023744, got 18445618173802708992.
  +During handling of the above exception, another exception occurred:
  +Traceback (most recent call last):
  +  File "/builddir/build/BUILD/wabt-1.0.10/test/run-spec-wasm2c.py", line 413, in <module>
  +    sys.stderr.write(u'{0}\n'.format(e).encode('ascii', 'replace'))
  +TypeError: write() argument must be str, not bytes
  STDOUT MISMATCH:
  --- expected
  +++ actual
  @@ -1 +1 @@
  -401/401 tests passed.
  +397/401 tests passed.
- test/wasm2c/spec/float_literals.txt
  expected error code 0, got 1.
  STDERR MISMATCH:
  --- expected
  +++ actual
  @@ -0,0 +1,21 @@
  +Traceback (most recent call last):
  +  File "/builddir/build/BUILD/wabt-1.0.10/test/run-spec-wasm2c.py", line 407, in <module>
  +    sys.exit(main(sys.argv[1:]))
  +  File "/builddir/build/BUILD/wabt-1.0.10/test/run-spec-wasm2c.py", line 400, in main
  +    forward_stdout=True).RunWithArgs()
  +  File "/builddir/build/BUILD/wabt-1.0.10/test/utils.py", line 104, in RunWithArgs
  +    raise error
  +utils.Error: Error running "out/test/wasm2c/spec/float_literals/float_literals":
  +float_literals-main.c:258: assertion failed: in Z_float_literals_0Z_f32Z2Einformally_known_as_plain_snanZ_iv(): expected 2141192192, got 2145386496.
  +float_literals-main.c:264: assertion failed: in Z_float_literals_0Z_f32Z2Emisc_nanZ_iv(): expected 2139169605, got 2143363909.
  +float_literals-main.c:267: assertion failed: in Z_float_literals_0Z_f32Z2Emisc_positive_nanZ_iv(): expected 2142257232, got 2146451536.
  +float_literals-main.c:270: assertion failed: in Z_float_literals_0Z_f32Z2Emisc_negative_nanZ_iv(): expected 4289379550, got 4293573854.
  +float_literals-main.c:351: assertion failed: in Z_float_literals_0Z_f64Z2Einformally_known_as_plain_snanZ_jv(): expected 9219994337134247936, got 9222246136947933184.
  +float_literals-main.c:357: assertion failed: in Z_float_literals_0Z_f64Z2Emisc_nanZ_jv(): expected 9218888453225749180, got 9221140253039434428.
  +float_literals-main.c:360: assertion failed: in Z_float_literals_0Z_f64Z2Emisc_positive_nanZ_jv(): expected 9219717281780008969, got 9221969081593694217.
  +float_literals-main.c:363: assertion failed: in Z_float_literals_0Z_f64Z2Emisc_negative_nanZ_jv(): expected 18442992325002076997, got 18445244124815762245.
  +During handling of the above exception, another exception occurred:
  +Traceback (most recent call last):
  +  File "/builddir/build/BUILD/wabt-1.0.10/test/run-spec-wasm2c.py", line 413, in <module>
  +    sys.stderr.write(u'{0}\n'.format(e).encode('ascii', 'replace'))
  +TypeError: write() argument must be str, not bytes
  STDOUT MISMATCH:
  --- expected
  +++ actual
  @@ -1 +1 @@
  -83/83 tests passed.
  +75/83 tests passed.
- test/wasm2c/spec/float_memory.txt
  expected error code 0, got 1.
  STDERR MISMATCH:
  --- expected
  +++ actual
  @@ -0,0 +1,17 @@
  +Traceback (most recent call last):
  +  File "/builddir/build/BUILD/wabt-1.0.10/test/run-spec-wasm2c.py", line 407, in <module>
  +    sys.exit(main(sys.argv[1:]))
  +  File "/builddir/build/BUILD/wabt-1.0.10/test/run-spec-wasm2c.py", line 400, in main
  +    forward_stdout=True).RunWithArgs()
  +  File "/builddir/build/BUILD/wabt-1.0.10/test/utils.py", line 104, in RunWithArgs
  +    raise error
  +utils.Error: Error running "out/test/wasm2c/spec/float_memory/float_memory":
  +float_memory-main.c:280: assertion failed: in Z_float_memory_0Z_i32Z2EloadZ_iv(): expected 2141192192, got 2145386496.
  +float_memory-main.c:325: assertion failed: in Z_float_memory_1Z_i64Z2EloadZ_jv(): expected 9219994337134247936, got 9222246136947933184.
  +float_memory-main.c:370: assertion failed: in Z_float_memory_2Z_i32Z2EloadZ_iv(): expected 2141192192, got 2145386496.
  +float_memory-main.c:415: assertion failed: in Z_float_memory_3Z_i64Z2EloadZ_jv(): expected 9219994337134247936, got 9222246136947933184.
  +During handling of the above exception, another exception occurred:
  +Traceback (most recent call last):
  +  File "/builddir/build/BUILD/wabt-1.0.10/test/run-spec-wasm2c.py", line 413, in <module>
  +    sys.stderr.write(u'{0}\n'.format(e).encode('ascii', 'replace'))
  +TypeError: write() argument must be str, not bytes
  STDOUT MISMATCH:
  --- expected
  +++ actual
  @@ -1 +1 @@
  -60/60 tests passed.
  +56/60 tests passed.
- test/wasm2c/spec/float_misc.txt
  expected error code 0, got 1.
  STDERR MISMATCH:
  --- expected
  +++ actual
  @@ -0,0 +1,42 @@
  +Traceback (most recent call last):
  +  File "/builddir/build/BUILD/wabt-1.0.10/test/run-spec-wasm2c.py", line 407, in <module>
  +    sys.exit(main(sys.argv[1:]))
  +  File "/builddir/build/BUILD/wabt-1.0.10/test/run-spec-wasm2c.py", line 400, in main
  +    forward_stdout=True).RunWithArgs()
  +  File "/builddir/build/BUILD/wabt-1.0.10/test/utils.py", line 104, in RunWithArgs
  +    raise error
  +utils.Error: Error running "out/test/wasm2c/spec/float_misc/float_misc":
  +float_misc-main.c:257: assertion failed: in Z_float_misc_0Z_f64Z2EaddZ_ddd(1, 1.1102230246251568e-16): expected 1.0000000000000002, got 1.
  +float_misc-main.c:269: assertion failed: in Z_float_misc_0Z_f64Z2EaddZ_ddd(9.2233720368547758e+18, 1024.25): expected 9.2233720368547779e+18, got 9.2233720368547758e+18.
  +float_misc-main.c:275: assertion failed: in Z_float_misc_0Z_f64Z2EaddZ_ddd(9007199254740992, 1.0000100000000001): expected 4.4501477170144047e-308, got 9007199254740992.
  +float_misc-main.c:278: assertion failed: in Z_float_misc_0Z_f64Z2EaddZ_ddd(9007199254740994, 0.9999847412109375): expected 4.4501477170144047e-308, got 9007199254740996.
  +float_misc-main.c:383: assertion failed: in Z_float_misc_0Z_f64Z2EaddZ_ddd(-2.1089660532788995e+242, 5.8148323342119634e+248): expected 5.8148302252459106e+248, got 5.8148302252459096e+248.
  +float_misc-main.c:386: assertion failed: in Z_float_misc_0Z_f64Z2EaddZ_ddd(1.0231579266682148e+236, 4.5020430079749491e+224): expected 1.0231579266727168e+236, got 1.023157926672717e+236.
  +float_misc-main.c:389: assertion failed: in Z_float_misc_0Z_f64Z2EaddZ_ddd(-1.3052997857095656e+188, 1.5489943422018657e+203): expected 1.5489943422018645e+203, got 1.5489943422018643e+203.
  +float_misc-main.c:392: assertion failed: in Z_float_misc_0Z_f64Z2EaddZ_ddd(4.7629997434721684e+139, 4.5558645105825967e+155): expected 4.5558645105825967e+155, got 4.5558645105825976e+155.
  +float_misc-main.c:395: assertion failed: in Z_float_misc_0Z_f64Z2EaddZ_ddd(3.9589525165584138e-300, 2.3092460710062946e-290): expected 2.30924607140219e-290, got 2.3092460714021897e-290.
  +float_misc-main.c:491: assertion failed: in Z_float_misc_0Z_f64Z2EaddZ_ddd(1.7976931348623157e+308, 9.979201547673598e+291): expected 1.7976931348623157e+308, got inf.
  +float_misc-main.c:512: assertion failed: in Z_float_misc_0Z_f64Z2EsubZ_ddd(1, 5.5511151231257839e-17): expected 0.99999999999999989, got 1.
  +float_misc-main.c:605: assertion failed: in Z_float_misc_0Z_f64Z2EsubZ_ddd(5.8169880657930389e-24, 2.5021499241540866e-35): expected 5.8169880657680178e-24, got 5.816988065768017e-24.
  +float_misc-main.c:608: assertion failed: in Z_float_misc_0Z_f64Z2EsubZ_ddd(4.3336683304809554e-296, 1.6945582607476316e-304): expected 4.3336683135353726e-296, got 4.3336683135353731e-296.
  +float_misc-main.c:611: assertion failed: in Z_float_misc_0Z_f64Z2EsubZ_ddd(6.9080526763152571e-77, 1.2001773734799856e-60): expected -1.2001773734799856e-60, got -1.2001773734799854e-60.
  +float_misc-main.c:614: assertion failed: in Z_float_misc_0Z_f64Z2EsubZ_ddd(-2.2044291547443813e-12, -2.7947429925618632e-21): expected -2.2044291519496381e-12, got -2.2044291519496385e-12.
  +float_misc-main.c:617: assertion failed: in Z_float_misc_0Z_f64Z2EsubZ_ddd(4.0163935691177612e-08, 0.17053881989395447): expected -0.17053877973001877, got -0.1705387797300188.
  +float_misc-main.c:701: assertion failed: in Z_float_misc_0Z_f64Z2EsubZ_ddd(1.7976931348623157e+308, 9.979201547673598e+291): expected 1.7976931348623157e+308, got 1.7976931348623155e+308.
  +float_misc-main.c:728: assertion failed: in Z_float_misc_0Z_f64Z2EmulZ_ddd(1848874847, 19954562207): expected 3.6893488147419111e+19, got 3.6893488147419103e+19.
  +float_misc-main.c:827: assertion failed: in Z_float_misc_0Z_f64Z2EmulZ_ddd(4.4091927284399547e-103, 1.1518840702296592e-173): expected 5.0788788664624316e-276, got 5.0788788664624308e-276.
  +float_misc-main.c:830: assertion failed: in Z_float_misc_0Z_f64Z2EmulZ_ddd(-0.0029800418264724318, 6.3125412993218003e+217): expected -1.8811637103313594e+215, got -1.8811637103313598e+215.
  +float_misc-main.c:833: assertion failed: in Z_float_misc_0Z_f64Z2EmulZ_ddd(-3.0834457808130011e+110, -1.0081049555008529e-196): expected 3.1084369716557833e-86, got 3.1084369716557829e-86.
  +float_misc-main.c:836: assertion failed: in Z_float_misc_0Z_f64Z2EmulZ_ddd(3.4938750131567728e+233, 2.1313169159308099e+18): expected 7.4465549176890102e+251, got 7.4465549176890113e+251.
  +float_misc-main.c:839: assertion failed: in Z_float_misc_0Z_f64Z2EmulZ_ddd(-1.2500108005100234e-83, 1.0352657041604675e+270): expected -1.294093311598199e+187, got -1.2940933115981991e+187.
  +float_misc-main.c:1055: assertion failed: in Z_float_misc_0Z_f64Z2EdivZ_ddd(-2.0395956046834761e+176, -7.4740887394612257e+58): expected 2.7288886656040712e+117, got 2.7288886656040717e+117.
  +float_misc-main.c:1058: assertion failed: in Z_float_misc_0Z_f64Z2EdivZ_ddd(-3.0426171229468766e+164, -2.6556792326588243e+99): expected 1.1457020432022042e+65, got 1.145702043202204e+65.
  +float_misc-main.c:1061: assertion failed: in Z_float_misc_0Z_f64Z2EdivZ_ddd(4.9235240512480726e+55, -3.6634082831003669e+290): expected -1.3439736089369927e-235, got -1.3439736089369929e-235.
  +float_misc-main.c:1064: assertion failed: in Z_float_misc_0Z_f64Z2EdivZ_ddd(2.8926084355634162e+65, 5.1719487583733548e+128): expected 5.5928791461444777e-64, got 5.5928791461444784e-64.
  +float_misc-main.c:1067: assertion failed: in Z_float_misc_0Z_f64Z2EdivZ_ddd(-4.2154258234426861e+248, 1.4285058546706491e+105): expected -2.9509335293656034e+143, got -2.950933529365603e+143.
  +float_misc-main.c:1217: assertion failed: in Z_float_misc_0Z_f64Z2EdivZ_ddd(1, 0.99999999999999989): expected 1.0000000000000002, got 1.
  +During handling of the above exception, another exception occurred:
  +Traceback (most recent call last):
  +  File "/builddir/build/BUILD/wabt-1.0.10/test/run-spec-wasm2c.py", line 413, in <module>
  +    sys.stderr.write(u'{0}\n'.format(e).encode('ascii', 'replace'))
  +TypeError: write() argument must be str, not bytes
  STDOUT MISMATCH:
  --- expected
  +++ actual
  @@ -1 +1 @@
  -440/440 tests passed.
  +411/440 tests passed.
- test/wasm2c/spec/float_exprs.txt
  expected error code 0, got 1.
  STDERR MISMATCH:
  --- expected
  +++ actual
  @@ -0,0 +1,17 @@
  +Traceback (most recent call last):
  +  File "/builddir/build/BUILD/wabt-1.0.10/test/run-spec-wasm2c.py", line 407, in <module>
  +    sys.exit(main(sys.argv[1:]))
  +  File "/builddir/build/BUILD/wabt-1.0.10/test/run-spec-wasm2c.py", line 400, in main
  +    forward_stdout=True).RunWithArgs()
  +  File "/builddir/build/BUILD/wabt-1.0.10/test/utils.py", line 104, in RunWithArgs
  +    raise error
  +utils.Error: Error running "out/test/wasm2c/spec/float_exprs/float_exprs":
  +float_exprs-main.c:3133: assertion failed: in Z_float_exprs_87Z_f32Z2Enonarithmetic_nan_bitpatternZ_ii(2139107856u): expected 4286591504, got 4290785808.
  +float_exprs-main.c:3136: assertion failed: in Z_float_exprs_87Z_f32Z2Enonarithmetic_nan_bitpatternZ_ii(4286591504u): expected 2139107856, got 2143302160.
  +float_exprs-main.c:3163: assertion failed: in Z_float_exprs_87Z_f64Z2Enonarithmetic_nan_bitpatternZ_jj(9218868437227418128ull): expected 18442240474082193936, got 18444492273895879184.
  +float_exprs-main.c:3166: assertion failed: in Z_float_exprs_87Z_f64Z2Enonarithmetic_nan_bitpatternZ_jj(18442240474082193936ull): expected 9218868437227418128, got 9221120237041103376.
  +During handling of the above exception, another exception occurred:
  +Traceback (most recent call last):
  +  File "/builddir/build/BUILD/wabt-1.0.10/test/run-spec-wasm2c.py", line 413, in <module>
  +    sys.stderr.write(u'{0}\n'.format(e).encode('ascii', 'replace'))
  +TypeError: write() argument must be str, not bytes
  STDOUT MISMATCH:
  --- expected
  +++ actual
  @@ -1 +1 @@
  -794/794 tests passed.
  +790/794 tests passed.
...
**** FAILED ******************************************************************
- test/interp/unary.txt
    /builddir/build/BUILD/wabt-1.0.10/bin/wasm-interp out/test/interp/unary/unary.wasm --run-all-exports
- test/wasm2c/spec/conversions.txt
    /usr/bin/python3 /builddir/build/BUILD/wabt-1.0.10/test/run-spec-wasm2c.py out/test/wasm2c/spec/conversions.wast --bindir=/builddir/build/BUILD/wabt-1.0.10/bin --no-error-cmdline -o out/test/wasm2c/spec/conversions
- test/wasm2c/spec/float_literals.txt
    /usr/bin/python3 /builddir/build/BUILD/wabt-1.0.10/test/run-spec-wasm2c.py out/test/wasm2c/spec/float_literals.wast --bindir=/builddir/build/BUILD/wabt-1.0.10/bin --no-error-cmdline -o out/test/wasm2c/spec/float_literals
- test/wasm2c/spec/float_memory.txt
    /usr/bin/python3 /builddir/build/BUILD/wabt-1.0.10/test/run-spec-wasm2c.py out/test/wasm2c/spec/float_memory.wast --bindir=/builddir/build/BUILD/wabt-1.0.10/bin --no-error-cmdline -o out/test/wasm2c/spec/float_memory
- test/wasm2c/spec/float_misc.txt
    /usr/bin/python3 /builddir/build/BUILD/wabt-1.0.10/test/run-spec-wasm2c.py out/test/wasm2c/spec/float_misc.wast --bindir=/builddir/build/BUILD/wabt-1.0.10/bin --no-error-cmdline -o out/test/wasm2c/spec/float_misc
- test/wasm2c/spec/float_exprs.txt
    /usr/bin/python3 /builddir/build/BUILD/wabt-1.0.10/test/run-spec-wasm2c.py out/test/wasm2c/spec/float_exprs.wast --bindir=/builddir/build/BUILD/wabt-1.0.10/bin --no-error-cmdline -o out/test/wasm2c/spec/float_exprs

I suspect all but the first are due to lower float precision.

@binji
Copy link
Member

binji commented Mar 15, 2019

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?

@rathann
Copy link
Contributor Author

rathann commented Mar 15, 2019

This is on Fedora rawhide (development branch).

gcc version 9.0.1 20190312 (Red Hat 9.0.1-0.10) (GCC) 

@rathann
Copy link
Contributor Author

rathann commented Apr 15, 2019

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

@rathann
Copy link
Contributor Author

rathann commented Apr 15, 2019

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

@binji
Copy link
Member

binji commented Apr 15, 2019

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.

@binji
Copy link
Member

binji commented Apr 15, 2019

Testing w/ gcc in Compiler Explorer seems to produce the correct value too (negative zero).

@rathann
Copy link
Contributor Author

rathann commented Apr 17, 2019

I don't know how faithful Compiler Explorer is and I'm no compiler expert. Two things may explain the difference:

  1. Fedora's gcc is patched.
  2. You didn't use the same CXXFLAGS.

I'm only guessing though. The issue is 100% reproducible on Fedora 29.

@rathann
Copy link
Contributor Author

rathann commented Apr 19, 2019

I did some more builds and it looks like it's reproducible on Fedora 30 with gcc-9.0.1, too.

@binji
Copy link
Member

binji commented Apr 19, 2019

Thanks for the info -- I'll get an image to test against.

@rathann
Copy link
Contributor Author

rathann commented Sep 12, 2019

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.

@binji
Copy link
Member

binji commented Sep 25, 2019

Thanks for the update @rathann.

@rathann
Copy link
Contributor Author

rathann commented May 6, 2020

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.

@rathann rathann changed the title 6 test failures on x86 32bit (i686) test failures on x86 32bit (i686) Aug 8, 2021
@rathann
Copy link
Contributor Author

rathann commented Aug 8, 2021

Still reproducible with 1.0.23 on Fedora rawhide. Same 10 failures are occurring.

@rathann
Copy link
Contributor Author

rathann commented Feb 8, 2022

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?

@rathann
Copy link
Contributor Author

rathann commented Nov 16, 2022

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.

@rathann
Copy link
Contributor Author

rathann commented May 25, 2023

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.

@turbolent
Copy link

I'm seeing similar errors in https://github.com/turbolent/w2c2. Has anyone investigated why these tests fail?

@keithw
Copy link
Member

keithw commented Jul 24, 2023

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.

@sbc100
Copy link
Member

sbc100 commented Jul 24, 2023

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

@rathann
Copy link
Contributor Author

rathann commented Jul 25, 2023

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.

@keithw
Copy link
Member

keithw commented Jul 25, 2023

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... :-/

@rathann
Copy link
Contributor Author

rathann commented Jul 26, 2023

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.

@rathann
Copy link
Contributor Author

rathann commented Sep 11, 2024

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 "")
    ^^^^^^

@rathann
Copy link
Contributor Author

rathann commented Sep 13, 2024

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.

@kapouer
Copy link

kapouer commented Feb 17, 2025

Just got the same issue on debian wabt package, and
export WASM2C_CFLAGS:=-msse2 -mfpmath=sse
did not fix test/regress/empty-quoted-module.txt, but fixed the other failures like

- test/harness/wasm2c/simd_formatting.txt
  STDERR MISMATCH:
  --- expected
  +++ actual
  @@ -1 +1,28 @@
  -simd_formatting.txt:6: assertion failed: in w2c_simd__formatting__0__wasm_x(&simd__formatting__0__wasm_instance, v128_i8x16_make(0u,1u,2u,3u,4u,5u,6u,7u,8u,9u,10u,11u,12u,13u,14u,15u)): expected <255 254 253 252 251 250 249 248 247 246 245 244 243 242 241 240 >, got <0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 >.
  +out/test/harness/wasm2c/simd_formatting/simd_formatting.0.c: In function ‘v128_load’:
  +out/test/harness/wasm2c/simd_formatting/simd_formatting.0.c:755:1: error: SSE vector return without SSE enabled changes the ABI [-Werror=psabi]
  +  755 | DEFINE_SIMD_LOAD_FUNC(v128_load, simde_wasm_v128_load, v128)
  +      | ^~~~~~~~~~~~~~~~~~~~~
  +out/test/harness/wasm2c/simd_formatting/simd_formatting.0.c: In function ‘w2c_simd__formatting__0__wasm_x’:
  +out/test/harness/wasm2c/simd_formatting/simd_formatting.0.c:1045:6: note: the ABI for passing parameters with 16-byte alignment has changed in GCC 4.6
  + 1045 | v128 w2c_simd__formatting__0__wasm_x(w2c_simd__formatting__0__wasm* instance, v128 var_p0) {
  +      |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  +out/test/harness/wasm2c/simd_formatting/simd_formatting.0.c:1045:6: error: SSE vector argument without SSE enabled changes the ABI [-Werror=psabi]
  +At top level:
  +cc1: note: unrecognized command-line option ‘-Wno-pass-failed’ may have been intended to silence earlier diagnostics
  +cc1: note: unrecognized command-line option ‘-Wno-tautological-constant-out-of-range-compare’ may have been intended to silence earlier diagnostics
  +cc1: note: unrecognized command-line option ‘-Wno-ignored-optimization-argument’ may have been intended to silence earlier diagnostics
  +cc1: all warnings being treated as errors
  +Traceback (most recent call last):
  +  File "/<<PKGBUILDDIR>>/test/run-spec-wasm2c.py", line 665, in <module>
  +    sys.exit(main(sys.argv[1:]))
  +             ~~~~^^^^^^^^^^^^^^
  +  File "/<<PKGBUILDDIR>>/test/run-spec-wasm2c.py", line 630, in main
  +    o_filenames.append(Compile(cc, c_filename, out_dir, use_c11, *cflags))
  +                       ~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  +  File "/<<PKGBUILDDIR>>/test/run-spec-wasm2c.py", line 483, in Compile
  +    cc.RunWithArgsForStdout(*args)
  +    ~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^
  +  File "/<<PKGBUILDDIR>>/test/utils.py", line 87, in RunWithArgsForStdout
  +    raise error
  +utils.Error: Error running "/usr/bin/cc '-I/<<PKGBUILDDIR>>/wasm2c' '-I/<<PKGBUILDDIR>>/third_party/simde' -std=c99 -c out/test/harness/wasm2c/simd_formatting/simd_formatting.0.c -o out/test/harness/wasm2c/simd_formatting/simd_formatting.0.o -O2 -Wall -Werror -Wno-unused -Wno-array-bounds -Wno-ignored-optimization-argument -Wno-tautological-constant-out-of-range-compare -Wno-infinite-recursion -Wno-pass-failed -fno-optimize-sibling-calls -frounding-math -fsignaling-nans -D_DEFAULT_SOURCE" (1):

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants