[Bug c++/52817] g++ do not call a method with same name on some platforms(see small example source attached)

redi at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Sun Apr 1 12:37:00 GMT 2012


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

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> 2012-04-01 12:37:00 UTC ---
(In reply to comment #0)
> void Wsafile::readdata(int NumFiles, va_list args) {
>      long * RWop;
>      printf("readdata 2 called \n");
>      RWop = va_arg(args,long *);
>      printf ("%x ( should be 0x12345678) %d (should be 1) \n",(unsigned
> int)RWop,NumFiles);  // should print 0x12345678

This line is probably the problem, unsigned int is too small to hold a pointer
value, so the value is not preserved.  

Stop using unsafe casts between incompatible types.



More information about the Gcc-bugs mailing list