This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c/54037] Warn pointer to signed integer cast for ilp32


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]