llvmbot wrote:

<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang

Author: None (smanna12)

<details>
<summary>Changes</summary>

… in Sema::isTemplateTemplateParameterAtLeastAsSpecializedAs()

This patch fixes a static analyzer bug where the boolean variable 
`AtLeastAsSpecialized` was used uninitialized. The variable is now explicitly 
initialized to false before its potential modification within a lambda function 
to ensure that it always holds a valid value when returned, preventing 
undefined behavior due to uninitialized variable usage in 
`Sema::isTemplateTemplateParameterAtLeastAsSpecializedAs()`.

---
Full diff: https://github.com/llvm/llvm-project/pull/95195.diff


1 Files Affected:

- (modified) clang/lib/Sema/SemaTemplateDeduction.cpp (+1-1) 


``````````diff
diff --git a/clang/lib/Sema/SemaTemplateDeduction.cpp 
b/clang/lib/Sema/SemaTemplateDeduction.cpp
index befeb38e1fe5b..df0d6908d0a78 100644
--- a/clang/lib/Sema/SemaTemplateDeduction.cpp
+++ b/clang/lib/Sema/SemaTemplateDeduction.cpp
@@ -6447,7 +6447,7 @@ bool 
Sema::isTemplateTemplateParameterAtLeastAsSpecializedAs(
   if (Inst.isInvalid())
     return false;
 
-  bool AtLeastAsSpecialized;
+  bool AtLeastAsSpecialized = false;
   runWithSufficientStackSpace(Info.getLocation(), [&] {
     AtLeastAsSpecialized =
         ::FinishTemplateArgumentDeduction(

``````````

</details>


https://github.com/llvm/llvm-project/pull/95195
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to