This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/54037] Warn pointer to signed integer cast for ilp32
- From: "hjl.tools at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 19 Jul 2012 22:04:39 +0000
- Subject: [Bug c/54037] Warn pointer to signed integer cast for ilp32
- Auto-submitted: auto-generated
- References: <bug-54037-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54037
--- Comment #3 from H.J. Lu <hjl.tools at gmail dot com> 2012-07-19 22:04:39 UTC ---
(In reply to comment #2)
> (In reply to comment #1)
> > Created attachment 27836 [details]
> > A patch to add -Wpointer-to-signed-int-cast
>
> This won't work for intptr_t which is a signed integer type.
-Wpointer-to-signed-int-cast will issue a warning for
[hjl@gnu-6 pr54037]$ cat foo.c
#include <stdint.h>
unsigned long long
foo (void *p)
{
return (intptr_t) p;
}
[hjl@gnu-6 pr54037]$
-Wpointer-to-signed-int-cast is used to help catch the potential
point to signed integer cast issue. It shouldn't be turned on
by default.