[llvm-bugs] [Bug 43647] New: no warnings with -Waddress

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Oct 11 05:48:55 PDT 2019


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: unassignedclangbugs at nondot.org
          Reporter: tangyixuan at mail.dlut.edu.cn
                CC: llvm-bugs at lists.llvm.org, neeilans at live.com,
                    richard-llvm at metafoo.co.uk

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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20191011/67dc6524/attachment.html>


More information about the llvm-bugs mailing list