bug-guile
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#16060: Attempt to mutate a literal pair results in segfault (master)


From: Mark H Weaver
Subject: bug#16060: Attempt to mutate a literal pair results in segfault (master)
Date: Thu, 05 Dec 2013 18:04:25 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux)

Hi,

Pieter Slabbert <address@hidden> 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





reply via email to

[Prev in Thread] Current Thread [Next in Thread]