Describe the bug
dictionary tests fail on i586 and s390x
To Reproduce
Steps to reproduce the behavior:
Expected behavior
tests should pass the same way they did in 1.4.5
Screenshots and charts
build log:
``` ===> dictionary tests
^Mdictionary training failed : Error (generic)
make: * [Makefile:330: test-zstd] Error 1
```
Desktop:
-O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -Werror=return-type -flto=auto -ffat-lto-objectsAdditional context
Current build logs can be found at
https://build.opensuse.org/package/live_build_log/Archiving/zstd/openSUSE_Factory/i586
On openSUSE we compile both the library and the tests with some flags and turns out, if you do
export CFLAGS="-O2 -fstack-protector"
export CXXFLAGS="-O2 -fstack-protector"
make -C tests test-zstd
test will crash on i586 and s390x, removing -fstack-protector fixes the crash, didn't do a git bisect yet.
Did a git bisect and https://github.com/facebook/zstd/commit/a90779397ad6372429188253eb00ed4c39f34912 is the commit that caused this.
Thanks for the report @bmwiedemann .
The issue is confirmed on 32-bit systems, and also confirmed the exact commit involved (thanks @ismail !).
Investigation ongoing...
Will there be a v1.4.8 hotfix for this?
OK, so this was an alignment issue on one internal buffer. Thanks @terrelln for the fix !
In many cases, this issue is inconsequential, either because unalignment is not possible due to compiler decision,
or simply because the cpu doesn't care about unalignment.
In this case, x86 32-bit doesn't care about alignment, but the code does, and returns an alignment error.
That's because it could become an issue when alignment _must_ be strictly respected, such as for MIPS or older ARM designs for example.
Even though the "damage" seems limited (x64 and arm64 targets are safe), it probably deserves a hotfix.
Most helpful comment
Did a git bisect and https://github.com/facebook/zstd/commit/a90779397ad6372429188253eb00ed4c39f34912 is the commit that caused this.