[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Chicken-hackers] [PATCH] Incorrect scrutiny type for string-list an
Re: [Chicken-hackers] [PATCH] Incorrect scrutiny type for string-list and question about location c-pointer conversions
Wed, 16 May 2012 09:06:01 +0200 (CEST)
> Recently, Mario set up Salmonella so that it ran with -specialize, so
> we could catch any last-minute bugs in the scrutinizer. You can see
> the results here: http://parenteses.org/mario/misc/specialize-report/
Really nice. Well done, folks!
> The first bug is simple, and was found pretty quickly; eggs that use
> the new(ish) foreign type specifiers "c-string-list" and "c-string-list*"
> get a warning. See here:
> $ cat test.scm
> (print (car ((foreign-lambda* c-string-list () "C_return(NULL);"))))
> $ csc -scrutinize test.scm
> Warning: at toplevel:
> (test.scm:1) in procedure call to `car', expected argument #1 of type
> `pair', but was given an argument of type `(or boolean pointer locative)'
> Of course, that's incorrect since c-string-list *always* returns a list
> of string objects (which can be easily seen in the code, see the
> ##sys#peek-c-string-list and ##sys#peek-and-free-c-string-list
> procedures in library.scm:4229 and below). The patch fixes this.
The patch wasn't accepted by "git am" but I applied it manually and pushed.
> The second problem has to do with NULL pointer values in locations.
> When you use let-location or define-foreign-variable and declare a
> pointer type, you can set it to a NULL value by setting it to #f in
> Scheme and this works correctly. However, the scrutinizer thinks
> that's bad:
> If we agree on this, we can make this into a Trac ticket for 4.9.0.
Yes, please do.