[Bug c++/52817] New: g++ do not call a method with same name on some platforms(see small example source attached)
nospamname at web dot de
gcc-bugzilla@gcc.gnu.org
Sun Apr 1 07:59:00 GMT 2012
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52817
Bug #: 52817
Summary: g++ do not call a method with same name on some
platforms(see small example source attached)
Classification: Unclassified
Product: gcc
Version: 4.5.5
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: nospamname@web.de
See below testprogram for C++.this give on X86 cygwin correct output and i
guess it work on some other platforms too
( this codestyle is used in dunelegacy game). All Compiler i test run on same
OS (windows - cygwin).Only Compiler Options that use. -Wall and -Wextra. But
they give no report on all compilers.
BTW: this is no April joke, i ask about Problem in GCC ML, and i get the answer
to write a Bugreport.
"""
Output from X86 cygwin build (this is ok)
constructor wsafile
readdata 1 called
readdata 2 called
12345678 ( should be 0x12345678) 1 (should be 1)
""""
But with all 68k compilers for amigaos (i test from GCC 3.4.0 to 4.5.x Version
and some between) this execute always wrong.readdata 1 Funtion
is never called and the transfer of the adrress fail
"""""
Output from all m68k amigaos g++ cygwin hostet (this is wrong)
constructor wsafile
readdata 2 called
0 ( should be 0x12345678) 1 (should be 1)
"""""
What can be the problem.I dont understand wy the backend can cause such a
problem. How is that possible
here is the test program
#include <stdarg.h>
#include <stdio.h>
class Wsafile
{
public:
Wsafile(long* RWop);
Wsafile(long* RWop0, long* RWop1);
Wsafile(int num,...);
virtual ~Wsafile();
private:
void readdata(int NumFiles, ...);
void readdata(int NumFiles, va_list args);
};
/// Constructor
/**
The constructor reads from the RWop all data and saves them internal. The
SDL_RWops can be readonly but must support
seeking. Immediately after the Wsafile-Object is constructed RWop can be
closed. All data is saved in the class.
\param RWop SDL_RWops to the wsa-File. (can be readonly)
*/
Wsafile::Wsafile(long *RWop)
{
printf("constructor wsafile\n");
readdata(1,RWop);
}
/// Destructor
Wsafile::~Wsafile()
{
printf("free reach\n");
}
void Wsafile::readdata(int NumFiles, ...) {
printf("readdata 1 called \n");
va_list args;
va_start(args,NumFiles);
readdata(NumFiles,args);
va_end(args);
}
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
}
int
main()
{
long * addr = ( long *)0x12345678;
new Wsafile(addr);
}
More information about the Gcc-bugs
mailing list