all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Daniel Colascione <dancol@dancol.org>
To: 18995@debbugs.gnu.org
Cc: haroogan@gmail.com
Subject: bug#18995: Error: Could not reserve dynamic heap area.
Date: Sun, 09 Nov 2014 16:40:17 +0000	[thread overview]
Message-ID: <545F98F1.5000906@dancol.org> (raw)
In-Reply-To: <837fz4pc4o.fsf@gnu.org>

[-- Attachment #1: Type: text/plain, Size: 1771 bytes --]

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 <dancol@dancol.org>
>> 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?
> 
> 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 source
>>> 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.
> 
> 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.



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

  parent reply	other threads:[~2014-11-09 16:40 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-08 15:22 bug#18995: Error: Could not reserve dynamic heap area Alexander Shukaev
2014-11-08 17:29 ` Eli Zaretskii
2014-11-08 18:17   ` Alexander Shukaev
2014-11-08 18:30     ` Eli Zaretskii
2014-11-08 18:40       ` Alexander Shukaev
2014-11-08 18:57         ` Eli Zaretskii
2014-11-08 19:16           ` Alexander Shukaev
2014-11-08 19:50             ` Eli Zaretskii
2014-11-08 19:58               ` Alexander Shukaev
2014-11-08 20:05                 ` Eli Zaretskii
2014-11-08 20:49                   ` Daniel Colascione
2014-11-09 16:12                     ` Eli Zaretskii
2014-11-09 16:30                       ` Andreas Schwab
2014-11-09 16:47                         ` Eli Zaretskii
     [not found]                       ` <545F94E4.5060102@dancol.org>
2014-11-09 16:30                         ` Alexander Shukaev
     [not found]                         ` <837fz4pc4o.fsf@gnu.org>
2014-11-09 16:40                           ` Daniel Colascione [this message]
2014-11-09 16:35                       ` Andreas Schwab
2014-11-09 16:39                         ` Alexander Shukaev
2014-11-09 16:49                           ` Eli Zaretskii
2014-11-09 16:53                             ` Alexander Shukaev
2014-11-09 17:17                               ` Eli Zaretskii
2014-11-09 17:14                         ` Eli Zaretskii

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=545F98F1.5000906@dancol.org \
    --to=dancol@dancol.org \
    --cc=18995@debbugs.gnu.org \
    --cc=haroogan@gmail.com \
    /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.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.