v icon indicating copy to clipboard operation
v copied to clipboard

compress/zstd test failed under clang20 on Alpine

Open tankf33der opened this issue 5 months ago • 2 comments
trafficstars

Describe the bug

if i run tests with -cc clang they fails only in vlib/compress/zstd so far.

Reproduction Steps

# clang --version
Alpine clang version 20.1.6
Target: x86_64-alpine-linux-musl
Thread model: posix
InstalledDir: /usr/lib/llvm20/bin
Configuration file: /etc/clang20/x86_64-alpine-linux-musl.cfg
# cd v
# ./v -cc clang test vlib/compress/zstd 

Expected Behavior

all passed.

Current Behavior

...
...
...
 FAIL  [7/7] C:  9511.0 ms, R:     0.000 ms vlib/compress/zstd/zstd_test.v
>> compilation failed:
================== C compilation error (from clang): ==============
cc: In file included from /tmp/v_0/tsession_148a73810b28_01JXM4VXGJ28FY1ZN7V3ERQAX7/zstd_test.01JXM4W3W0T3F049TPKGG6VQ10.tmp.c:1109:
cc: /root/v/thirdparty/zstd/zstd.c:47446:11: error: incompatible function pointer types passing 'int (*)(const void *, const void *, void *)' to parameter of type 'int (*)(const void *, const void *)' [-Wincompatible-function-pointer-types]
cc:  47446 |           (ctx->d <= 8 ? &COVER_strict_cmp8 : &COVER_strict_cmp));
cc:        |           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc: /usr/include/stdlib.h:58:43: note: passing argument to parameter here
cc:    58 | void qsort (void *, size_t, size_t, int (*)(const void *, const void *));
cc:       |                                           ^
cc: /tmp/v_0/tsession_148a73810b28_01JXM4VXGJ28FY1ZN7V3ERQAX7/zstd_test.01JXM4W3W0T3F049TPKGG6VQ10.tmp.c:11675:30: warning: incompatible pointer types passing 'struct ZSTD_CCtx *' to parameter of type 'ZSTD_CCtx *' (aka 'struct ZSTD_CCtx_s *') [-Wincompatible-pointer-types]
cc:  11675 |         usize size = ZSTD_compress2(cctx->ctx, dst.data, dst.len, data.data, data.len);
cc:        |                                     ^~~~~~~~~
cc: /root/v/thirdparty/zstd/zstd.c:29543:34: note: passing argument to parameter 'cctx' here
cc:  29543 | size_t ZSTD_compress2(ZSTD_CCtx* cctx,
...
cc: 16 warnings and 1 error generated.
(note: the original output was 89 lines long; it was truncated to its first 12 lines + the last line)
===================================================================
(You can pass `-cg`, or `-show-c-output` as well, to print all the C error messages).
builder error: 
==================
C error found. It should never happen, when compiling pure V code.
This is a V compiler bug, please report it using `v bug file.v`,
or goto https://github.com/vlang/v/issues/new/choose .
You can also use #help on Discord: https://discord.gg/vlang .

Possible Solution

No response

Additional Information/Context

No response

V version

latest

Environment details (OS name and version, etc.)

Alpine Linux v3.22

|V full version      |V 0.4.10 4dc66e2675668abc4929b28139e41458ed09206c.99c39ab
|:-------------------|:-------------------
|OS                  |linux, N/A
|Processor           |20 cpus, 64bit, little endian, 13th Gen Intel(R) Core(TM) i5-13500
|Memory              |15.97GB/62.61GB
|                    |
|V executable        |/root/v/v
|V last modified time|2025-06-13 07:21:37
|                    |
|V home dir          |OK, value: /root/v
|VMODULES            |OK, value: /root/.vmodules
|VTMP                |OK, value: /tmp/v_0
|Current working dir |OK, value: /root/v
|                    |
|Git version         |git version 2.49.0
|V git status        |weekly.2025.24-17-g99c39ab8
|.git/config present |true
|                    |
|cc version          |cc (Alpine 14.2.0) 14.2.0
|gcc version         |gcc (Alpine 14.2.0) 14.2.0
|clang version       |Alpine clang version 20.1.6
|tcc version         |tcc version 0.9.27 mob:d3e940c (x86_64 Linux)
|tcc git status      |thirdparty-linuxmusl-amd64 a3e24da2
|emcc version        |N/A
|glibc version       |Error: musl libc (x86_64)
Version 1.2.5
Dynamic Program Loader
Usage: /lib/ld-musl-x86_64.so.1 [options] [--] pathname

[!NOTE] You can use the 👍 reaction to increase the issue's priority for developers.

Please note that only the 👍 reaction to the issue itself counts as a vote. Other reactions and those to comments will not be taken into account.

tankf33der avatar Jun 13 '25 08:06 tankf33der

Connected to Huly®: V_0.6-23065

huly-for-github[bot] avatar Jun 13 '25 08:06 huly-for-github[bot]

BTW,

tcc - ok gcc 14.2 - ok

update from freebsd: gcc15.10 - ok clang20 - ok clang21 - ok

tankf33der avatar Jun 13 '25 08:06 tankf33der

It may due to the qsort problem as figure out in PR #24611

kbkpbot avatar Jun 27 '25 13:06 kbkpbot