v
v copied to clipboard
Self tests failed with Clang and prod flag
Describe the bug
Using Clang 16 with prod flag, some tests failed during self-test
Same types of errors with Clang16 + flag prod on Linux/amd64 and OpenBSD/amd64
Reproduction Steps
- Build V from sources on Linux/amd64 and OpenBSD/amd64
- Run self-tests with
clang+prodmode :VTEST_JUST_ESSENTIAL=1 ./v -prod -cc clang test-self
Expected Behavior
No error for self-test with Clang + prod mode
Current Behavior
- NOK: Errors with Clang with
prodon Linux/amd64
$ clang --version
Debian clang version 16.0.6 (27+b1)
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
$ VTEST_JUST_ESSENTIAL=1 ./v -prod -cc clang test-self
(...)
Failed command 1: '/home/fox/dev/vlang.git/v' -skip-running -prod -cc clang -o '/tmp/v_1000/tsession_7f0bb2120740_01J80HK1QSW5BEPH821NJWPWWP/64_6/program_test' '/home/fox/dev/vlang.git/vlib/v/gen/js/program_test.v'
Failed command 2: '/home/fox/dev/vlang.git/v' -skip-running -prod -cc clang -o '/tmp/v_1000/tsession_7f0bb2120740_01J80HK1QSW5BEPH821NJWPWWP/60_1/interpret_test' '/home/fox/dev/vlang.git/vlib/v/eval/interpret_test.v'
Failed command 3: '/home/fox/dev/vlang.git/v' -skip-running -prod -cc clang -o '/tmp/v_1000/tsession_7f0bb2120740_01J80HK1QSW5BEPH821NJWPWWP/58_2/compiler_errors_test' '/home/fox/dev/vlang.git/vlib/v/compiler_errors_test.v'
Failed command 4: '/home/fox/dev/vlang.git/v' -skip-running -prod -cc clang -o '/tmp/v_1000/tsession_7f0bb2120740_01J80HK1QSW5BEPH821NJWPWWP/68_2/compiler_test' '/home/fox/dev/vlang.git/vlib/v/slow_tests/inout/compiler_test.v'
Summary for testing: cmd, vlib: 4 failed, 66 passed, 70 total. Elapsed time: 323615 ms, on 7 parallel jobs.
WARNING: failed 4 times.
- OK: No error with Clang without
prodon Linux/amd64
$ $ VTEST_JUST_ESSENTIAL=1 ./v -cc clang test-self
(...)
Summary for testing: cmd, vlib: 70 passed, 70 total. Elapsed time: 116879 ms, on 7 parallel jobs.
- NOK: Errors with Clang with
prodon OpenBSD/amd64
$ VTEST_JUST_ESSENTIAL=1 ./v -prod -cc clang test-self
(...)
Failed command 1: '/home/fox/dev/vlang.git/v' -skip-running -prod -cc clang -o '/tmp/v_1000/tsession_2e14c3698_01J80J01Q168Y07VYSZ88B4NJZ/33_0/server_test' '/home/fox/dev/vlang.git/vlib/net/http/server_test.v'
Failed command 2: '/home/fox/dev/vlang.git/v' -skip-running -prod -cc clang -o '/tmp/v_1000/tsession_2e14c3698_01J80J01Q168Y07VYSZ88B4NJZ/58_0/compiler_errors_test' '/home/fox/dev/vlang.git/vlib/v/compiler_errors_test.v'
Failed command 3: '/home/fox/dev/vlang.git/v' -skip-running -prod -cc clang -o '/tmp/v_1000/tsession_2e14c3698_01J80J01Q168Y07VYSZ88B4NJZ/63_0/coutput_test' '/home/fox/dev/vlang.git/vlib/v/gen/c/coutput_test.v'
Failed command 4: '/home/fox/dev/vlang.git/v' -skip-running -prod -cc clang -o '/tmp/v_1000/tsession_2e14c3698_01J80J01Q168Y07VYSZ88B4NJZ/64_0/program_test' '/home/fox/dev/vlang.git/vlib/v/gen/js/program_test.v'
Failed command 5: '/home/fox/dev/vlang.git/v' -skip-running -prod -cc clang -o '/tmp/v_1000/tsession_2e14c3698_01J80J01Q168Y07VYSZ88B4NJZ/68_0/compiler_test' '/home/fox/dev/vlang.git/vlib/v/slow_tests/inout/compiler_test.v'
Summary for testing: cmd, vlib: 5 failed, 65 passed, 70 total. Elapsed time: 1719536 ms, on 1 job.
WARNING: failed 5 times.
=> same errors than on Linux/amd64 (+ test failed for vlib/net/http/server_test.v already known on OpenBSD/amd64, see issue #22126)
- NOK: Errors with Clang without
prodon OpenBSD/amd64
$ VTEST_JUST_ESSENTIAL=1 ./v -cc clang test-self
(...)
Failed command 1: '/home/fox/dev/vlang.git/v' -skip-running -cc clang -o '/tmp/v_1000/tsession_2dfced698_01J822TVBN15BJ9CF6RDRPPHZ4/33_0/server_test' '/home/fox/dev/vlang.git/vlib/net/http/server_test.v'
Failed command 2: '/home/fox/dev/vlang.git/v' -skip-running -cc clang -o '/tmp/v_1000/tsession_2dfced698_01J822TVBN15BJ9CF6RDRPPHZ4/58_0/compiler_errors_test' '/home/fox/dev/vlang.git/vlib/v/compiler_errors_test.v'
Failed command 3: '/home/fox/dev/vlang.git/v' -skip-running -cc clang -o '/tmp/v_1000/tsession_2dfced698_01J822TVBN15BJ9CF6RDRPPHZ4/63_0/coutput_test' '/home/fox/dev/vlang.git/vlib/v/gen/c/coutput_test.v'
Summary for testing: cmd, vlib: 3 failed, 67 passed, 70 total. Elapsed time: 1257632 ms, on 1 job.
WARNING: failed 3 times.
=> 2 errors for vlib/v/compiler_errors_test.v and vlib/v/gen/c/coutput_test.v (+ test failed for vlib/net/http/server_test.v already known on OpenBSD/amd64, see issue #22126)
Possible Solution
No response
Additional Information/Context
No response
V version
V 0.4.7 c0f7244
Environment details (OS name and version, etc.)
V full version: V 0.4.7 c0f7244 OS: linux, Debian GNU/Linux trixie/sid Processor: 8 cpus, 64bit, little endian, Intel(R) Core(TM) i7-4770 CPU @ 3.40GHz
getwd: /home/fox/dev/vlang.git vexe: /home/fox/dev/vlang.git/v vexe mtime: 2024-09-18 07:58:16
vroot: OK, value: /home/fox/dev/vlang.git VMODULES: OK, value: /home/fox/.vmodules VTMP: OK, value: /tmp/v_1000
Git version: git version 2.45.2 Git vroot status: weekly.2024.37-17-gc0f72446 .git/config present: true
CC version: cc (Debian 14.2.0-3) 14.2.0 thirdparty/tcc status: thirdparty-linux-amd64 0134e9b9
[!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.
I also find that at least 6 tests fail (with Clang 18.1.8):
Command used:
env VTEST_JUST_ESSENTIAL=1 CFLAGS="-O2 -pipe" LDFLAGS="-fuse-ld=mold -pie -Wl,-O2,--sort-common,--as-needed,-z,relro,-z,now" VFLAGS="-color -cc clang-18" ~/.local/vlang/v -prod test-self
Namely:
vlib/builtin/map_test.vvlib/os/glob_test.vvlib/v/gen/js/program_test.vvlib/v/slow_tests/inout/compiler_test.vvlib/v/compiler_errors_test.vvlib/v/gen/c/coutput_test.v
V full version: V 0.4.8 6e9a66d
OS: linux, "Gentoo Linux"
Processor: 16 cpus, 64bit, little endian, AMD Ryzen 7 3700X 8-Core Processor
getwd: /home/username
vexe: /home/username/.local/vlang/v
vexe mtime: 2024-10-29 23:52:24
vroot: OK, value: /home/username/.local/vlang
VMODULES: OK, value: /home/username/.vmodules
VTMP: OK, value: /tmp/v_1000
Git version: git version 2.45.2
Git vroot status: Error: fatal: not a git repository (or any of the parent directories): .git <-- (This because I moved V to ~/.local/vlang)
.git/config present: false
CC version: cc (Gentoo Hardened 13.3.1_p20240614 p17) 13.3.1 20240614 <-- (This is returning GCC because Gentoo symlinks it)
thirdparty/tcc status: thirdparty-linux-amd64 0134e9b9
Worked for me on Linux, except for 2 tests that need to be updated to latest V syntax:
$ VTEST_JUST_ESSENTIAL=1 ./v -prod -cc clang test-self
---- testing: cmd, vlib --------------------------------------------------------------------------------------------------------------------
FAIL [ 1/69] C: 712.8 ms, R: 0.000 ms /home/jalon/git/v/vlib/builtin/map_test.v
>> compilation failed:
vlib/builtin/map_test.v:214:12: error: accessing a pointer map value requires an `or {}` block outside `unsafe`
212 | mut m14 := map[string]voidptr{}
213 | m14['test'] = unsafe { nil }
214 | assert m14['test'] == unsafe { nil }
| ~~~~~~~~
215 | mut m15 := map[string]&u8{}
216 | m15['test'] = &u8(0)
vlib/builtin/map_test.v:214:12: error: accessing map value that contain pointers requires an `or {}` block outside `unsafe`
212 | mut m14 := map[string]voidptr{}
213 | m14['test'] = unsafe { nil }
214 | assert m14['test'] == unsafe { nil }
| ~~~~~~~~
215 | mut m15 := map[string]&u8{}
216 | m15['test'] = &u8(0)
vlib/builtin/map_test.v:217:12: error: accessing a pointer map value requires an `or {}` block outside `unsafe`
215 | mut m15 := map[string]&u8{}
216 | m15['test'] = &u8(0)
217 | assert m15['test'] == &u8(0)
| ~~~~~~~~
218 | mut m16 := map[string]i64{}
219 | m16['test'] = i64(0)
vlib/builtin/map_test.v:217:12: error: accessing map value that contain pointers requires an `or {}` block outside `unsafe`
215 | mut m15 := map[string]&u8{}
216 | m15['test'] = &u8(0)
217 | assert m15['test'] == &u8(0)
| ~~~~~~~~
218 | mut m16 := map[string]i64{}
219 | m16['test'] = i64(0)
vlib/builtin/map_test.v:226:12: error: accessing a pointer map value requires an `or {}` block outside `unsafe`
224 | mut m18 := map[string]&int{}
225 | m18['test'] = &int(0)
226 | assert m18['test'] == &int(0)
| ~~~~~~~~
227 | }
228 |
vlib/builtin/map_test.v:226:12: error: accessing map value that contain pointers requires an `or {}` block outside `unsafe`
224 | mut m18 := map[string]&int{}
225 | m18['test'] = &int(0)
226 | assert m18['test'] == &int(0)
| ~~~~~~~~
227 | }
228 |
vlib/builtin/map_test.v:671:10: error: accessing a pointer map value requires an `or {}` block outside `unsafe`
669 | m['var'] = &v
670 | m['map'] = &m
671 | assert m['var'] == &v
| ~~~~~~~
672 | assert m['map'] == &m
673 | assert m.values().len == 2
vlib/builtin/map_test.v:671:10: error: accessing map value that contain pointers requires an `or {}` block outside `unsafe`
669 | m['var'] = &v
670 | m['map'] = &m
671 | assert m['var'] == &v
| ~~~~~~~
672 | assert m['map'] == &m
673 | assert m.values().len == 2
vlib/builtin/map_test.v:672:10: error: accessing a pointer map value requires an `or {}` block outside `unsafe`
670 | m['map'] = &m
671 | assert m['var'] == &v
672 | assert m['map'] == &m
| ~~~~~~~
673 | assert m.values().len == 2
674 | }
vlib/builtin/map_test.v:672:10: error: accessing map value that contain pointers requires an `or {}` block outside `unsafe`
670 | m['map'] = &m
671 | assert m['var'] == &v
672 | assert m['map'] == &m
| ~~~~~~~
673 | assert m.values().len == 2
674 | }
FAIL [ 2/69] C: 762.1 ms, R: 0.000 ms /home/jalon/git/v/vlib/encoding/utf8/utf8_util_test.v
>> compilation failed:
vlib/encoding/utf8/utf8_util_test.v:26:14: error: function `encoding.utf8.is_uchar_punct` has been deprecated since 2024-11-17, it will be an error after 2025-05-16; use `.is_rune_punct(r rune)` instead
24 | assert utf8.is_punct(a, 0) == true
25 | assert utf8.is_punct('b', 0) == false
26 | assert utf8.is_uchar_punct(0x002E) == true // Test deprecated
| ~~~~~~~~~~~~~~~~~~~~~~
27 | assert utf8.is_rune_punct(0x002E) == true
28 | assert utf8.is_punct(a, 4) == true // ?
vlib/encoding/utf8/utf8_util_test.v:37:14: error: function `encoding.utf8.is_uchar_punct` has been deprecated since 2024-11-17, it will be an error after 2025-05-16; use `.is_rune_punct(r rune)` instead
35 | assert utf8.is_global_punct(b, 0) == true
36 | assert utf8.is_global_punct('.', 0) == true
37 | assert utf8.is_uchar_punct(0x002E) == true // Test deprecated
| ~~~~~~~~~~~~~~~~~~~~~~
38 | assert utf8.is_rune_punct(0x002E) == true
39 | assert utf8.is_global_punct(b, 6) == true // .
vlib/encoding/utf8/utf8_util_test.v:43:14: error: function `encoding.utf8.get_uchar` has been deprecated since 2024-11-17, it will be an error after 2025-05-16; use `.get_rune(s string, index int)` instead
41 |
42 | // test utility functions
43 | assert utf8.get_uchar(b, 0) == 0x002E // Test deprecated
| ~~~~~~~~~~~~~~~
44 | c := 'a©★🚀'
45 | assert utf8.get_rune(c, 0) == `a` // 1 byte
... everything else succeeded...
| V full version | V 0.4.9 f581bb7.9fc8352 |
|---|---|
| OS | linux, "Manjaro Linux" |
| Processor | 32 cpus, 64bit, little endian, AMD Ryzen 9 7950X 16-Core Processor |
| Memory | 4.18GB/30.49GB |
| V executable | /home/jalon/git/v/v |
| V last modified time | 2025-01-07 19:09:25 |
| V home dir | OK, value: /home/jalon/git/v |
| VMODULES | OK, value: /home/jalon/.vmodules |
| VTMP | OK, value: /tmp/v_1000 |
| Current working dir | OK, value: /home/jalon |
| Git version | git version 2.47.1 |
| V git status | weekly.2025.1-12-g9fc83526 |
| .git/config present | true |
| cc version | cc (GCC) 14.2.1 20240910 |
| gcc version | gcc (GCC) 14.2.1 20240910 |
| clang version | clang version 18.1.8 |
| tcc version | tcc version 0.9.28rc 2024-07-31 HEAD@1cee0908 (x86_64 Linux) |
| tcc git status | thirdparty-linux-amd64 0134e9b9 |
| emcc version | N/A |
| glibc version | ldd (GNU libc) 2.40 |
Errors for tests in vlib/encoding/utf8/utf8_util_test.v fixed with PR #23600
Errors for tests in vlib/builtin/map_test.v fixed with PR https://github.com/vlang/v/pull/23602