[Bug c/54037] New: Warn pointer to integer cast for ilp32
hjl.tools at gmail dot com
gcc-bugzilla@gcc.gnu.org
Thu Jul 19 21:02:00 GMT 2012
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54037
Bug #: 54037
Summary: Warn pointer to integer cast for ilp32
Classification: Unclassified
Product: gcc
Version: 4.8.0
Status: UNCONFIRMED
Severity: enhancement
Priority: P3
Component: c
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: hjl.tools@gmail.com
On Linux/x86-64,
[hjl@gnu-6 tmp]$ cat x.c
unsigned long long
foo (void *p)
{
return (long) p;
}
[hjl@gnu-6 tmp]$
and
[hjl@gnu-6 tmp]$ cat y.c
unsigned long long
foo (void *p)
{
return (unsigned long) p;
}
[hjl@gnu-6 tmp]$
generate the same code with gcc -m64 since size of long == size of
long long. However, they are different with "gcc -mx32" and x.c may
be incorrect. It is desirable to issue a warning when casting from
pointer to signed integer and then to unsigned integer of different
size.
More information about the Gcc-bugs
mailing list