Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Segfault in Scheme interpreter when calling subtract with a closure #306

Open
amosr opened this issue Dec 12, 2017 · 0 comments
Open

Segfault in Scheme interpreter when calling subtract with a closure #306

amosr opened this issue Dec 12, 2017 · 0 comments

Comments

@amosr
Copy link

amosr commented Dec 12, 2017

Hi,

I found a case where trying to apply (-) to a closure produces a segfault.
It's a silly program, but I did accidentally write it. I figure it should give a type error, not a segfault.

(define make-closure
  (lambda ()
    (let* ((offset 0)
           (beat-pos (lambda (x1) ())))
      (lambda () ()))))

(define closure (make-closure))
(- closure)

The fact that there is a let-bound closure variable referring to a lambda is interesting: it doesn't segfault if I change it to a number.

If I run the extempore in lldb, I get this information.

* thread #1, name = 'SP_task', queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=2, address=0x7fff5f3fff28)
    frame #0: 0x000000010000c9ee extempore`std::__1::ostreambuf_iterator<char, std::__1::char_traits<char> > std::__1::__pad_and_output<char, std::__1::char_traits<char> >(__s=ostreambuf_iterator<char, std::__1::char_traits<char> > @ 0x00007fff5f3fff28, __ob=<unavailable>, __op=<unavailable>, __oe=<unavailable>, __iob=<unavailable>, __fl=<unavailable>) at locale:1329
   1326	__pad_and_output(ostreambuf_iterator<_CharT, _Traits> __s,
   1327	                 const _CharT* __ob, const _CharT* __op, const _CharT* __oe,
   1328	                 ios_base& __iob, _CharT __fl)
-> 1329	{
   1330	    if (__s.__sbuf_ == nullptr)
   1331	        return __s;
   1332	    streamsize __sz = __oe - __ob;

I can only guess, maybe it's printing the type error and doing something bad.

This is with master extempore on OSX.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant