This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Possible g++ bug




  H.J.,

       I don't have sufficient authority on any
  alphaev56-unknown-linux-gnu system to be able
  to swear this this bug is not due to the local
  environment.  I would be grateful if you would
  make a test for me.

  Break the text below into two files, say BugTest.cc
  and BugTestLib.cc

  g++ -o BugTest -O0 BugTest.cc BugTestLib.cc

  Everything is fine on ix86 and powerpc (32 bits),
  but with egcs-1.1.2, binutils-2.9.1.0.23 and
  libc-2.0.7pre6, on our Linux-Alpha's  => memory leak.
  Current egcs-CVS-mainline does the same thing.

  Maybe the example has been stripped back too far to
  be realistic but, in any case, it should not gobble
  memory. 

  I would value your opinion.

  Roger Brown


======================================================

//---------------------------------------------------------------
//  BugTest.cc:
#include <string>

std::string upcase(const std::string& s);

void main(int nargs, char *argv[])
{
   int reps = 1000000;
   int phase = 0;
   std::string valueString("EMPTY");

   for (int ii = 0; ii < reps; ii++) {
      if (upcase(valueString) == "EMPTY")
         phase = 1;
   }
}
//---------------------------------------------------------------

//---------------------------------------------------------------
//  BugTestLib.cc:
#include <string>

std::string upcase(const std::string& s)
{
   std::string s2(s);

   for(unsigned int ii = 0; ii < s2.length(); ii++)
      s2[ii] = toupper(s2[ii]);

   return s2;
}
//---------------------------------------------------------------


  
---------------------------------------------
bregor@anusf.anu.edu.au   +61 2 6249-2046   (02) 6249-2046
Date: 11-Apr-99            Time: 14:35:05

Australian National University Supercomputer Facility
=====================================================


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]