Description
I don't actually think there is a bug, but I'm looking for clarification. The issue is with the implementation for platforms where __uint128_t is not available (but I presume that it would be the same for the alternative implementation):
| staticinlineuint64_tphp_random_pcgoneseq128xslrr64_rotr64(php_random_uint128_tnum) |
| { |
| constuint64_t |
| v= (num.hi ^ num.lo), |
| s=num.hi >> 58U; |
| |
| return (v >> s) | (v << ((-s) &63)); |
| } |
The -s triggers C4146, which is a level 2 diagnostic, but is elevated to an error if the /sdl compile directive is active. The issue came up when I've tried to build sqlsrv and pdo_sqlsrv, and I found microsoft/msphpsql#1496, where it has been suggested to deactivate /sdl (which, in my opinion, should be done for production builds anyway).
Now, if I'm not mistaken, applying unary minus to an unsigned operand is well-defined behavior (at least in C99), so either I'm mistaken, C++ behaves differently, or the warning is bogus.
Maybe @zeriyoshi or @TimWolla can clarify.
PHP Version
PHP 8.3
Operating System
Windows
Description
I don't actually think there is a bug, but I'm looking for clarification. The issue is with the implementation for platforms where
__uint128_tis not available (but I presume that it would be the same for the alternative implementation):php-src/ext/random/php_random_uint128.h
Lines 78 to 85 in da72ac1
The
-striggers C4146, which is a level 2 diagnostic, but is elevated to an error if the/sdlcompile directive is active. The issue came up when I've tried to build sqlsrv and pdo_sqlsrv, and I found microsoft/msphpsql#1496, where it has been suggested to deactivate/sdl(which, in my opinion, should be done for production builds anyway).Now, if I'm not mistaken, applying unary minus to an unsigned operand is well-defined behavior (at least in C99), so either I'm mistaken, C++ behaves differently, or the warning is bogus.
Maybe @zeriyoshi or @TimWolla can clarify.
PHP Version
PHP 8.3
Operating System
Windows