[clang] [analyzer] Resolve initializers for fields of struct array elements i… (PR #189361)
Balázs Benics via cfe-commits
cfe-commits at lists.llvm.org
Mon Mar 30 06:20:25 PDT 2026
================
@@ -0,0 +1,36 @@
+// RUN: %clang_analyze_cc1 -std=c++14 -analyzer-checker=core,debug.ExprInspection -verify %s
+
+// This test verifies that the analyzer does not incorrectly assume zero
+// for fields with in-class (default member) initializers when accessing
+// elements of a struct array.
----------------
steakhal wrote:
I think a single test file would better demonstrate the differences between how C and C++ global variables are interpreted.
I think you should just have different verify prefixes and two RUN lines. One for C and one for C++.
Then the `clang_analyzer_value` would demonstrate nicely if the global initializer expression was taken into account or not.
https://github.com/llvm/llvm-project/pull/189361
More information about the cfe-commits
mailing list