public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jeffrey A Law <law@redhat.com>
To: "Kaveh R. Ghazi" <ghazi@caip.rutgers.edu>
Cc: gcc@gcc.gnu.org
Subject: Re: Using alloca in function parameters buggy or works ???
Date: Thu, 16 Sep 2004 15:52:00 -0000	[thread overview]
Message-ID: <1095348543.10968.1546.camel@localhost.localdomain> (raw)
In-Reply-To: <200409161516.i8GFGOkV010784@caip.rutgers.edu>

On Thu, 2004-09-16 at 09:16, Kaveh R. Ghazi wrote:
> I'm looking over some memory leaks in gcc and I'm seeing lots of funny
> uses of concat like this from gcc.c:is_directory()
> 
>     strcmp (path,
>             concat (dir_separator_str, "lib", dir_separator_str, ".", NULL))
> 
> It's pretty clear this memory allocation never gets free'd.  I'd like
> to replace stuff like this with ACONCAT from libiberty which uses
> alloca and thus doesn't leak.
> 
> Normally people don't like alloca I assume because if the backup
> libiberty C_alloca is used (which uses malloc underneath the hood),
> sometimes stuff isn't free'd because we don't call alloca(0) anywhere.
> Then memory use balloons in some edge cases.
> 
> However we're already leaking here so if it was a "balloon" case we'd
> already know about it. :-)
> 
> I'd like to make as little code change as possible for these cases,
> which means putting the ACONCAT use (and thus a call to alloca) right
> in there as a function call parameter.
> 
> My question is that I seem to recall passing the result of alloca
> immediately as a function parameter was buggy at some point in GCC.
> Using such a version might trigger a bootstrap failure if that buggy
> GCC is used in stage1.
> 
> So I'm wondering:
> 
> 1.  Was this bug in any released version of GCC that we care about?
I believe it was in 2.95 and probably everything leading up to
2.95 as well.

> 2.  Does my example above trigger the bug?
Unfortunately, I don't recall all the parameters needed to trigger
the bug, nor do I recall if it was something that was ultimately
unfixable or not.

jeff



jeff


  reply	other threads:[~2004-09-16 15:29 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-09-16 15:41 Kaveh R. Ghazi
2004-09-16 15:52 ` Jeffrey A Law [this message]
2004-09-16 16:08   ` Graham Stott
2004-09-16 16:23 ` Dave Korn
2004-09-16 16:38   ` Robert Dewar
2004-09-19 14:02     ` Marc Espie
2004-09-16 16:31 ` Andreas Schwab
2004-09-16 16:35   ` Jeffrey A Law
2004-09-16 16:36     ` Dave Korn
2004-09-16 16:43       ` Graham Stott
2004-09-16 17:42         ` Dave Korn
2004-09-16 16:53       ` Andreas Schwab
2004-09-16 16:51 ` DJ Delorie
2004-09-16 17:32   ` Kaveh R. Ghazi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1095348543.10968.1546.camel@localhost.localdomain \
    --to=law@redhat.com \
    --cc=gcc@gcc.gnu.org \
    --cc=ghazi@caip.rutgers.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).