[clang] [analyzer] Untangle subcheckers of CStringChecker (PR #186802)

Endre Fülöp via cfe-commits cfe-commits at lists.llvm.org
Wed Mar 25 02:37:39 PDT 2026


================
@@ -188,8 +227,21 @@ void memset1_new_array() {
   int *array = new int[10];
   memset(array, 0, 10 * sizeof(int));
   clang_analyzer_eval(array[2] == 0); // expected-warning{{TRUE}}
+  // FIXME: The analyzer should stop analysis after memset. Maybe the intent of
+  // this test was to test for this as a desired behaviour, but it shouldn't be,
+  // going out-of-bounds with memset is a fatal error, even if we decide not to
+  // report it.
   memset(array + 1, 'a', 10 * sizeof(9));
   clang_analyzer_eval(array[2] == 0); // expected-warning{{UNKNOWN}}
   delete[] array;
 }
 #endif
+
+#ifdef UNINIT_WITHOUT_OUTOFBOUND
----------------
gamesh411 wrote:

I recommend we stay with this for this patch. I have an NFC patch that handles the test cases, as there are more issues with them beyond just coverage, IMHO. I'll create a PR with that soon.

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


More information about the cfe-commits mailing list