[all-commits] [llvm/llvm-project] 6504c9: [clang][analyzer] Fix the false positive ArgInitia...

Tedlion via All-commits all-commits at lists.llvm.org
Wed Jul 2 23:42:32 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 6504c96b1d865c69888a2a17aa8fe479987c00f0
      https://github.com/llvm/llvm-project/commit/6504c96b1d865c69888a2a17aa8fe479987c00f0
  Author: Tedlion <813055098 at qq.com>
  Date:   2025-07-03 (Thu, 03 Jul 2025)

  Changed paths:
    M clang/lib/StaticAnalyzer/Checkers/CallAndMessageChecker.cpp
    M clang/test/Analysis/call-and-message.c
    M clang/test/Analysis/call-and-message.cpp

  Log Message:
  -----------
  [clang][analyzer] Fix the false positive ArgInitializedness warning on unnamed bit-field (#145066)

For the following code in C mode: https://godbolt.org/z/3eo1MeGhe
(There is no warning in C++ mode though).
```c++
struct B {
  int i : 2;
  int : 30;  // unnamed bit-field
};

extern void consume_B(struct B);

void bitfield_B_init(void) {
  struct B b1;
  b1.i = 1; // b1 is initialized
  consume_B(b1); // FP: Passed-by-value struct argument contains uninitialized data (e.g., field: '') [core.CallAndMessage]
}
```



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list