https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104042
Bug ID: 104042 Summary: Four memcpy/memset analyzer failures on darwin Product: gcc Version: 12.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: analyzer Assignee: dmalcolm at gcc dot gnu.org Reporter: fxcoudert at gcc dot gnu.org Target Milestone: --- Created attachment 52202 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=52202&action=edit Preprocessed source Some analyzer testcases fail on darwin (https://gcc.gnu.org/pipermail/gcc-testresults/2022-January/747918.html) due to what I believe are false positive. Those four cases fail for the same reason: gcc.dg/analyzer/data-model-1.c gcc.dg/analyzer/pr103526.c gcc.dg/analyzer/taint-size-1.c gcc.dg/analyzer/write-to-string-literal-1.c The failures are related to memcpy and memset, and can be reduced to this: $ cat write-to-string-literal-1.c #include <string.h> void test_2 (void) { memcpy ("abc", "def", 3); /* { dg-warning "write to string literal" } */ } $ ./bin/gcc -fdiagnostics-plain-output -fanalyzer -Wanalyzer-too-complex -fanalyzer-call-summaries write-to-string-literal-1.c -c No warning is emitted, and the test expects a warning. The preprocessed source for this reduced testcase is attached. The testcase passes if the memcpy() call is replaced by __builtin_memcpy().