From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Neil Jerram Newsgroups: gmane.lisp.guile.bugs Subject: Re: Segmentation fault Date: Fri, 19 Oct 2007 00:31:39 +0100 Message-ID: <87k5pkf19g.fsf@ossau.uklinux.net> References: <20071010180101.219520@gmx.net> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1192750314 16669 80.91.229.12 (18 Oct 2007 23:31:54 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 18 Oct 2007 23:31:54 +0000 (UTC) Cc: bug-guile@gnu.org To: "frank schwidom" Original-X-From: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Fri Oct 19 01:31:54 2007 Return-path: Envelope-to: guile-bugs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1IieqH-0007jy-Jz for guile-bugs@m.gmane.org; Fri, 19 Oct 2007 01:31:54 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IieqA-0000Kf-6z for guile-bugs@m.gmane.org; Thu, 18 Oct 2007 19:31:46 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Iieq6-0000Ka-OE for bug-guile@gnu.org; Thu, 18 Oct 2007 19:31:42 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Iieq6-0000KO-8H for bug-guile@gnu.org; Thu, 18 Oct 2007 19:31:42 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Iieq6-0000KL-32 for bug-guile@gnu.org; Thu, 18 Oct 2007 19:31:42 -0400 Original-Received: from mail3.uklinux.net ([80.84.72.33]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Iieq5-0005iT-JR for bug-guile@gnu.org; Thu, 18 Oct 2007 19:31:41 -0400 Original-Received: from arudy (host86-145-176-36.range86-145.btcentralplus.com [86.145.176.36]) by mail3.uklinux.net (Postfix) with ESMTP id 8DB3A1F6A97; Fri, 19 Oct 2007 00:31:40 +0100 (BST) Original-Received: from laruns (unknown [192.168.0.10]) by arudy (Postfix) with ESMTP id 0633638009; Fri, 19 Oct 2007 00:31:39 +0100 (BST) In-Reply-To: <20071010180101.219520@gmx.net> (frank schwidom's message of "Wed, 10 Oct 2007 20:01:01 +0200") User-Agent: Gnus/5.110006 (No Gnus v0.6) Emacs/21.4 (gnu/linux) X-detected-kernel: by monty-python.gnu.org: Linux 2.4-2.6 X-BeenThere: bug-guile@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Bug reports for GUILE, GNU's Ubiquitous Extension Language" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Errors-To: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.bugs:3626 Archived-At: "frank schwidom" writes: > -------- Original-Nachricht -------- > Datum: Wed, 10 Oct 2007 18:27:42 +0200 > Von: "frank schwidom" > An: bug-guile@gnu.org > Betreff: Segmentation fault > > Hi > > the following code leads to an segmentation fault in guile-1.6 and guile-= 1.8, when executed with --debug > > currently the shortest Variant: > ---------------- > (let ((f (lambda (g) (delay (g))))) > (force (f error))) > ---------------- I believe the patch below is the correct fix for this. Please test and/or comment! Regards, Neil Index: libguile/ChangeLog =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /cvsroot/guile/guile/guile-core/libguile/ChangeLog,v retrieving revision 1.2412 diff -u -r1.2412 ChangeLog --- libguile/ChangeLog 17 Oct 2007 21:56:09 -0000 1.2412 +++ libguile/ChangeLog 18 Oct 2007 23:26:19 -0000 @@ -1,3 +1,9 @@ +2007-10-19 Neil Jerram + + * eval.c (unmemoize_delay): Extend the environment before + unmemoizing the promise thunk. This fixes a segmentation fault + reported by Frank Schwidom. + 2007-10-17 Ludovic Court=C3=A8s =20 * read.c (CHAR_IS_BLANK_): Add `\r' (ASCII 0x0d). This fixes a Index: libguile/eval.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /cvsroot/guile/guile/guile-core/libguile/eval.c,v retrieving revision 1.418 diff -u -r1.418 eval.c --- libguile/eval.c 29 Jul 2007 15:16:46 -0000 1.418 +++ libguile/eval.c 18 Oct 2007 23:26:23 -0000 @@ -1268,7 +1268,13 @@ unmemoize_delay (const SCM expr, const SCM env) { const SCM thunk_expr =3D SCM_CADDR (expr); - return scm_list_2 (scm_sym_delay, unmemoize_expression (thunk_expr, env)= ); + /* A promise is implemented as a closure, and when applying a + closure the evaluator adds a new frame to the environment - even + though, in the case of a promise, the added frame is always + empty. We need to extend the environment here in the same way, + so that any ILOCs in thunk_expr can be unmemoized correctly. */ + const SCM new_env =3D SCM_EXTEND_ENV (SCM_EOL, SCM_EOL, env); + return scm_list_2 (scm_sym_delay, unmemoize_expression (thunk_expr, new_= env)); } =20 =20 Index: test-suite/ChangeLog =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /cvsroot/guile/guile/guile-core/test-suite/ChangeLog,v retrieving revision 1.407 diff -u -r1.407 ChangeLog --- test-suite/ChangeLog 17 Oct 2007 21:56:10 -0000 1.407 +++ test-suite/ChangeLog 18 Oct 2007 23:26:32 -0000 @@ -1,3 +1,10 @@ +2007-10-19 Neil Jerram + + * standalone/test-use-srfi: Use -q to avoid picking up the user's + ~/.guile file. + + * tests/eval.test (promises)[unmemoizing a promise]: New test. + 2007-10-17 Ludovic Court=C3=A8s =20 * tests/reader.test (reading)[CR recognized as a token Index: test-suite/standalone/test-use-srfi =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /cvsroot/guile/guile/guile-core/test-suite/standalone/test-use-sr= fi,v retrieving revision 1.2 diff -u -r1.2 test-use-srfi --- test-suite/standalone/test-use-srfi 15 Jan 2007 23:48:21 -0000 1.2 +++ test-suite/standalone/test-use-srfi 18 Oct 2007 23:26:32 -0000 @@ -19,14 +19,14 @@ =20 # Test that two srfi numbers on the command line work. # -guile --use-srfi=3D1,10 >/dev/null </dev/null </dev/null </dev/null </dev/null </dev/null <