[clang] [clang][analyzer] Add support for detecting uninitialized union fields (PR #191812)

via cfe-commits cfe-commits at lists.llvm.org
Mon Apr 13 06:33:12 PDT 2026


=?utf-8?b?8J+NjFNoYXdu?= <m18824909883 at 163.com>
Message-ID:
In-Reply-To: <llvm.org/llvm/llvm-project/pull/191812 at github.com>


github-actions[bot] wrote:

<!--PREMERGE ADVISOR COMMENT: Linux-->
# :penguin: Linux x64 Test Results

* 87340 tests passed
* 1401 tests skipped
* 1 test failed

## Failed Tests
(click on a test name to see its output)

### Clang
<details>
<summary>Clang.Analysis/cxx-uninitialized-object.cpp</summary>

```
Exit Code: 1

Command Output (stdout):
--
# RUN: at line 1
/home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/clang -cc1 -internal-isystem /home/gha/actions-runner/_work/llvm-project/llvm-project/build/lib/clang/23/include -nostdsysteminc -analyze -setup-static-analyzer -std=c++14 -verify  /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/test/Analysis/cxx-uninitialized-object.cpp    -analyzer-checker=core    -analyzer-checker=optin.cplusplus.UninitializedObject    -analyzer-config optin.cplusplus.UninitializedObject:Pedantic=true -DPEDANTIC    -analyzer-config      optin.cplusplus.UninitializedObject:CheckPointeeInitialization=true
# executed command: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/clang -cc1 -internal-isystem /home/gha/actions-runner/_work/llvm-project/llvm-project/build/lib/clang/23/include -nostdsysteminc -analyze -setup-static-analyzer -std=c++14 -verify /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/test/Analysis/cxx-uninitialized-object.cpp -analyzer-checker=core -analyzer-checker=optin.cplusplus.UninitializedObject -analyzer-config optin.cplusplus.UninitializedObject:Pedantic=true -DPEDANTIC -analyzer-config optin.cplusplus.UninitializedObject:CheckPointeeInitialization=true
# .---command stderr------------
# | error: 'expected-warning' diagnostics seen but not expected: 
# |   File /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/test/Analysis/cxx-uninitialized-object.cpp Line 442: 1 uninitialized field at the end of the constructor call [optin.cplusplus.UninitializedObject]
# |   File /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/test/Analysis/cxx-uninitialized-object.cpp Line 486: 1 uninitialized field at the end of the constructor call [optin.cplusplus.UninitializedObject]
# | error: 'expected-note' diagnostics seen but not expected: 
# |   File /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/test/Analysis/cxx-uninitialized-object.cpp Line 439: uninitialized field 'this->u'
# |   File /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/test/Analysis/cxx-uninitialized-object.cpp Line 483: uninitialized pointee 'this->uptr'
# | 4 errors generated.
# `-----------------------------
# error: command failed with exit status: 1

--

```
</details>

If these failures are unrelated to your changes (for example tests are broken or flaky at HEAD), please open an issue at https://github.com/llvm/llvm-project/issues and add the `infrastructure` label.

https://github.com/llvm/llvm-project/pull/191812


More information about the cfe-commits mailing list