no warnings with -Waddress #42992
Labels
bugzilla
Issues migrated from bugzilla
clang:diagnostics
New/improved warning or error message in Clang, but not in clang-tidy or static analyzer
Extended Description
clang-10 falls to emit the warning for the following:
$ cat s.c
int main()
{
int *a = (void *) 0;
int b = (&a) == ((void *) 0);
return b;
}
$ clang-10 -Weverything -pedantic s.c
clang version 10.0.0 (https://github.com/llvm/llvm-project.git 49c4e58)
Target: x86_64-unknown-linux-gnu
Thread model: posix
[-Waddress] is enabled by default in Clang, but do not issue the warning. When compiled with GCC, warnings such as:
$ gcc -Wall s.c
s.c: In function ‘main’:
s.c:4:16: warning:the comparison will always evaluate as ‘false’ for the address of ‘a’ will never be NULL [-Waddress]
4 | int b = (&a) == ((void *) 0);
| ^~
The text was updated successfully, but these errors were encountered: