llvmbot wrote:

<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang

Author: Abhinav Kumar (kr-2003)

<details>
<summary>Changes</summary>

Fixes #<!-- -->132001 

Edit ```isNonUnionUninit``` (caller of ```isPrimitiveUninit```): Add a check 
before calling ```isPrimitiveUninit```
```cpp
if (isPrimitiveType(T)) {
  if (I-&gt;isUnnamedBitField()) {
    continue;
  }
  if (isPrimitiveUninit(V)) {
    if (addFieldToUninits(LocalChain.add(RegularField(FR))))
      ContainsUninitField = true;
  }
  continue;
}
```

**Test Results**
```bash
Testing Time: 221.93s

Total Discovered Tests: 991
  Unsupported      :  16 (1.61%)
  Passed           : 968 (97.68%)
  Expectedly Failed:   7 (0.71%)
[100%] Built target check-clang-analysis
```

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


1 Files Affected:

- (modified) 
clang/lib/StaticAnalyzer/Checkers/UninitializedObject/UninitializedObjectChecker.cpp
 (+3) 


``````````diff
diff --git 
a/clang/lib/StaticAnalyzer/Checkers/UninitializedObject/UninitializedObjectChecker.cpp
 
b/clang/lib/StaticAnalyzer/Checkers/UninitializedObject/UninitializedObjectChecker.cpp
index 6e1222fedad3e..bf7759975b3ec 100644
--- 
a/clang/lib/StaticAnalyzer/Checkers/UninitializedObject/UninitializedObjectChecker.cpp
+++ 
b/clang/lib/StaticAnalyzer/Checkers/UninitializedObject/UninitializedObjectChecker.cpp
@@ -332,6 +332,9 @@ bool FindUninitializedFields::isNonUnionUninit(const 
TypedValueRegion *R,
     }
 
     if (isPrimitiveType(T)) {
+      if (I->isUnnamedBitField()) {
+        continue;
+      }
       if (isPrimitiveUninit(V)) {
         if (addFieldToUninits(LocalChain.add(RegularField(FR))))
           ContainsUninitField = true;

``````````

</details>


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

Reply via email to