chicken-users
[Top][All Lists]
Advanced

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

Re: [Chicken-users] Segmentation violation with chicken 5.1.0


From: Peter Bex
Subject: Re: [Chicken-users] Segmentation violation with chicken 5.1.0
Date: Sun, 23 Jun 2019 14:51:21 +0200
User-agent: NeoMutt/20170113 (1.7.2)

On Sun, Jun 23, 2019 at 02:33:10PM +0200, Peter Bex wrote:
> [panic] Low-level type assertion 
> C_blockp((C_word)C_VAL1(C__PREV_TMPST.n1))=#t failed at chickenprob3.c:93488 
> - execution terminated

Here's a minimal reproducible testcase:

(define (test-it)
  (let loop ((done #f))
    (if done
        '()
        (cons  (or (read) 0.0) (loop #t)))))

(print (test-it))

This generates exactly the same construct:
f0=C_flonum_magnitude((C_truep(t1)?t1:lf[1]));

If you type in a fixnum integer, this will break too.

I've filed a bug to track this: https://bugs.call-cc.org/ticket/1624


A quick workaround for your program might be to return the 0.0 from a
foreign lambda, like so:

(define return-zero
  (foreign-lambda* float () "C_return(0.0);"))

(define (test-it)
  (let loop ((done #f))
    (if done
        '()
        (cons  (or (read) (return-zero)) (loop #t)))))

(print (test-it))

It's stupid, but it works.

Cheers,
Peter

Attachment: signature.asc
Description: PGP signature


reply via email to

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