This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
sprintf core dumps compiling with gcc 2.95 for ultrasparc
- To: bug-gcc at gnu dot org
- Subject: sprintf core dumps compiling with gcc 2.95 for ultrasparc
- From: Phil Lu <lu at arlut dot utexas dot edu>
- Date: Thu, 09 Mar 2000 16:31:26 -0600
- Organization: Applied Research Laboratories
//sprintf core dumps compiling with gcc 2.95 for ultrasparc with:
// g++ -v --save-temps -mcpu=v9 -Wa,-xarch=v8plusa main.cc
//This little snippet core dumps for gcc 2.95 but not for 2.8.1
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char* argv[])
{
// ---- Test sprintf bug compiled for ultrasparc
printf("Checking to see if compiler has core dump problem ...\n");
printf(" It happens with gcc 2.95+ 'g++ -v --save-temps -mcpu=v9 \
-Wa,-xarch=v8plusa'.\n");
float v=0;
char buf[1024];
//#define MAKE_COMPILER_BUG_GO_AWAY
#if defined(MAKE_COMPILER_BUG_GO_AWAY)
sprintf(buf, "%%07.3f", v);
#endif
sprintf(buf, "%d%d%d%d%d%d%f", 1,1,1,1,1,1,v);
printf("**** GOOD ... Did not core dump due to sprintf()!\n");
// ---- End of bug testing
return 0;
}
Thanks,
Phil.
------- Phil Lu ------- =|||---------|||= ----- Sys Admin/Developer
On Site: Applied Research Laboratories * Work: 512.835.3480
The University of Texas at Austin FAX: 512.835.3259
Mail To: PO Box 8029, Austin, TX 78713
Ship To: 10000 Burnet Rd., Austin, TX 78758 lu@arlut.utexas.edu
bug-sprintf-2.95.tgz
bug-sprintf-2.8.1.tgz