The following code does not generate any warning when
compiled with g++ 4.0.x and 4.1.x on a x86_64 platform:



/*
#include <cstdio>

int f(void);

int f(void)
{
   return (long) &std::printf;
}
*/

typedef unsigned long mysize_t;
void *mymmap(void *start, mysize_t length, int prot , int flags, int fd, int
offset);

//typedef unsigned long DWORD;
typedef unsigned int DWORD;

struct UDA {
  DWORD UserDirectAddr;
  DWORD TransAddr;
  DWORD Bytes;
};


void f(UDA *puda);

void f(UDA *puda)
{
   puda->UserDirectAddr = 
       (unsigned long) mymmap((void *) puda->TransAddr, 
                              puda->Bytes,
                              0, 0, 0, 0);
}



When compiled with g++ 3.4.6 on the same platform,
the following warning is issued:

g++ -c test.cpp

test.cpp: In function `void f(UDA*)':
test.cpp:30: warning: cast to pointer from integer of different size


-- 
           Summary: Cast to pointer from integer of different size [gcc
                    4.0.x  and 4.1.x on x86_64]
           Product: gcc
           Version: 4.0.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: denis dot charland at imi dot cnrc-nrc dot gc dot ca


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28584

Reply via email to