From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 32282 invoked by alias); 25 Jun 2004 22:20:10 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 32257 invoked by uid 48); 25 Jun 2004 22:20:07 -0000 Date: Fri, 25 Jun 2004 22:22:00 -0000 From: "netletter at comder dot com" To: gcc-bugs@gcc.gnu.org Message-ID: <20040625222005.16211.netletter@comder.com> Reply-To: gcc-bugzilla@gcc.gnu.org Subject: [Bug c++/16211] New: If mixing templates and va_list (va_arg) and char* string you wont be happy X-Bugzilla-Reason: CC X-SW-Source: 2004-06/txt/msg03281.txt.bz2 List-Id: I hope I do not offend anyone, but this code seems to segfault. Im not even sure what this form wants as host triplet. I read the guidlines, and got the picture that you do not want source, but I cant explain this any other way. Well here goes, hope Ill not make a total fool of myself. The crash comes from an invalid address returned by va_arg( ). Undefine CRASH to see it work as expected. gcc version 3.3 20030226 (prerelease) (SuSE Linux) ------------ Code snipet --------------- #include // va_list #include #define CRASH void func( const char *str,... ); #ifdef CRASH template< class TYPE > bool FormTest( const char* str,char* i ) { func( str,i ); return true; } #else bool FormTest( const char* str,char* i ) { func( str,i ); return true; } #endif int main( void ) { #ifdef CRASH FormTest< char* >( "%s\n","string" ); #else FormTest( "%s\n","string" ); #endif } void func( const char *str,va_list &ap ); void func( const char *str,... ) { va_list ap; va_start( ap,str ); func( str,ap ); va_end( ap ); } void func( const char *str,va_list &ap ) { const char *pek; int i; pek=va_arg( ap,const char* ); printf( str,pek ); } -- Summary: If mixing templates and va_list (va_arg) and char* string you wont be happy Product: gcc Version: 3.3 Status: UNCONFIRMED Severity: normal Priority: P2 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: netletter at comder dot com CC: gcc-bugs at gcc dot gnu dot org GCC host triplet: /lib/ld-linux.so.2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16211