unofficial mirror of bug-guile@gnu.org 
 help / color / mirror / Atom feed
From: Andy Wingo <wingo@pobox.com>
To: "Giedrius Statkevičius" <giedriuswork@gmail.com>
Cc: 24005-done@debbugs.gnu.org
Subject: bug#24005: Segfault after playing around a bit
Date: Sat, 23 Jul 2016 12:45:05 +0200	[thread overview]
Message-ID: <87shv0tyz2.fsf@pobox.com> (raw)
In-Reply-To: <20160716114636.GA31653@tyrael> ("Giedrius Statkevičius"'s message of "Sat, 16 Jul 2016 14:46:36 +0300")

Hi :)

On Sat 16 Jul 2016 13:46, Giedrius Statkevičius <giedriuswork@gmail.com> writes:

> scheme@(guile-user)> (define (sqrt-iter guess x) (new-if (good-enough? guess x)
> guess (sqrt-iter (improve guess x) x)))
> scheme@(guile-user)> (sqrt 2)
> <unnamed port>:4:42: In procedure good-enough?:
> <unnamed port>:4:42: Throw to key `vm-error' with args `(vm-run "VM: Stack

What's happening here is that you have a function that uses too much
stack.  In Guile 2.0 there is a fixed amount of stack.  If you exceed
that amount, Guile enters a nested REPL at the error:

> Entering a new prompt.  Type `,bt' for a backtrace or `,q' to continue.
> scheme@(guile-user) [1]> (define (sqrt-iter guess x) (new-if (good-enough? guess
> x) guess x))

So you can get a backtrace to see what's on your stack.  This repl is in
the context of the stack overflow -- so all the frames are still on the
stack.  There's just a little bit of stack reserved so that you can poke
around and see what's going on.  You then cause the stack overflow
again, when it already overflowed, and at some point Guile detects this
and because it can't handle it, it aborts (not segfaults):

> zsh: abort (core dumped)  guile

Ah well.  In Guile 2.0 we can't fix this very nicely.  There's no
corruption here, just a limit that we can't handle.  Fortunately we
fixed it in 2.2:

  https://wingolog.org/archives/2014/03/17/stack-overflow

My machine is down for maintenance atm, should be back shortly, in the
meantime there's

  https://web.archive.org/web/*/https://wingolog.org/archives/2014/03/17/stack-overflow

Anyway.  Thanks for the report, it's a limitation in 2.0 that's fixed in
2.2.

Cheers,

Andy





      reply	other threads:[~2016-07-23 10:45 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-16 11:46 bug#24005: Segfault after playing around a bit Giedrius Statkevičius
2016-07-23 10:45 ` Andy Wingo [this message]

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

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87shv0tyz2.fsf@pobox.com \
    --to=wingo@pobox.com \
    --cc=24005-done@debbugs.gnu.org \
    --cc=giedriuswork@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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).