Index: lib/StaticAnalyzer/Checkers/CStringChecker.cpp =================================================================== --- lib/StaticAnalyzer/Checkers/CStringChecker.cpp +++ lib/StaticAnalyzer/Checkers/CStringChecker.cpp @@ -289,8 +289,8 @@ if (!ER) return state; - assert(ER->getValueType() == C.getASTContext().CharTy && - "CheckLocation should only be called with char* ElementRegions"); + if (ER->getValueType() != C.getASTContext().CharTy) + return state; // Get the size of the array. const SubRegion *superReg = cast(ER->getSuperRegion()); @@ -874,6 +874,8 @@ if (!ER) return true; // cf top comment. + // FIXME: Does this crash when a non-standard definition + // of a library function is encountered? assert(ER->getValueType() == C.getASTContext().CharTy && "IsFirstBufInBound should only be called with char* ElementRegions"); Index: test/Analysis/string-with-signedness.c =================================================================== --- /dev/null +++ test/Analysis/string-with-signedness.c @@ -0,0 +1,10 @@ +// RUN: %clang_analyze_cc1 -Wno-incompatible-library-redeclaration -analyzer-checker=core,unix.cstring,alpha.unix.cstring -verify %s + +// expected-no-diagnostics + +void *strcpy(unsigned char *, unsigned char *); + +unsigned char a, b; +void testUnsignedStrcpy() { + strcpy(&a, &b); +}