[Bug 224669] [exp-run] Against projects/clang600-import branch

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Thu Jan 4 04:07:39 UTC 2018


https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=224669

--- Comment #10 from Jan Beich <jbeich at FreeBSD.org> ---
Notice how "comparison between pointer and integer" issue is similar to
"ordered comparison between pointer and integer". Clang prefers to not warn
about possible bugs unless it's C++ or C++11.

$ cat a.c
int main()
{
  const char *value[] = { "", "bar" };
  if (value[0] == '\0')
    return 1;
  return 0;
}
$ cc a.c
$ c++ -std=gnu++98 -x c++ a.c
$ gcc7 a.c
a.c: In function 'main':
a.c:4:16: warning: comparison between pointer and zero character constant
[-Wpointer-compare]
   if (value[0] == '\0')
                ^~
a.c:4:7: note: did you mean to dereference the pointer?
   if (value[0] == '\0')
       ^
$ g++7 -std=gnu++98 -x c++ a.c
a.c: In function 'int main()':
a.c:4:19: warning: comparison between pointer and zero character constant
[-Wpointer-compare]
   if (value[0] == '\0')
                   ^~~~
a.c:4:19: note: did you mean to dereference the pointer?

-- 
You are receiving this mail because:
You are on the CC list for the bug.


More information about the freebsd-ports-bugs mailing list