From: Milan Broz Date: Fri, 27 Mar 2026 09:38:52 +0000 (+0100) Subject: Remove superfluous volatile for RCU on Windows X-Git-Tag: openssl-4.0.0~85 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5b7ecbcf5cff4b3f64733042d3c7b276fb3b4182;p=thirdparty%2Fopenssl.git Remove superfluous volatile for RCU on Windows When compiling on the MINGW platform, there are many warnings like this: warning: passing argument 1 of 'CRYPTO_atomic_add64' discards 'volatile' qualifier from pointer target type [-Wdiscarded-qualifiers] CRYPTO_atomic_add64(&lock->qp_group[qp_idx].users, (uint64_t)1, &tmp64, ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The warning actually shows several issues with volatile in struct rcu_qp: - all handling functions using it do not use the volatile modifier, so that the compiler can treat this pointer as non-volatile already (Posix pthread variant does not use volatile here at all.) - thread safety is already guaranteed by using locks (NO_INTERLOCKEDOR64) or Interlocked*64 Win32 API functions. - the volatile removal modifier should always be explicit In short, I think the volatile in struct rcu_qp on Windows has no additional value and can be removed. This also fixes the warnings mentioned above :-) Signed-off-by: Milan Broz Reviewed-by: Tomas Mraz Reviewed-by: Nikola Pajkovsky Reviewed-by: Paul Dale Reviewed-by: Eugene Syromiatnikov MergeDate: Tue Mar 31 01:25:56 2026 (Merged from https://github.com/openssl/openssl/pull/30602) (cherry picked from commit b0380fa9331e8d9d4d8b1ab7c3f57d7a35603757) --- diff --git a/crypto/threads_win.c b/crypto/threads_win.c index 525c8d432e6..4884fae6c58 100644 --- a/crypto/threads_win.c +++ b/crypto/threads_win.c @@ -51,7 +51,7 @@ typedef struct { * atomically updated */ struct rcu_qp { - volatile uint64_t users; + uint64_t users; }; struct thread_qp {