Skip to content

Tests fail for vlib/math/unsigned/uint{128,256} on OpenBSD with tcc #24587

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

Open
lcheylus opened this issue May 27, 2025 · 2 comments
Open

Tests fail for vlib/math/unsigned/uint{128,256} on OpenBSD with tcc #24587

lcheylus opened this issue May 27, 2025 · 2 comments
Labels
Bug This tag is applied to issues which reports bugs. Test Fail Bugs requests, that are related to failing tests.

Comments

@lcheylus
Copy link
Contributor

lcheylus commented May 27, 2025

Describe the bug

On OpenBSD amd64 with tcc compiler, tests fail for:

  • vlib/math/unsigned/uint128_test.v
  • vlib/math/unsigned/uint256_test.v

No error with clang and GCC on OpenBSD.
No error when running vlib/math tests on Linux amd64 with tcc.

Reproduction Steps

  • Build V from Git sources on OpenBSD amd64
  • Run vlib/math tests with ./v -exclude @vlib/math/*.c.v test vlib/math

Expected Behavior

No error when running tests for vlib/math on OpenBSD with tcc

Current Behavior

$ ./v -exclude @vlib/math/*.c.v test vlib/math
(...)
 FAIL  [20/26] C:   897.5 ms, R:    56.346 ms vlib/math/unsigned/uint128_test.v                                                                                                                                                                                                   
/home/fox/dev/vlang.git/vlib/math/unsigned/uint128_test.v:5: fn test_str                                                                                                                                                                                                          
  > assert x.str() == '170141183460469231713240559642174554112'                                                                                                                                                                                                                   
    Left value (len: 39):                                                                                                                                                                                                                                                         
      `192233720368547758060000000000000000000`                                                                                                                                                                                                                                   
    Right value (len: 39):                                                                                                                                                                                                                                                        
      `170141183460469231713240559642174554112`                                                                                                                                                                                                                                   
                                                                                                                                                                                                                                                                                  
/home/fox/dev/vlang.git/vlib/math/unsigned/uint128_test.v:17: fn test_ops                                                                                                                                                                                                         
  > assert (x * y).str() == '340282366920938463426481119284349108225'                                                                                                                                                                                                             
    Left value (len: 39):                                                                                                                                                                                                                                                         
      `392233720368547758040000000000000000001`                                                                                                                                                                                                                                   
    Right value (len: 39):                                                                                                                                                                                                                                                        
      `340282366920938463426481119284349108225`
(...)
 FAIL  [22/26] C:   876.9 ms, R:    17.898 ms vlib/math/unsigned/uint256_test.v                                                                                                                                                                                                   
/home/fox/dev/vlang.git/vlib/math/unsigned/uint256_test.v:100: fn test_str                                                                                                                                                                                                        
   > assert number.str() == ts                                                                                                                                                                                                                                                    
     Left value (len: 20): `19223372036854775806`                                                                                                                                                                                                                                 
    Right value (len: 20): `18446744073709551614`                                                                                                                                                                                                                                 
                                                                                                                                                                                                                                                                                  
/home/fox/dev/vlang.git/vlib/math/unsigned/uint256_test.v:114: fn test_ops                                                                                                                                                                                                        
  > assert (x * y).str() == '340282366920938463426481119284349108225'                                                                                                                                                                                                             
    Left value (len: 39):                                                                                                                                                                                                                                                         
      `392233720368547758040000000000000000001`                                                                                                                                                                                                                                   
    Right value (len: 39):                                                                                                                                                                                                                                                        
      `340282366920938463426481119284349108225`

Possible Solution

Upgrade tcc for OpenBSD with a more recent version. Current version = tcc version 0.9.28rc 2024-09-14 HEAD@b8b6a5fd (x86_64 OpenBSD)

Additional Information/Context

No response

V version

V 0.4.10 52c7130

Environment details (OS name and version, etc.)

V full version V 0.4.10 52c7130
OS openbsd, 7.7, GENERIC.MP#667
Processor 4 cpus, 64bit, little endian
Memory 1.58GB/3.98GB
V executable /home/fox/dev/vlang.git/v
V last modified time 2025-05-26 14:51:54
V home dir OK, value: /home/fox/dev/vlang.git
VMODULES OK, value: /home/fox/.vmodules
VTMP OK, value: /tmp/v_1000
Current working dir OK, value: /home/fox/dev/vlang.git
Git version git version 2.49.0
V git status weekly.2025.21-26-g52c7130a
.git/config present true
cc version OpenBSD clang version 16.0.6
gcc version egcc (GCC) 11.2.0
clang version OpenBSD clang version 16.0.6
tcc version tcc version 0.9.28rc 2024-09-14 HEAD@b8b6a5fd (x86_64 OpenBSD)
tcc git status thirdparty-openbsd-amd64 8205cc59
emcc version N/A
glibc version N/A

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.

@lcheylus lcheylus added the Bug This tag is applied to issues which reports bugs. label May 27, 2025
Copy link

Connected to Huly®: V_0.6-22952

@lcheylus
Copy link
Contributor Author

With a more recent tcc, no issue when running vlib/math tests.

$ tcc -v
tcc version 0.9.28rc 2025-05-22 mob@b6a16e3 (x86_64 OpenBSD)

$ ./v -cc /usr/local/bin/tcc -exclude @vlib/math/*.c.v test vlib/math
(...)
Summary for all V _test.v files: 26 passed, 26 total. Elapsed time: 15319 ms, on 3 parallel jobs. Comptime: 37055 ms. Runtime: 7391 ms.

@felipensp felipensp added the Test Fail Bugs requests, that are related to failing tests. label May 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug This tag is applied to issues which reports bugs. Test Fail Bugs requests, that are related to failing tests.
Projects
None yet
Development

No branches or pull requests

2 participants