https://bugs.llvm.org/show_bug.cgi?id=43647

            Bug ID: 43647
           Summary: no warnings with -Waddress
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Frontend
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected],
                    [email protected]

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
49c4e58b75ecec8dce75dd13c61aaeb30e14b531)
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);
       |                      ^~

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to