[php-src] Issue #15106: Compiling php_random_pcgoneseq128xslrr64_rotr64() triggers C4146

From: Date: Thu, 25 Jul 2024 11:32:45 +0000
Subject: [php-src] Issue #15106: Compiling php_random_pcgoneseq128xslrr64_rotr64() triggers C4146
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-247373@lists.php.net to get a copy of this message
Issue: https://github.com/php/php-src/issues/15106 Author: cmb69 ### 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): https://github.com/php/php-src/blob/da72ac11f6a0344ba028d88c6b5662d865a8257c/ext/random/php_random_uint128.h#L78-L85 The -s triggers [C4146](https://learn.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warning-level-2-c4146?view=msvc-170), which is a level 2 diagnostic, but is elevated to an error if the [/sdl compile directive is active](https://learn.microsoft.com/en-us/cpp/build/reference/sdl-enable-additional-security-checks?view=msvc-170). The issue came up when I've tried to build sqlsrv and pdo_sqlsrv, and I found https://github.com/microsoft/msphpsql/issues/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

« previous php.bugs (#247373) next »