On 12/2/25 10:34, Philippe Mathieu-Daudé wrote:
Silence warning when building on macOS AArch64:

   C compiler for the host machine: clang (clang 17.0.0 "Apple clang version 17.0.0 
(clang-1700.4.4.1)")
   Host machine cpu: aarch64
   ...
   In file included from ../../tcg/tcg.c:41:
   In file included from include/tcg/tcg-op-common.h:12:
   In file included from include/exec/helper-proto-common.h:10:
   In file included from include/qemu/atomic128.h:62:
   host/include/aarch64/host/atomic128-cas.h.inc:72:22: warning: variable 
'tmpl' is uninitialized when used here [-Wuninitialized]
      72 |           [tmpl] "r"(tmpl), [tmph] "r"(tmph)
         |                      ^~~~
   host/include/aarch64/host/atomic128-cas.h.inc:61:30: note: initialize the 
variable 'tmpl' to silence this warning
      61 |     uint64_t oldl, oldh, tmpl, tmph;
         |                              ^
         |                               = 0
   host/include/aarch64/host/atomic128-cas.h.inc:72:40: warning: variable 
'tmph' is uninitialized when used here [-Wuninitialized]
      72 |           [tmpl] "r"(tmpl), [tmph] "r"(tmph)
         |                                        ^~~~
   host/include/aarch64/host/atomic128-cas.h.inc:61:36: note: initialize the 
variable 'tmph' to silence this warning
      61 |     uint64_t oldl, oldh, tmpl, tmph;
         |                                    ^
         |                                     = 0
   host/include/aarch64/host/atomic128-cas.h.inc:92:22: warning: variable 
'tmpl' is uninitialized when used here [-Wuninitialized]
      92 |           [tmpl] "r"(tmpl), [tmph] "r"(tmph)
         |                      ^~~~
   host/include/aarch64/host/atomic128-cas.h.inc:81:30: note: initialize the 
variable 'tmpl' to silence this warning
      81 |     uint64_t oldl, oldh, tmpl, tmph;
         |                              ^
         |                               = 0
   host/include/aarch64/host/atomic128-cas.h.inc:92:40: warning: variable 
'tmph' is uninitialized when used here [-Wuninitialized]
      92 |           [tmpl] "r"(tmpl), [tmph] "r"(tmph)
         |                                        ^~~~
   host/include/aarch64/host/atomic128-cas.h.inc:81:36: note: initialize the 
variable 'tmph' to silence this warning
      81 |     uint64_t oldl, oldh, tmpl, tmph;
         |                                    ^
         |                                     = 0
   4 warnings generated.

Signed-off-by: Philippe Mathieu-Daudé <[email protected]>
---
  host/include/aarch64/host/atomic128-cas.h.inc | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/host/include/aarch64/host/atomic128-cas.h.inc 
b/host/include/aarch64/host/atomic128-cas.h.inc
index aec27df1820..1334f467871 100644
--- a/host/include/aarch64/host/atomic128-cas.h.inc
+++ b/host/include/aarch64/host/atomic128-cas.h.inc
@@ -58,7 +58,7 @@ static inline Int128 atomic16_xchg(Int128 *ptr, Int128 new)
  static inline Int128 atomic16_fetch_and(Int128 *ptr, Int128 new)
  {
      uint64_t newl = int128_getlo(new), newh = int128_gethi(new);
-    uint64_t oldl, oldh, tmpl, tmph;
+    uint64_t oldl, oldh, tmpl = 0, tmph = 0;
      uint32_t tmp;
asm("0: ldaxp %[oldl], %[oldh], %[mem]\n\t"
@@ -78,7 +78,7 @@ static inline Int128 atomic16_fetch_and(Int128 *ptr, Int128 
new)
  static inline Int128 atomic16_fetch_or(Int128 *ptr, Int128 new)
  {
      uint64_t newl = int128_getlo(new), newh = int128_gethi(new);
-    uint64_t oldl, oldh, tmpl, tmph;
+    uint64_t oldl, oldh, tmpl = 0, tmph = 0;
      uint32_t tmp;
asm("0: ldaxp %[oldl], %[oldh], %[mem]\n\t"

The warnings are correct and the assembly is wrong.
These should be outputs, not inputs.
Will fix.


r~

Reply via email to