Hi, It seems that a va_list is messed up when doing multiple functioncalls containing the va_list. This only occurs in the 64bit versions of g++ and does NOT occur in the 32bit versions.
This has been seen in versions 4.1.1 and 4.1.2 Below is all the suff you need (buildparameters, testcode and output) Regards Klaas 64 bit version [klaas]$ g++ -v Using built-in specs. Target: x86_64-mandriva-linux-gnu Configured with: ../configure --prefix=/usr --libexecdir=/usr/lib --with-slibdir=/lib64 --mandir=/usr/share/man --infodir=/usr/share/info --enable-checking=release --enable-languages=c,c++,ada,fortran,objc,obj-c++,java --host=x86_64-mandriva-linux-gnu --with-cpu=generic --with-system-zlib --enable-threads=posix --enable-shared --enable-long-long --enable-__cxa_atexit --disable-libunwind-exceptions --enable-clocale=gnu --enable-java-awt=gtk --with-java-home=/usr/lib/jvm/java-1.4.2-gcj-1.4.2.0/jre --enable-gtk-cairo --disable-libjava-multilib --enable-ssp --disable-libssp Thread model: posix gcc version 4.1.2 20070302 (prerelease) (4.1.2-1mdv2007.1) The compiled code <start code> #include <iostream> #include <cstdarg> void f1(int,...); void f1b(int, ...); void f2(va_list); int main(void) { std::cout << "f1" << std::endl; f1(3,1.2,3.6,5.9); std::cout << "f1b" << std::endl; f1b(3,1.2,3.6,5.9); return 0; } /* this function fails */ void f1(int n, ...) { va_list va; va_start(va, n); for (int i = 0; i < 2; ++i) f2(va); va_end(va); } /* this is a solution */ void f1b(int n, ...) { va_list va; for (int i = 0; i < 2; ++i) { va_start(va,n); f2(va); va_end(va); } } void f2(va_list va) { double arg1 = va_arg(va,double); double arg2 = va_arg(va,double); double arg3 = va_arg(va,double); std::cout << arg1 << "\t" << arg2 << "\t" << arg3 << std::endl; } <end code> The 64bit output is given by [EMAIL PROTECTED] g++ bug.cpp [EMAIL PROTECTED] ./a.out f1 1.2 3.6 5.9 3.95253e-323 2.3528e-310 2.3528e-310 f1b 1.2 3.6 5.9 1.2 3.6 5.9 The 32 bit output is given by [EMAIL PROTECTED] g++ bug.cpp [EMAIL PROTECTED] ./a.out f1 1.2 3.6 5.9 1.2 3.6 5.9 f1b 1.2 3.6 5.9 1.2 3.6 5.9 -- Summary: va_list handeling different in 64bit vs 32 bit. Product: gcc Version: 4.1.2 Status: UNCONFIRMED Severity: major Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: Klaas dot Vantournhout at UGent dot be http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31484