-
Notifications
You must be signed in to change notification settings - Fork 15.2k
Open
Labels
clang:diagnosticsNew/improved warning or error message in Clang, but not in clang-tidy or static analyzerNew/improved warning or error message in Clang, but not in clang-tidy or static analyzercompiler-rt:msanMemory sanitizerMemory sanitizer
Description
The recently introduced -Wuninitialized-const-pointer
warning is triggered by a legitimate usage of the MemorySanitizer __msan_allocated_memory
call:
#include <sanitizer/msan_interface.h>
int main(void) {
int a;
__msan_allocated_memory(&a, sizeof(a));
return 0;
}
Command and output:
$ clang-21 test.c -o test -fsanitize=memory -Wall
test.c:4:28: warning: variable 'a' is uninitialized when passed as a const pointer argument here [-Wuninitialized-const-pointer]
4 | __msan_allocated_memory(&a, sizeof(a));
| ^
1 warning generated.
Metadata
Metadata
Assignees
Labels
clang:diagnosticsNew/improved warning or error message in Clang, but not in clang-tidy or static analyzerNew/improved warning or error message in Clang, but not in clang-tidy or static analyzercompiler-rt:msanMemory sanitizerMemory sanitizer