https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121148

--- Comment #19 from Jonathan Wakely <redi at gcc dot gnu.org> ---
The problem is -fanalyzer-call-summaries

If I do

git checkout 6456da6bab8a2c43e7899afda991589065d96595^
libstdc++-v3/include/ext/atomicity.h


then the analyzer warnings come back. If I then make this change:

-- /tmp/a      2025-09-12 16:07:30.055069572 +0100
+++ /home/jwakely/gcc/16/include/c++/16.0.0/ext/atomicity.h     2025-09-12
16:07:33.216068133 +0100
@@ -84,7 +84,7 @@
   __exchange_and_add_single(_Atomic_word* __mem, int __val)
   {
     _Atomic_word __result = *__mem;
-    *__mem += __val;
+    *__mem = (int)((unsigned)__result + (unsigned)__val);
     return __result;
   }

the warnings go away with -fanalyzer-call-summaries.

That is a simplified version of the 6456da6bab8a2c43e7899afda991589065d96595
change, to isolate the problem to that one line.

Reply via email to