-
Notifications
You must be signed in to change notification settings - Fork 15.5k
Closed
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 analyzerconfirmedVerified by a second partyVerified by a second party
Description
The following code w/ ToT LLVM (clang-15) produces the following warnings:
void *x(void) {
return (char*)0 + 42;
}
void *y(void) {
return (void*)0 + 42;
}<source>:2:21: warning: arithmetic on a null pointer treated as a cast from integer to pointer is a GNU extension [-Wnull-pointer-arithmetic]
return (char*)0 + 42;
~~~~~~~~ ^
<source>:6:21: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
return (void*)0 + 42;
~~~~~~~~ ^
for the Linux kernel, we're using -std=gnu11 -Wno-gnu, so we should not be observing ANY warnings that we're using GNU C extensions.
I suspect that these two checks should be split into two different named command line flags, such that the one pertaining to GNU C extensions is placed within the -Wgnu flag group, such that -Wno-gnu implicitly disables it.
(link #4440)
As reported in this thread.
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 analyzerconfirmedVerified by a second partyVerified by a second party