[gnu.g++.bug] Bugs in new/delete in g++-1.34.2

SAITO@sdr.slb.com ("Naoki Saito Ext. 5471", GEO-002) (05/23/89)

	Hi!  I recently installed g++-1.34.2 and libg++-1.34.0 on our
Sun3 OS 4.0.1 machine.  The following program could be compiled but
when executed, it produced the out of memory error.  It looks like
there's a bug in new or delete function.
This program is a kind of stupid but easy to explain the problem.

=========================================================================
#include <stream.h>
#include <math.h>
#include <ACG.h>
#include <Uniform.h>
#include "floatAVec.h"

main()
{
  floatAVec array(100);
  floatAVec window(100);
  floatAVec res;
  ACG gen;
  Uniform r(0.0,1.0,&gen);

  for (int i = 0; i < 100; i++)
    {
      array[i] = r();
      window[i] = cos(PI*(i-50)/100);
    }  

  for (i = 0; i < 1000000; i++)
    res = product(array, window);

  exit(0);
}

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

$ g++ -g -v -o newtest newtest.cc floatVec.cc floatAVec.cc -lg++ -lm
g++ version 1.34.2
 /usr/local/lib/gcc-cpp -+ -v -undef -D__GNU__ -D__GNUG__ -Dmc68000 -Dsun -Dunix -D__mc68000__ -D__sun__ -D__unix__ -D__HAVE_68881__ -Dmc68020 newtest.cc /tmp/cca16795.cpp
GNU CPP version 1.34
 /usr/local/lib/gcc-c++ /tmp/cca16795.cpp -quiet -dumpbase newtest.cc -noreg -version -G -o /tmp/cca16795.s
GNU C++ version 1.34.2 (68k, MIT syntax) compiled by GNU C version 1.34.
 as -mc68020 /tmp/cca16795.s -o newtest.o
 /usr/local/lib/gcc-cundf -D__GNU__ -D__GNUG__ -Dmc68000 -Dsun -Dunix -D__mc68000__ -D__sun__ -D__unix__ -D__HAVE_68881__ -Dmc68020 floatVec.cc /tmp/cca16795.cpp
GNU CPP version 1.34
 /usr/local/lib/gcc-c++ /tmp/cca16795.cpp -quiet -dumpbase floatVec.cc -noreg -version -G -o /tmp/cca16795.s
GNU C++ version 1.34.2 (68k, MIT syntax) compiled by GNU C version 1.34.
 as -mc68020 /tmp/cca16795.s -o floatVec.o
 /usr/local/lib/gcc-cpp -+ -v -undef -D__GNU__ -D__GNUG__ -Dmc68000 -Dsun -Dunix -D__mc68000__ -D__sun__ -D__unix__ -D__HAVE_68881__ -Dmc68020 floatAVec.cc /tmp/cca16795.cpp
GNU CPP version 1.34
 /usr/local/lib/gcc-c++ /tmp/cca16795.cpp -quiet -dumpbase floatAVec.cc -noreg -version -G -o /tmp/cca16795.s
GNU C++ version 1.34.2 (68k, MIT syntax) compiled by GNU C version 1.34.
 as -mc68020 /tmp/cca16795.s -o floatAVec.o
 /usr/local/lib/gcc-ld++ -o newtest -C -e __start -dc -dp -Bstatic /usr/local/lib/crt0+.o /usr/lib/Mcrt1.o newtest.o floatVec.o floatAVec.o -lg++ -lm -lg++ /usr/local/lib/gcc-gnulib -lg -lc

$ newtest
default_new_handler: out of memory... aaaiiiiiieeeeeeeeeeeeee!


This kind of memory allocation problem is critical for the people who are
doing numerical computation!

Thanks in your attention,
Naoki Saito (saito@sdr.slb.com)
Schlumberger-Doll Research