[libc-commits] [libc] c39dcf5 - [libc] Zero initialize Uint<T>::val

Mikhail R. Gadelha via libc-commits libc-commits at lists.llvm.org
Thu Apr 20 09:48:13 PDT 2023


Author: Mikhail R. Gadelha
Date: 2023-04-20T13:47:55-03:00
New Revision: c39dcf54bb0494f319cdc712d24607433bd7f30a

URL: https://github.com/llvm/llvm-project/commit/c39dcf54bb0494f319cdc712d24607433bd7f30a
DIFF: https://github.com/llvm/llvm-project/commit/c39dcf54bb0494f319cdc712d24607433bd7f30a.diff

LOG: [libc] Zero initialize Uint<T>::val

This fix a regression introduced by commit 5db12eca1f70bb9c2dab33ff88dcccdfba75af6e

Fixes the compilation failure reported by libc-x86_64-debian-gcc-fullbuild-dbg:

.../libc/src/__support/UInt.h:26:31: note: ‘struct __llvm_libc::cpp::UInt<192>’ has no user-provided default constructor
   26 | template <size_t Bits> struct UInt {
      |                               ^~~~
.../libc/src/__support/UInt.h:38:13: note: constructor is not user-provided because it is explicitly defaulted in the class body
   38 |   constexpr UInt() = default;

Added: 
    

Modified: 
    libc/src/__support/UInt.h

Removed: 
    


################################################################################
diff  --git a/libc/src/__support/UInt.h b/libc/src/__support/UInt.h
index c151689c3bbb..da46d3b316d0 100644
--- a/libc/src/__support/UInt.h
+++ b/libc/src/__support/UInt.h
@@ -28,7 +28,7 @@ template <size_t Bits> struct UInt {
   static_assert(Bits > 0 && Bits % 64 == 0,
                 "Number of bits in UInt should be a multiple of 64.");
   static constexpr size_t WORDCOUNT = Bits / 64;
-  uint64_t val[WORDCOUNT];
+  uint64_t val[WORDCOUNT]{};
 
   static constexpr uint64_t MASK32 = 0xFFFFFFFFu;
 


        


More information about the libc-commits mailing list