http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52817
--- Comment #6 from bernd_afa <nospamname at web dot de> 2012-04-01 13:26:40 UTC --- >Not a bug. An ellipses conversion sequence is worse than a standard conversion >sequence, thus readdata(int,void*) is preferred over readdata(int,...) when the >actual arguments are (int,long*). The bad cast i only do to avoid extern include files. normaly it use SDL. The problem happen because the address of the SDL_RWops structure is transfer wrong. Same in the SDL program, because the 1. method "Wsafile::readdata(int NumFiles, ...)" is not call on amigaos target. Wsafile::Wsafile(SDL_RWops* RWop) { readdata(1,RWop); } I attach complete preprocessed file, va-list is used with __builtin_va_list.currently i have test with 4.5.0 now but other compiler have same include. The include for stdarg.h come from the compiler build. command line was this: m68k-amigaos-g++ eh-vararg-3.cpp -Wall -Wextra -E > preproc the result # 1 "eh-vararg-3.cpp" # 1 "<built-in>" # 1 "<command-line>" # 1 "eh-vararg-3.cpp" # 1 "/usr/local/amiga/lib/gcc/m68k-amigaos/4.5.0/include/stdarg.h" 1 3 4 # 43 "/usr/local/amiga/lib/gcc/m68k-amigaos/4.5.0/include/stdarg.h" 3 4 typedef __builtin_va_list __gnuc_va_list; # 105 "/usr/local/amiga/lib/gcc/m68k-amigaos/4.5.0/include/stdarg.h" 3 4 typedef __gnuc_va_list va_list; # 2 "eh-vararg-3.cpp" 2 ... this is the mail i write to GCC ML. This show more code about the real program that fail hello there is a C++ game called dunelegacy which work on other GCC architecture ok On G++ 68k it compile ok, but produce wrong code, because there seem something diffrent in va_list. The value of SDL_RWops is transfer wrong. I do not understand what backend problem is possible to cause this. Please help.va_list use the builtin GCC functions this happen on all 68k compilers i test. (3.x and some 4.x) See also the source attached of this class the program flow of the critical part begin here. Wsafile::Wsafile(SDL_RWops* RWop) { readdata(1,RWop); } ...... now there are 2 Methods named readdata, and gcc call the 2. one. This work wrong. Only when called the first is ok. ..... void Wsafile::readdata(int NumFiles, ...) { va_list args; va_start(args,NumFiles); readdata(NumFiles,args); va_end(args); } /// Helper method for reading and concatinating various WSA-Files. /** This methods reads from the RWops all data and concatinates all the frames to one animation. The SDL_RWops can be readonly but must support seeking. \param NumFiles Number of SDL_RWops \param args SDL_RWops for each wsa-File should be in this va_list. (can be readonly) */ void Wsafile::readdata(int NumFiles, va_list args) { unsigned char** Filedata; Uint32** Index; Uint16* NumberOfFrames; bool* extended; if((Filedata = (unsigned char**) malloc(sizeof(unsigned char*) * NumFiles)) == NULL) { fprintf(stderr, "Wsafile::readdata(): Unable to allocate memory!\n"); exit(EXIT_FAILURE); } ..................... when i change code to this and rename the first readdata method to readdata_first then it work Wsafile::Wsafile(SDL_RWops* RWop) { readdata_first(1,RWop); <---- I change that line } now there is called this method before and all work ok void Wsafile::readdata_frist(int NumFiles, ...) { <---- I rename readdata to readdata_first. va_list args; va_start(args,NumFiles); readdata(NumFiles,args); va_end(args); } /// Helper method for reading and concatinating various WSA-Files. /** This methods reads from the RWops all data and concatinates all the frames to one animation. The SDL_RWops can be readonly but must support seeking. \param NumFiles Number of SDL_RWops \param args SDL_RWops for each wsa-File should be in this va_list. (can be readonly) */ void Wsafile::readdata(int NumFiles, va_list args) { unsigned char** Filedata; Uint32** Index; Uint16* NumberOfFrames; bool* extended; if((Filedata = (unsigned char**) malloc(sizeof(unsigned char*) * NumFiles)) == NULL) { fprintf(stderr, "Wsafile::readdata(): Unable to allocate memory!\n"); exit(EXIT_FAILURE); } .......... int WsaFilesize; RWop = va_arg(args,SDL_RWops*); Filedata[i] = readfile(RWop,&WsaFilesize); <--- here crash, when not the 1. method is called before Bye