From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Mark H Weaver Newsgroups: gmane.lisp.guile.bugs Subject: bug#16060: Attempt to mutate a literal pair results in segfault (master) Date: Thu, 05 Dec 2013 18:04:25 -0500 Message-ID: <87siu6kih2.fsf@netris.org> References: <52A0D66A.2070708@gmail.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1386284800 31007 80.91.229.3 (5 Dec 2013 23:06:40 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 5 Dec 2013 23:06:40 +0000 (UTC) Cc: 16060@debbugs.gnu.org To: Pieter Slabbert Original-X-From: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Fri Dec 06 00:06:44 2013 Return-path: Envelope-to: guile-bugs@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 1Voi0J-0003mf-MZ for guile-bugs@m.gmane.org; Fri, 06 Dec 2013 00:06:43 +0100 Original-Received: from localhost ([::1]:56458 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Voi0J-00040s-2b for guile-bugs@m.gmane.org; Thu, 05 Dec 2013 18:06:43 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:55744) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vohzl-0003FZ-UO for bug-guile@gnu.org; Thu, 05 Dec 2013 18:06:17 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Vohze-0005JA-G2 for bug-guile@gnu.org; Thu, 05 Dec 2013 18:06:09 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:46658) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vohze-0005J6-Dw for bug-guile@gnu.org; Thu, 05 Dec 2013 18:06:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1Vohze-0002wM-3N for bug-guile@gnu.org; Thu, 05 Dec 2013 18:06:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Mark H Weaver Original-Sender: "Debbugs-submit" Resent-CC: bug-guile@gnu.org Resent-Date: Thu, 05 Dec 2013 23:06:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 16060 X-GNU-PR-Package: guile X-GNU-PR-Keywords: Original-Received: via spool by 16060-submit@debbugs.gnu.org id=B16060.138628473611267 (code B ref 16060); Thu, 05 Dec 2013 23:06:02 +0000 Original-Received: (at 16060) by debbugs.gnu.org; 5 Dec 2013 23:05:36 +0000 Original-Received: from localhost ([127.0.0.1]:60677 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VohzC-0002ve-Cg for submit@debbugs.gnu.org; Thu, 05 Dec 2013 18:05:34 -0500 Original-Received: from world.peace.net ([96.39.62.75]:38826) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Vohz9-0002vT-8h for 16060@debbugs.gnu.org; Thu, 05 Dec 2013 18:05:32 -0500 Original-Received: from 209-6-91-212.c3-0.smr-ubr1.sbo-smr.ma.cable.rcn.com ([209.6.91.212] helo=yeeloong) by world.peace.net with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.72) (envelope-from ) id 1Vohz2-00064o-Om; Thu, 05 Dec 2013 18:05:24 -0500 In-Reply-To: <52A0D66A.2070708@gmail.com> (Pieter Slabbert's message of "Thu, 05 Dec 2013 21:39:22 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) 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-guile@gnu.org List-Id: "Bug reports for GUILE, GNU's Ubiquitous Extension Language" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Original-Sender: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.bugs:7359 Archived-At: Hi, Pieter Slabbert writes: > When I try to load a file which contains > (set-car! '(0 . ()) 1) > > Guile segfaults . > if I enter the same thing into the interpreter it works fine. According to the R5RS, it is "an error" to mutate literals, and implementations are not required to detect this error. In other words, the behavior is unspecified, like signed integer overflow in C. Currently, what happens is this: on the stable-2.0 branch, and in the interpreter on master, you are effectively modifying the code itself. In compiled code on master, literals are in read-only memory, which is why attempting to mutate it leads to a segfault. It is similar to what happens in C if you attempt to mutate a character in a string literal. Perhaps in 2.2.x we can support a debugging mode where compiled code adds extra checks, but this is a wishlist item. > I tried the same thing in chibi and it complained about try to mutate > an immutable pair. Fixed it in my code but the segfault made it a lot > harder to find > > I installed guile from git. Version gives me 2.1.0.526-7f710 The master branch of guile is very much a work-in-progress, with a major new implementation of the VM, compiler, and loader recently pushed. The ABI is not yet stabilized, which means that occasionally you may need to "make clean" and rebuild everything, including any external libraries that use libguile. For now, you might be happier with the 'stable-2.0' branch in git. Regards, Mark