From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Strange code in emacs.c Date: Wed, 03 Oct 2018 18:15:11 +0300 Message-ID: <83h8i32ha8.fsf@gnu.org> NNTP-Posting-Host: blaine.gmane.org X-Trace: blaine.gmane.org 1538579723 8339 195.159.176.226 (3 Oct 2018 15:15:23 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Wed, 3 Oct 2018 15:15:23 +0000 (UTC) Cc: emacs-devel@gnu.org To: Noam Postavsky Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Oct 03 17:15:19 2018 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1g7iru-000221-AS for ged-emacs-devel@m.gmane.org; Wed, 03 Oct 2018 17:15:18 +0200 Original-Received: from localhost ([::1]:49281 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g7iu0-00059V-BI for ged-emacs-devel@m.gmane.org; Wed, 03 Oct 2018 11:17:28 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:49330) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g7irv-0003m6-9D for emacs-devel@gnu.org; Wed, 03 Oct 2018 11:15:19 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g7irs-00078R-6E for emacs-devel@gnu.org; Wed, 03 Oct 2018 11:15:19 -0400 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:47031) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g7irs-00077y-17; Wed, 03 Oct 2018 11:15:16 -0400 Original-Received: from [176.228.60.248] (port=2637 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1g7irq-00012o-VW; Wed, 03 Oct 2018 11:15:15 -0400 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e 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:230200 Archived-At: We have this in 'main': emacs_re_safe_alloca = max (min (lim - extra, SIZE_MAX) * (min_ratio / ratio), MAX_ALLOCA); This always yields MAX_ALLOCA because 'ratio' is always greater than 'min_ratio': int min_ratio = 20 * sizeof (char *); int ratio = min_ratio + min_ratio / 3; Don't we mean to set emacs_re_safe_alloca like this instead: emacs_re_safe_alloca = min (lim - extra, SIZE_MAX) / ratio; emacs_re_safe_alloca = max (emacs_re_safe_alloca * min_ratio, MAX_ALLOCA);