Skip to content

Conversation

sisyphus
Copy link
Contributor

@sisyphus sisyphus commented Nov 25, 2023

This PR might well be approved simply on the basis that supported MSVC compilers now provide the trunc function, but there's a little bit more to it.

Following the merging of PR #21610, ext/POSIX/t/math.t now fails 5 tests - though this happens only on 32-bit perl-5.39.5 (MSWin32-x86-multi-thread), built using MSVC.
Here are the failures:

....
ok 131 - nan + getpayload 2**31
not ok 132 - nan + getpayload 2**32
#   Failed test 'nan + getpayload 2**32'
#   at \comp-1320-ucrt\perl-5.39.5\ext\POSIX\t\math.t line 231.
#          got: '2147483648'
#     expected: '4294967296'
not ok 133 - nan + getpayload 2**33
#   Failed test 'nan + getpayload 2**33'
#   at \comp-1320-ucrt\perl-5.39.5\ext\POSIX\t\math.t line 232.
#          got: '2147483648'
#     expected: '8589934592'
ok 134 - nan + getpayload 2**31-1
not ok 135 - nan + getpayload 2**32-1
#   Failed test 'nan + getpayload 2**32-1'
#   at \comp-1320-ucrt\perl-5.39.5\ext\POSIX\t\math.t line 236.
#          got: '2147483648'
#     expected: '4294967295'
not ok 136 - nan + getpayload 3**21
#   Failed test 'nan + getpayload 3**21'
#   at \comp-1320-ucrt\perl-5.39.5\ext\POSIX\t\math.t line 258.
#          got: '2147483648'
#     expected: '10460353203'
not ok 137 - nan + getpayload prime
#   Failed test 'nan + getpayload prime'
#   at \comp-1320-ucrt\perl-5.39.5\ext\POSIX\t\math.t line 260.
#          got: '2147483648'
#     expected: '4294967311'
ok 138 - nan (trunc) + getpayload
....

Prior to the merging of #21610, these failing tests were skipped on this platform.
There's no problem with MSWin32-x86-multi-thread-64int - the failures occur only when ivsize is 4.
And there's no problem with the comparable mingw-w64 builds.

By defining HAS_TRUNC (in win32/config_H.vc) and d_trunc (in win32/config.vc), these tests all pass on the problem platform.
Importantly, with these changes in place, the MSVC builds of the MSWin32-x86-multi-thread-64int and MSWin32-x64-multi-thread configurations still continue to pass all tests.

I have tested this using configurations of current blead built with VS2022.

Fixes POSIX/t/math.t failures on MSVC builds of MSWin32-x86-multi-thread
@khwilliamson khwilliamson merged commit 3ac05d1 into Perl:blead Nov 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants