chicken-users
[Top][All Lists]
Advanced

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

[Chicken-users] let-location


From: Nico Amtsberg
Subject: [Chicken-users] let-location
Date: Fri, 9 Jun 2006 08:13:07 +0000 (UTC)
User-agent: slrn/0.9.8.1pl1 (Debian)

Hello everyone!

I have a problem with let-location. In the small program below, values
stored in a location get overwritten by strange values after some amount of
time. 
IMO this should not happen.
If I enable the garbage collector in this small program, the error seems to
be gone. But in our application, the error occurs even with major garbage
collector runs.

Any suggests or comments on this?

Regards
Nico Amtsberg

(declare (usual-integrations))
(require-extension srfi-1)
#>
long fill_10(long i, long *o0, long *o1, long *o2, long *o3, long *o4,
                     long *o5, long *o6, long *o7, long *o8, long *o9)
{
 *o0=*o1=*o2=*o3=*o4=*o5=*o6=*o7=*o8=*o9=i;
 return i;
}
<#

(define fill-10!
  (foreign-lambda long "fill_10" long 
                  (c-pointer long) (c-pointer long) (c-pointer long)
                  (c-pointer long) (c-pointer long) (c-pointer long)
                  (c-pointer long) (c-pointer long) (c-pointer long)
                  (c-pointer long)))

(let* ((el 1)
       (expected (make-list 10 el)))
  (let loop
      ()
    ;;(gc #f)
    (let-location ((o0 long) (o1 long) (o2 long) (o3 long) (o4 long)
                   (o5 long) (o6 long) (o7 long) (o8 long) (o9 long))
       (fill-10! el
                 (location o0) (location o1) (location o2) (location o3)
                 (location o4) (location o5) (location o6) (location o7)
                 (location o8) (location o9))
       (let ((result (list o0 o1 o2 o3 o4 o5 o6 o7 o8 o9)))
         (if (not (equal? result expected))
             (error "strange values: " result)
             (loop))))))





reply via email to

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