[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: A stack overflow problem.
From: |
Ludovic Courtès |
Subject: |
Re: A stack overflow problem. |
Date: |
Thu, 05 Dec 2013 22:19:39 +0100 |
User-agent: |
Gnus/5.130007 (Ma Gnus v0.7) Emacs/24.3 (gnu/linux) |
address@hidden (R. Clayton) skribis:
> $ guile
> GNU Guile 2.0.9-deb+1-1
> Copyright (C) 1995-2013 Free Software Foundation, Inc.
>
> Guile comes with ABSOLUTELY NO WARRANTY; for details type `,show w'.
> This program is free software, and you are welcome to redistribute it
> under certain conditions; type `,show c' for details.
>
> Enter `,help' for help.
> scheme@(guile-user)> (define (naughty) (let ((i 1)) (naughty) i))
> scheme@(guile-user)> (naughty)
> <unnamed port>:1:31: In procedure naughty:
> <unnamed port>:1:31: Throw to key `vm-error' with args `(vm-run "VM: Stack
> overflow" ())'.
>
> Entering a new prompt. Type `,bt' for a backtrace or `,q' to continue.
> scheme@(guile-user) [1]> ,q
> scheme@(guile-user)> (naughty)
> Aborted
>
> $ echo $?
> 134
>
> $
>
> I'm thinking the second call to naughty should give me another stack overflow,
> rather than aborting guile. On the other hand, maybe I didn't reset the
> system
> properly after the first stack overflow. Which is it? If it's the latter,
> what's the proper reset?
A little bit of stack space is needed to throw the exception. To do
that, the VM in Guile 2.0 has a small reserve on its stack, which it
uses on the first overflow (see ‘vm_error_stack_overflow’ in vm.c.)
The problem here is that, when the second overflow occurs, that reserve
has already been used, so it just aborts.
Commit 70057f3 in ‘stable-2.0’ fixes that (will be in 2.0.10.)
Thanks!
Ludo’.