Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: crash/hang with gcc 5+ -O2 and --enable-zsh-mem
- X-seq: zsh-workers 42404
- From: Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx>
- To: zsh workers <zsh-workers@xxxxxxx>
- Subject: Re: crash/hang with gcc 5+ -O2 and --enable-zsh-mem
- Date: Mon, 26 Feb 2018 20:24:46 +0000
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ntlworld.com; s=meg.feb2017; t=1519676686; bh=p4nw9Vob3LJ/eEWvye/L2Up2CISKv1IMcX3iXbdKIik=; h=Date:From:To:Subject:In-Reply-To:References; b=4RUWZ0qL/a42Y++D9SHPP08gJTA/6xXE5xzBptk1j/S0C+Xhhtvw9r+nz+Tsdwvj/ YWNwzMve7C4uIbmvg9YBDVqRDZPYdZe3X9nVM7QJOE1mfXbTRZBjBe8NGdKF2/E+05 X/AY8R6jtfQdK5lOcHatpXDzhR2ZvU3pLC77SwTrkbVbiL2XYTfbCnSjlV5w+2dTfn 9EsChy6QjGNhOjxd1nj7rTtEOx3+ylPlUgqLWDXxOrIQjAXA3NH0VsEy4myvhFI7iF abbDeiZjKGB2l2XEselkCU3FRvI8KU9t8lSIN3n4cVJMSNrjV2S/SZEwFlbfhAGKIy 9AC5kjsSHdYiA==
- In-reply-to: <20180225070637.2weeeu63fhm4ebqk@gmail.com>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- List-unsubscribe: <mailto:zsh-workers-unsubscribe@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <CAHYJk3ScwwWYGBHVXDASaWDkxamUFYQjAgEzEWD=NhcbOTVsrA@mail.gmail.com> <20180225001334.fzsdcy67cnosvj5z@gmail.com> <20180225070637.2weeeu63fhm4ebqk@gmail.com>
On Sat, 24 Feb 2018 21:06:37 -1000
Joey Pabalinas <joeypabalinas@xxxxxxxxx> wrote:
> diff --git a/Src/mem.c b/Src/mem.c
> index 840bbb6e4a4eb6fd73..f1208197b3ddac2139 100644
> --- a/Src/mem.c
> +++ b/Src/mem.c
> @@ -1719,7 +1719,13 @@ calloc(MALLOC_ARG_T n, MALLOC_ARG_T size)
> if (!(l = n * size))
> return (MALLOC_RET_T) m_high;
>
> - r = malloc(l);
> + /*
> + * use realloc() (with a NULL `p` argument it behaves exactly the same
> + * as malloc() does) to prevent an infinite loop caused by sibling-call
> + * optimizations (the malloc() call would otherwise be replaced by an
> + * unconditional branch back to line 1719 ad infinitum).
> + */
> + r = realloc(NULL, l);
>
> memset(r, 0, l);
Was going to object some older realloc()s don't support that behaviour,
but this is quite specifically in zsh memory management where realloc()
is explicitly defined, duh.
Can't see a problem with this apart from a minor performance hit.
calloc isn't used anywhere this would be a big deal, I don't think. I
committed it, thanks.
I suppose gcc really wants looking at too...
pws
Messages sorted by:
Reverse Date,
Date,
Thread,
Author