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: unassig...@gcc.gnu.org
        ReportedBy: hjl.to...@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.

Reply via email to