public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* libstdc++/6712: __default_alloc_template erroneously calls realloc
@ 2002-05-17 23:26 brd
  0 siblings, 0 replies; 4+ messages in thread
From: brd @ 2002-05-17 23:26 UTC (permalink / raw)
  To: gcc-gnats


>Number:         6712
>Category:       libstdc++
>Synopsis:       __default_alloc_template erroneously calls realloc
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri May 17 23:26:00 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     Tony Bryant
>Release:        CVS build 17 May 2002
>Organization:
>Environment:
all
>Description:
In bits/stl_alloc.h (CVS rev 1.19)

__default_alloc_template<threads, inst>::reallocate

calls "realloc". "realloc" is of course part of the C malloc/free/realloc system, whereas the rest of the class uses the mem_interface system.

On systems where operator new doesn't directly call malloc, havoc ensues quickly...

On systems where realloc is not implemented at all, the library simply cannot be used.
>How-To-Repeat:

>Fix:
Simple fix is to remove the whole if clause that contains the call to realloc.
>Release-Note:
>Audit-Trail:
>Unformatted:


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: libstdc++/6712: __default_alloc_template erroneously calls realloc
@ 2002-06-27 15:07 Phil Edwards
  0 siblings, 0 replies; 4+ messages in thread
From: Phil Edwards @ 2002-06-27 15:07 UTC (permalink / raw)
  To: pme; +Cc: gcc-prs

The following reply was made to PR libstdc++/6712; it has been noted by GNATS.

From: Phil Edwards <phil@jaj.com>
To: gcc-gnats@gcc.gnu.org
Cc: brd@paradise.net.nz, gcc-bugs@gcc.gnu.org
Subject: Re: libstdc++/6712: __default_alloc_template erroneously calls realloc
Date: Thu, 27 Jun 2002 17:53:33 -0400

 On Sat, Jun 01, 2002 at 01:46:02AM -0000, Phil Edwards wrote:
 >  The easiest "fix" would be to just rip out all the reallocation routines
 >  that SGI had in their code.  Unused, nonstandard, and (as you've just
 >  pointed out) potentially fatal.
 
 For the record, this is what I'm in the middle of doing.  The reallocate()
 member functions will be present in 3.2, but deprecated, and will be
 removed entirely in 3.3.
 
 
 Phil
 
 -- 
 If ye love wealth greater than liberty, the tranquility of servitude greater
 than the animating contest for freedom, go home and leave us in peace.  We seek
 not your counsel, nor your arms.  Crouch down and lick the hand that feeds you;
 and may posterity forget that ye were our countrymen.            - Samuel Adams


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: libstdc++/6712: __default_alloc_template erroneously calls realloc
@ 2002-05-31 18:46 Phil Edwards
  0 siblings, 0 replies; 4+ messages in thread
From: Phil Edwards @ 2002-05-31 18:46 UTC (permalink / raw)
  To: pme; +Cc: gcc-prs

The following reply was made to PR libstdc++/6712; it has been noted by GNATS.

From: Phil Edwards <phil@jaj.com>
To: brd@paradise.net.nz
Cc: gcc-gnats@gcc.gnu.org
Subject: Re: libstdc++/6712: __default_alloc_template erroneously calls realloc
Date: Fri, 31 May 2002 21:40:01 -0400

 On Sat, May 18, 2002 at 06:16:34AM -0000, brd@paradise.net.nz wrote:
 > >Description:
 > In bits/stl_alloc.h (CVS rev 1.19)
 > 
 > __default_alloc_template<threads, inst>::reallocate
 > 
 > calls "realloc". "realloc" is of course part of the C malloc/free/realloc
 > system, whereas the rest of the class uses the mem_interface system.
 
 Crumbs.  I wonder how I missed that.
 
 > On systems where operator new doesn't directly call malloc, havoc ensues
 > quickly...
 
 Well, we provide operator new, and it always uses malloc.  But of course the
 users can define their own ::operator new which must be used.
 
 *looks at stl_alloc.h again*
 
 Ah, that's why I missed this.  ISO allocators aren't required to provide
 a reallocate() function, and the new_alloc class in use doesn't.  I'll change
 this PR to low priority.
 
 *looks at the rest of the library*
 
 Nothing ever takes advantage of a reallocate function.  Hmmmm.
 
 
 The easiest "fix" would be to just rip out all the reallocation routines
 that SGI had in their code.  Unused, nonstandard, and (as you've just
 pointed out) potentially fatal.
 
 Really, though, I'd like to make reallocation work, and then make parts of
 the rest of the library take advantage of it of possible.  I can think of an
 easy way to write new_alloc::reallocate, but it would suck.  Must think more.
 
 
 > On systems where realloc is not implemented at all, the library simply
 > cannot be used.
 
 If realloc isn't implemented, then their C library is noncompliant, and they
 will have bigger problems.  Since we do not provide a C library, we must assume
 that the one already in place has basic functionality.
 
 
 > >Fix:
 > Simple fix is to remove the whole if clause that contains the call to realloc.
 
 Can't really do that; the memory pool is only set up to handle requests
 of up to a certain size, with larger requests being fed directly on to
 whatever underlying mem_interface is in use.  If reallocate receives a
 too-large request (the if clause), then it can't handle it, and must feed
 it on to something else.  And I suspect that this happens quite a bit.
 
 
 Phil
 
 -- 
 If ye love wealth greater than liberty, the tranquility of servitude greater
 than the animating contest for freedom, go home and leave us in peace.  We seek
 not your counsel, nor your arms.  Crouch down and lick the hand that feeds you;
 and may posterity forget that ye were our countrymen.            - Samuel Adams


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: libstdc++/6712: __default_alloc_template erroneously calls realloc
@ 2002-05-31 18:43 pme
  0 siblings, 0 replies; 4+ messages in thread
From: pme @ 2002-05-31 18:43 UTC (permalink / raw)
  To: brd, gcc-bugs, gcc-prs, nobody, pme

Synopsis: __default_alloc_template erroneously calls realloc

Responsible-Changed-From-To: unassigned->pme
Responsible-Changed-By: pme
Responsible-Changed-When: Fri May 31 18:38:14 2002
Responsible-Changed-Why:
    Shoulda caught it the last time I was in stl_alloc.h.
State-Changed-From-To: open->analyzed
State-Changed-By: pme
State-Changed-When: Fri May 31 18:38:14 2002
State-Changed-Why:
    Analysis in the audit trail.

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=6712


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2002-06-27 21:56 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-05-17 23:26 libstdc++/6712: __default_alloc_template erroneously calls realloc brd
2002-05-31 18:43 pme
2002-05-31 18:46 Phil Edwards
2002-06-27 15:07 Phil Edwards

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).