zlib-ng: 2.1.2 seems to fail tests on ppc64le with musl libc
1/67 Test #1: example ..........................***Failed 0.19 sec
zlib-ng version 2.1.2 = 0x020102f0, compile flags = 0xa9
uncompress error: -3
Start 65: makecrct
2/67 Test #2: infcover ......................... Passed 0.19 sec
Start 66: makefixed
3/67 Test #3: CVE-2002-0059 .................... Passed 0.19 sec
Start 67: maketrees
4/67 Test #4: CVE-2004-0797 .................... Passed 0.19 sec
5/67 Test #5: CVE-2005-1849 .................... Passed 0.19 sec
6/67 Test #6: CVE-2005-2096 .................... Passed 0.19 sec
7/67 Test #7: CVE-2018-25032-fixed-level-6 ..... Passed 0.19 sec
8/67 Test #8: CVE-2018-25032-default-level-6 ...***Failed 0.19 sec
-- Compress /home/buildozer/aports/community/zlib-ng/src/zlib-ng-2.1.2/build/minideflate;-c;-k;-m;1;-w;-15;-s;4;-6
-- Source file: /home/buildozer/aports/community/zlib-ng/src/zlib-ng-2.1.2/test/CVE-2018-25032/default.txt
-- Compression input file: /home/buildozer/aports/community/zlib-ng/src/zlib-ng-2.1.2/build/test/Testing/Temporary/default-txt-Czzxhg
-- Output: /home/buildozer/aports/community/zlib-ng/src/zlib-ng-2.1.2/build/test/Testing/Temporary/default-txt-Czzxhg.gz
-- Decompress /home/buildozer/aports/community/zlib-ng/src/zlib-ng-2.1.2/build/minideflate;-c;-k;-d;-m;1;-w;-15;-6
-- Input: /home/buildozer/aports/community/zlib-ng/src/zlib-ng-2.1.2/build/test/Testing/Temporary/default-txt-Czzxhg.gz
-- Output: /home/buildozer/aports/community/zlib-ng/src/zlib-ng-2.1.2/build/test/Testing/Temporary/default-txt-Czzxhg
-- Diff comparison
-- Input: /home/buildozer/aports/community/zlib-ng/src/zlib-ng-2.1.2/test/CVE-2018-25032/default.txt
-- Output: /home/buildozer/aports/community/zlib-ng/src/zlib-ng-2.1.2/build/test/Testing/Temporary/default-txt-Czzxhg
-- Diff:
--- /home/buildozer/aports/community/zlib-ng/src/zlib-ng-2.1.2/test/CVE-2018-25032/default.txt.hex
+++ /home/buildozer/aports/community/zlib-ng/src/zlib-ng-2.1.2/build/test/Testing/Temporary/default-txt-Czzxhg.hex
@@ -2302,7 +2302,7 @@
00008fd0: 554f 434f 4f41 534d 484a 5844 5343 5943 UOCOOASMHJXDSCYC
00008fe0: 4258 555a 4752 5450 4b4a 4a43 5343 434b BXUZGRTPKJJCSCCK
00008ff0: 4559 4b44 4f59 4f52 4a4d 444f 534e 5754 EYKDOYORJMDOSNWT
-00009000: 4a56 5755 4a4b 5359 5244 434d 4c56 4f47 JVWUJKSYRDCMLVOG
+00009000: 4a56 5755 4a4b 5359 4244 434d 4c56 4f47 JVWUJKSYBDCMLVOG
00009010: 5047 4d59 4a45 5246 5142 4759 4e5a 544c PGMYJERFQBGYNZTL
00009020: 4159 5346 4e51 534f 514b 5344 4844 5541 AYSFNQSOQKSDHDUA
00009030: 5942 494f 4756 4c52 4e43 5955 4651 4f42 YBIOGVLRNCYUFQOB
@@ -2310,7 +2310,7 @@
00009050: 4f43 4f4f 4153 4d48 4a58 4453 4359 4342 OCOOASMHJXDSCYCB
00009060: 5855 5a47 5254 504b 4a4a 4353 4343 4b45 XUZGRTPKJJCSCCKE
00009070: 594b 444f 594f 524a 4d44 4f53 4e57 544a YKDOYORJMDOSNWTJ
-00009080: 5657 554a 4b53 5942 5952 4443 4d4c 564f VWUJKSYBYRDCMLVO
+00009080: 5657 554a 4b53 5942 5942 4443 4d4c 564f VWUJKSYBYBDCMLVO
00009090: 4750 474d 594a 4552 4651 4247 594e 5a54 GPGMYJERFQBGYNZT
000090a0: 4c41 5953 464e 5153 4f51 4b53 4448 4455 LAYSFNQSOQKSDHDU
000090b0: 4159 4249 4f47 564c 524e 4359 5546 514f AYBIOGVLRNCYUFQO
@@ -2420,7 +2420,7 @@
00009730: 4b4a 4a43 5343 434b 4559 4b44 4f59 4f52 KJJCSCCKEYKDOYOR
00009740: 4a4d 444f 534e 5754 4a56 5755 4a4b 5359 JMDOSNWTJVWUJKSY
00009750: 4251 574c 494d 4e56 5549 5944 4848 4543 BQWLIMNVUIYDHHEC
-00009760: 5047 4b56 4650 5246 5951 4952 544d 4f59 PGKVFPRFYQIRTMOY
+00009760: 5047 4b5a 4650 5246 5951 4952 544d 4f59 PGKZFPRFYQIRTMOY
00009770: 5244 434d 4c56 4f47 5047 4d59 4a45 5246 RDCMLVOGPGMYJERF
00009780: 5142 4759 4e5a 544c 4159 5346 4e51 534f QBGYNZTLAYSFNQSO
00009790: 514b 5344 4844 5541 5942 494f 4756 4c52 QKSDHDUAYBIOGVLR
@@ -2712,7 +2712,7 @@
0000a970: 4841 4c43 515a 4149 5752 5044 4159 474e HALCQZAIWRPDAYGN
0000a980: 5a44 4b4d 5449 4645 4a48 5154 454d 4959 ZDKMTIFEJHQTEMIY
0000a990: 5641 525a 4a52 5755 4444 584b 4d47 5555 VARZJRWUDDXKMGUU
-0000a9a0: 5142 5748 5a4e 5743 4a55 4742 4d57 5552 QBWHZNWCJUGBMWUR
+0000a9a0: 5142 5748 5a4e 5743 4a46 4742 4d57 5552 QBWHZNWCJFGBMWUR
0000a9b0: 4344 4b48 4645 4542 4c52 5644 5546 4f41 CDKHFEEBLRVDUFOA
0000a9c0: 5241 4f46 4b58 4645 5359 4e59 524b 534d RAOFKXFESYNYRKSM
0000a9d0: 4c42 5551 5954 434a 534c 4849 4847 4d50 LBUQYTCJSLHIHGMP
@@ -2726,7 +2726,7 @@
0000aa50: 515a 4149 5752 5044 4159 474e 5a44 4b4d QZAIWRPDAYGNZDKM
0000aa60: 5449 4645 4a48 5154 454d 4959 5641 525a TIFEJHQTEMIYVARZ
0000aa70: 4a52 5755 4444 584b 4d47 5555 5142 5748 JRWUDDXKMGUUQBWH
-0000aa80: 5a4e 5743 4a46 4351 5454 4855 4742 4d57 ZNWCJFCQTTHUGBMW
+0000aa80: 5a4e 5743 4a46 4351 5454 4846 4742 4d57 ZNWCJFCQTTHFGBMW
0000aa90: 5552 4344 4b48 4645 4542 4c52 5644 5546 URCDKHFEEBLRVDUF
0000aaa0: 4f41 5241 4f46 4b58 4645 5359 4e59 524b OARAOFKXFESYNYRK
0000aab0: 534d 4c42 5551 5954 434a 534c 4849 4847 SMLBUQYTCJSLHIHG
@@ -2811,7 +2811,7 @@
0000afa0: 4449 4841 4c43 515a 4149 5752 5044 4159 DIHALCQZAIWRPDAY
0000afb0: 474e 5a44 4b4d 5449 4645 4a48 5154 454d GNZDKMTIFEJHQTEM
0000afc0: 4959 5641 525a 4a52 5755 4444 584b 4d47 IYVARZJRWUDDXKMG
-0000afd0: 5555 5142 5748 5a4e 5743 4a46 4351 5455 UUQBWHZNWCJFCQTU
+0000afd0: 5555 5142 5748 5a4e 5743 4a46 4351 5454 UUQBWHZNWCJFCQTT
0000afe0: 545a 4141 5848 5547 424d 5755 5243 444b TZAAXHUGBMWURCDK
0000aff0: 4846 4545 424c 5256 4455 464f 4152 414f HFEEBLRVDUFOARAO
0000b000: 464b 5846 4553 594e 5952 4b53 4d4c 4255 FKXFESYNYRKSMLBU
@@ -2994,7 +2994,7 @@
0000bb10: 554e 5951 4b45 4149 434d 464f 5959 4c44 UNYQKEAICMFOYYLD
0000bb20: 524a 5158 434b 5155 494c 4249 5452 4843 RJQXCKQUILBITRHC
0000bb30: 5553 514d 434e 5344 4443 4c4d 5952 5149 USQMCNSDDCLMYRQI
-0000bb40: 4944 4155 4b4e 5857 4659 5250 484b 4450 IDAUKNXWFYRPHKDP
+0000bb40: 4144 4155 4b4e 5857 4659 5250 484b 4450 ADAUKNXWFYRPHKDP
0000bb50: 5748 4143 5147 5146 4c43 4454 5858 5a4b WHACQGQFLCDTXXZK
0000bb60: 5944 4744 4450 4f42 5357 454d 5041 4156 YDGDDPOBSWEMPAAV
0000bb70: 4643 4558 514a 4443 424f 5a49 5253 4f57 FCEXQJDCBOZIRSOW
CMake Error at /home/buildozer/aports/community/zlib-ng/src/zlib-ng-2.1.2/test/cmake/compress-and-verify.cmake:195 (message):
Compare decompress failed: 1
(…)
About this issue
- Original URL
- State: open
- Created a year ago
- Comments: 53 (22 by maintainers)
Instead of preprocessor checks, CMake/Configure could have a test that verifies what intrinsic to use. Of course cross-compiles might have to fall back to inline ASM just to be sure. Inline ASM might prohibit the compilers optimizer from doing some of its job.
Yeah so I know what happened here and I’m not exactly sure I agree with GCC’s decision. It’s just a question of what we do for the workaround now.
Semantically, the “LSBB” here means least significant bits (byte vector variant). Because they say “least significant”, they are changing from which end bytes are being counted depending on endianness. Now, for a __builtin function, ok that might be understandable, but the “vec_cntlz_lsbb” intrinsic they also flip it around just like the builtin, too.
Usually when we use intrinsics, they are supposed to closely translate to (often producing the same) instruction with the same mnemonics. And the instruction is defined such that it’s cntlz or cnttz and it will do whatever in the native byte order. You would think an intrinsic that closely matches the instruction name would produce that instruction, not flip the direction if a different endianness.
So essentially, on GCC’s prior to 12, __builtin_vec_vctzlsbb generated the
vclzlsbb
instruction, regardless of endianness and vice versa. Now, on GCC >= 12, it generates:vclzlsbb
on big endian andvctzlsbb
on little.There’s a million ways to fix this but I’m not sure what the best way to fix it is. It’s not great that we have to constantly work around how GCC wants to emit instructions for this. The current suggested, (maybe best?) is to just use the GNU style inline assembly regardless. The other way involves a whole maze of preprocessor macros to detect if GCC or Clang (yeah I don’t even know what clang does for this yet), and if old enough, then switch the intrinsic or otherwise just use leading zero, and if old enough to not support the intrinsic, then use the inline asm as well?