From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Paul Eggert Newsgroups: gmane.emacs.devel Subject: Re: xnrealloc: How and when to properly use it. Date: Sat, 27 Apr 2019 18:51:51 -0700 Organization: UCLA Computer Science Department Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="184040"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 Cc: Emacs Devel To: Keith David Bershatsky Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Apr 28 03:52:34 2019 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hKYzY-000lmI-Qj for ged-emacs-devel@m.gmane.org; Sun, 28 Apr 2019 03:52:32 +0200 Original-Received: from localhost ([127.0.0.1]:38372 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hKYzX-0002CQ-Hw for ged-emacs-devel@m.gmane.org; Sat, 27 Apr 2019 21:52:31 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:47807) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hKYz0-0002CJ-49 for emacs-devel@gnu.org; Sat, 27 Apr 2019 21:51:59 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hKYyy-0002Wj-41 for emacs-devel@gnu.org; Sat, 27 Apr 2019 21:51:57 -0400 Original-Received: from zimbra.cs.ucla.edu ([131.179.128.68]:59274) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hKYyx-0002Vj-Uf for emacs-devel@gnu.org; Sat, 27 Apr 2019 21:51:56 -0400 Original-Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 5DA0C161857; Sat, 27 Apr 2019 18:51:52 -0700 (PDT) Original-Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id ysbQVe6v9SQt; Sat, 27 Apr 2019 18:51:51 -0700 (PDT) Original-Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id AB0C616188B; Sat, 27 Apr 2019 18:51:51 -0700 (PDT) X-Virus-Scanned: amavisd-new at zimbra.cs.ucla.edu Original-Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id ks3o2c2MAGN7; Sat, 27 Apr 2019 18:51:51 -0700 (PDT) Original-Received: from [192.168.1.9] (cpe-23-242-74-103.socal.res.rr.com [23.242.74.103]) by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id 8535316162A; Sat, 27 Apr 2019 18:51:51 -0700 (PDT) In-Reply-To: Content-Language: en-US X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 131.179.128.68 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:235996 Archived-At: Keith David Bershatsky wrote: > On a W32 build of Emacs (built with MinGW_32 and ezwinports downloaded a few years ago), my usage of xnrealloc (more often than not) causes Emacs to crash when_not_ running under gdb. Try the GDB command 'set disable-randomization off'. Of course this makes debugging more ... interesting. + /* Decrease the size of the array to a bare minimum. */ + xnrealloc (w->mc_elts.caches, 1, sizeof *w->mc_elts.caches); That can't be right; at the very least you need to assign the returned value of xnrealloc back to w->mc_elts.caches.