[compiler-rt] 261752f - [compiler-rt] initialize variables to silence warning. NFC.

Tim Northover via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 1 05:30:15 PST 2023


Author: Tim Northover
Date: 2023-02-01T13:30:10Z
New Revision: 261752fbc60403ff26e1865865ae5306e0482078

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

LOG: [compiler-rt] initialize variables to silence warning. NFC.

They were being initialized anyway, I believe, but the logic was a bit
convoluted for the Clang warnings to detect so we were getting "variable 'EBX'
may be uninitialized when used here" later on.

Added: 
    

Modified: 
    compiler-rt/lib/builtins/cpu_model.c

Removed: 
    


################################################################################
diff  --git a/compiler-rt/lib/builtins/cpu_model.c b/compiler-rt/lib/builtins/cpu_model.c
index c5d7ae31afce2..4e3ce7af9926b 100644
--- a/compiler-rt/lib/builtins/cpu_model.c
+++ b/compiler-rt/lib/builtins/cpu_model.c
@@ -646,7 +646,7 @@ getAMDProcessorTypeAndSubtype(unsigned Family, unsigned Model,
 
 static void getAvailableFeatures(unsigned ECX, unsigned EDX, unsigned MaxLeaf,
                                  unsigned *Features) {
-  unsigned EAX, EBX;
+  unsigned EAX = 0, EBX = 0;
 
 #define setFeature(F)                                                          \
   Features[F / 32] |= 1U << (F % 32)


        


More information about the llvm-commits mailing list