[PATCH 2/2] aarch64: mpi/longlong.h: fix operand size mismatch

Jussi Kivilinna jussi.kivilinna at iki.fi
Sat Dec 5 13:32:11 CET 2020


* mpi/longlong.h [__aarch64__] (count_leading_zeros): Use correctly
sized temporary variable for asm output.
--

Patch fixes clang-8 warning about differently sized inline
assembly operands seen on aarch64.

Signed-off-by: Jussi Kivilinna <jussi.kivilinna at iki.fi>
---
 mpi/longlong.h | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/mpi/longlong.h b/mpi/longlong.h
index c0f24c85..6573c984 100644
--- a/mpi/longlong.h
+++ b/mpi/longlong.h
@@ -305,9 +305,13 @@ extern UDItype __udiv_qrnnd ();
     (ph) = __ph; \
   } while (0)
 # define count_leading_zeros(count, x) \
-  __asm__ ("clz %0, %1\n"                                               \
-           : "=r" ((count))                                             \
-           : "r" ((UDItype)(x)))
+  do {                                                                  \
+    UDItype __co;                                                       \
+    __asm__ ("clz %0, %1\n"                                             \
+             : "=r" (__co)                                              \
+             : "r" ((UDItype)(x)));                                     \
+    (count) = __co;                                                     \
+  } while (0)
 #endif /* __aarch64__ */
 
 /***************************************
-- 
2.27.0




More information about the Gcrypt-devel mailing list