[clang] [analyzer] CStringChecker: fix crash in `CheckOverlap` when arguments are not pointers (PR #160511)

DonĂ¡t Nagy via cfe-commits cfe-commits at lists.llvm.org
Wed Sep 24 06:11:34 PDT 2025


================
@@ -96,3 +96,19 @@ void test_snprintf6() {
   char b[4] = {0};
   snprintf(a, sizeof(a), "%s", b); // no-warning
 }
+
+
+void memcpy(int dst, int src, size_t size); // expected-warning{{incompatible redeclaration of library function 'memcpy'}} expected-note{{'memcpy' is a builtin with type 'void *(void *, const void *, __size_t)' (aka 'void *(void *, const void *, unsigned long)')}}
----------------
NagyDonat wrote:

The static analyzer tests usually add `-Wno-...` to the `RUN:` lines in order to silence the compiler warnings that overlap with the tested feature. I think that would be slightly more elegant here than these long `expected` lines.

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


More information about the cfe-commits mailing list