🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gcc.help
Article #41769

Bogus size in __builtin_new ?

#41769
From: Koert Zeilstra
Date: Fri, 16 Feb 1996 00:00
33 lines
1256 bytes
I ran into an strange behavior is the new handler of g++. When I step into
G++'s new handler whenever I'm doing 'new char[x]', or something, I see
a very large bogus number passed.  With gdb I see:

0xab6fd8 in __builtin_new (sz=269806064) at ./libgcc2.c:1

This is on an SGI Indigo 2 with Irix 5.3. The same happens on a DEC alpha,
and sometimes bombs with a 'virtual memory exceeded'.

I tried to create my own new handler like this:

extern void * operator new (size_t size)
{
  void *p;
  p = malloc (size);
  if (p == 0)
  { cerr << "Memory exhausted; check swap space.\n";
    abort();
  }
  return p;
}

This bombs immediately, and size is very large.

I'm using G++ 2.7.2 on both the SGI and DEC alpha. Is this a gcc bug?

Any help appreciated,
Koert

--
Koert Zeilstra
Work: kzeil@comsearch.com  --  Home: koert@zen.cais.com 
Just my thoughts, not anyone else's.
Technical Details
Message-ID: <4g2cv6$5qg@gateway.comsearch.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 11318c,2a3f1b67df13481,start
X-Google-Attributes: gid11318c,public
From: kzeil@comsearch.com (Koert Zeilstra)
Subject: Bogus size in __builtin_new ?
Date: 1996/02/16
Message-ID: <4g2cv6$5qg@gateway.comsearch.com>
X-Deja-AN: 139640179
organization: Comsearch
newsgroups: gnu.gcc.help