From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Daniel Colascione Newsgroups: gmane.emacs.bugs Subject: bug#18995: Error: Could not reserve dynamic heap area. Date: Sun, 09 Nov 2014 16:40:17 +0000 Message-ID: <545F98F1.5000906@dancol.org> References: <834mu9r47v.fsf@gnu.org> <83y4rlpmsr.fsf@gnu.org> <83wq75plkm.fsf@gnu.org> <83vbmppj4a.fsf@gnu.org> <83r3xdpiex.fsf@gnu.org> <545E81BD.8070904@dancol.org> <83egtcpd3z.fsf@gnu.org> <545F94E4.5060102@dancol.org> <837fz4pc4o.fsf@gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="e71xFiISw5SCnd0LvGsa8muwfEBGGkPh5" X-Trace: ger.gmane.org 1415551286 9243 80.91.229.3 (9 Nov 2014 16:41:26 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 9 Nov 2014 16:41:26 +0000 (UTC) Cc: haroogan@gmail.com To: 18995@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Nov 09 17:41:19 2014 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1XnVYF-0003n5-Eu for geb-bug-gnu-emacs@m.gmane.org; Sun, 09 Nov 2014 17:41:19 +0100 Original-Received: from localhost ([::1]:39238 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XnVYF-0002a0-4F for geb-bug-gnu-emacs@m.gmane.org; Sun, 09 Nov 2014 11:41:19 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:50298) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XnVY5-0002Zj-6L for bug-gnu-emacs@gnu.org; Sun, 09 Nov 2014 11:41:15 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XnVXy-0003Ck-Mz for bug-gnu-emacs@gnu.org; Sun, 09 Nov 2014 11:41:09 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:57743) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XnVXy-0003Cf-Ik for bug-gnu-emacs@gnu.org; Sun, 09 Nov 2014 11:41:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1XnVXy-0002sI-3P for bug-gnu-emacs@gnu.org; Sun, 09 Nov 2014 11:41:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Daniel Colascione Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 09 Nov 2014 16:41:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 18995 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 18995-submit@debbugs.gnu.org id=B18995.141555123411008 (code B ref 18995); Sun, 09 Nov 2014 16:41:02 +0000 Original-Received: (at 18995) by debbugs.gnu.org; 9 Nov 2014 16:40:34 +0000 Original-Received: from localhost ([127.0.0.1]:54956 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XnVXW-0002rT-0p for submit@debbugs.gnu.org; Sun, 09 Nov 2014 11:40:34 -0500 Original-Received: from dancol.org ([96.126.100.184]:52900) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XnVXP-0002rH-H8 for 18995@debbugs.gnu.org; Sun, 09 Nov 2014 11:40:31 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=dancol.org; s=x; h=Content-Type:In-Reply-To:References:Subject:CC:To:MIME-Version:From:Date:Message-ID; bh=if7JHdm1J3exOWywr3uSGuCmj3ZYz5ANcBN3sL4javg=; b=ZMlB9xZk+9YT+JRna6OCqjQ9jKypjZWqWw8DR1CRz3Ft9q/U4t4DRuyWiW2anGjyL9aVXwvKzin55H1O3WduoUbnZcIHgu6aNelSTnlhUgDgg/reBMt7Dpe4nVFckhqd8WlZx9LhKNMCc50kyYjUOtJI5NwILvPn8e2IkvHzKlbC/M5V3rxjjjqvQzqC/zrokN/44bfrKVA51v2svOYbeExAG0qLeWDQrJSB/zKg16QkYM/FSqSlGdqyGhytmGDYxf/HDbrnDmKSQ2NqOTkYamD0FLQCdhDwpKWeHH4993oknvPi8XVkbhyEsQKXaz1BX6jHu9Bsl4iF5Z1m6CveWA==; Original-Received: from [81.168.70.173] (helo=[192.168.1.11]) by dancol.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84) (envelope-from ) id 1XnVXN-0002p7-Dl; Sun, 09 Nov 2014 08:40:25 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.2.0 In-Reply-To: <837fz4pc4o.fsf@gnu.org> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:95776 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --e71xFiISw5SCnd0LvGsa8muwfEBGGkPh5 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable On 11/09/2014 04:33 PM, Eli Zaretskii wrote: > Why off-list? User error. Re-adding the list. >> Date: Sun, 09 Nov 2014 16:23:00 +0000 >> From: Daniel Colascione >> CC: haroogan@gmail.com >> >>> There's nothing wrong with the address space, and there's nothing >>> wrong with GCC, either. What we have here is a genuine bug in our >>> code, albeit one that is subtle, and also very hard to actually >>> reproduce in real life. >> >> How can this be a bug in our code? >=20 > Because whoever wrote that loop intended it to stop and bail out at > 0x00100000. And that cannot happen with unsigned subtraction. Sure. And the fix you installed is good, but the bug shouldn't have caused GCC to reduce the loop to one iteration. >>> It looked like a GCC bug at first, but as I tried to modify the sourc= e >>> and look at the effect of that on the generated code, it finally >>> dawned on me: GCC's loop-unrolling code simply correctly calculated >>> that with the initial value of 0x68000000 and decrement of 0x00800000= , >>> the value of 'size' in the loop will never be less than 0x00100000, >>> due to wraparound in the subtraction of unsigned values. So what we >>> have here is a potentially infinite loop, i.e. "undefined behavior". >> >> I don't think the compiler is justified in making this optimization. >> Since when is an infinite loop undefined behavior? GCC has no right to= >> alter program semantics in this case, loop unrolling or no. >=20 > OK, I'm not a C Standard lawyer, so I won't argue here. It's enough > for me to know that the trivial fix I installed makes the code work > even under -funroll-loops, and that it fixes a real problem in our > code. Sure, as well as exposing one in GCC. --e71xFiISw5SCnd0LvGsa8muwfEBGGkPh5 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBCAAGBQJUX5jxAAoJEN4WImmbpWBl9gAP/05ADliGErFrfTFCFjgfDANt 2GunWsBj/Yanijng77lHxyFLs6MY/LFi8i1OSF8wFLRZW9NPeoP2K8iVHhDsJ/cX 3bIl1pAvjDSzmLDc83F4ENnynaxWPkNTtqcF9hGqWiICAHaqhKwDtXa3oB++Roh8 7Ah64EdV6SNkhKNs7BNcaDFWSqEgKrqeSvK32RCZ5tdeklTWyvbISmbH1KpGErTI UgRrzUUOrP5FDAHdMxJ4zF0UQ9B3yq9QCJ8ixaXHRLCBMpTVyLWhwBii6K8JAXhl /4CoeVccBB5tCAAxl4aahYbs/MYZdfy7tp26l0AAfx7YAHXLPpEHfcAKS309OW4I BuFYBIAkRpjPPiihphyrqc/QBF07ZbSR/Ib+GoJG5FnM0yg6VImMflKqYwDtwGrb 6lme/DOJGw7GsEpm1x7eg+Suia+Rejg2mb7MjWXhR8JvmPkNf21Y6cwNbccV4K8k z6Qt5TEyy5IEKGK00KQ709gGdhkA8sz/Eo7PzSOf2YEH3eP9Z5xa1Biq1UeRHjnh MXpcN/Pk9v1YaLoQDfZn+gDw1E5+WuGSdMiVEo/SAd5YTrT8gwGoBTd5FYg8I6et 6HlplyxGFt9oaiUd+wKMAMORT0PdTa+1l6BRyJT47eRJVzY/tcOak8+AJJmGpJZw QxDavgtc5jBOdF/9ASum =2pyV -----END PGP SIGNATURE----- --e71xFiISw5SCnd0LvGsa8muwfEBGGkPh5--