Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 04 Jan 2018 04:07:39 +0000
From:      bugzilla-noreply@freebsd.org
To:        freebsd-ports-bugs@FreeBSD.org
Subject:   [Bug 224669] [exp-run] Against projects/clang600-import branch
Message-ID:  <bug-224669-13-JsN6fXRz88@https.bugs.freebsd.org/bugzilla/>
In-Reply-To: <bug-224669-13@https.bugs.freebsd.org/bugzilla/>
References:  <bug-224669-13@https.bugs.freebsd.org/bugzilla/>

next in thread | previous in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D224669

--- Comment #10 from Jan Beich <jbeich@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[] =3D { "", "bar" };
  if (value[0] =3D=3D '\0')
    return 1;
  return 0;
}
$ cc a.c
$ c++ -std=3Dgnu++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] =3D=3D '\0')
                ^~
a.c:4:7: note: did you mean to dereference the pointer?
   if (value[0] =3D=3D '\0')
       ^
$ g++7 -std=3Dgnu++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] =3D=3D '\0')
                   ^~~~
a.c:4:19: note: did you mean to dereference the pointer?

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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-224669-13-JsN6fXRz88>