[clang] [NFC][analyzer] OOB test consolidation III: 'outofbound' tests (PR #128508)
DonĂ¡t Nagy via cfe-commits
cfe-commits at lists.llvm.org
Mon Feb 24 05:52:41 PST 2025
================
@@ -1,130 +0,0 @@
-// RUN: %clang_analyze_cc1 -Wno-array-bounds -verify %s \
-// RUN: -analyzer-checker=core \
-// RUN: -analyzer-checker=unix \
-// RUN: -analyzer-checker=security.ArrayBound \
-// RUN: -analyzer-config unix.DynamicMemoryModeling:Optimistic=true
-
-typedef __typeof(sizeof(int)) size_t;
-void *malloc(size_t);
-void *calloc(size_t, size_t);
-
-char f1(void) {
- char* s = "abcd";
- char c = s[4]; // no-warning
- return s[5] + c; // expected-warning{{Out of bound access to memory after}}
-}
----------------
NagyDonat wrote:
AFAIK this test won't have a direct equivalent after this commit; but they are tested incidentally by a few ([intFromString](https://github.com/llvm/llvm-project/blob/72768d9bb8ad3e97a852270726f04d7167d9ef50/clang/test/Analysis/out-of-bounds-diagnostics.c#L262) and [intFromStringDivisible](https://github.com/llvm/llvm-project/blob/72768d9bb8ad3e97a852270726f04d7167d9ef50/clang/test/Analysis/out-of-bounds-diagnostics.c#L269)) in `out-of-bounds-diagnostics.c`. String literals are simple and straightforward regions, so I think this coverage is sufficient for them; but I could migrate this test case if you wish.
https://github.com/llvm/llvm-project/pull/128508
More information about the cfe-commits
mailing list