[clang] [Clang][Sema] Add fortify warnings for bcopy and bzero (#168965) (PR #186522)
via cfe-commits
cfe-commits at lists.llvm.org
Mon Apr 6 18:53:15 PDT 2026
================
@@ -508,7 +508,8 @@ void bcopy2 (void) {
char src[] = {1, 2, 3, 4};
char dst[1];
- bcopy(src, dst, 4); // expected-warning{{overflow}}
+ bcopy(src, dst, 4); // expected-warning {{Memory copy function overflows the destination buffer}}
----------------
bharsesh wrote:
bstring.c is an analyzer test (it is run with %clang_analyze_cc1 and the unix.cstring checker enabled), so you get the analyzer message (createOutOfBoundErrorMsg in clang/lib/StaticAnalyzer/Checkers/CStringChecker.cpp), and also see the frontend fortify warning. The other test file is Sema only test, so we see only the fortify warning.
https://github.com/llvm/llvm-project/pull/186522
More information about the cfe-commits
mailing list