chicken-janitors
[Top][All Lists]
Advanced

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

[Chicken-janitors] #849: bind: scrutinizer problem with passing along vo


From: Chicken Trac
Subject: [Chicken-janitors] #849: bind: scrutinizer problem with passing along void result type
Date: Thu, 17 May 2012 15:06:14 -0000

#849: bind: scrutinizer problem with passing along void result type
-------------------------------+--------------------------------------------
 Reporter:  sjamaan            |       Owner:  felix
     Type:  defect             |      Status:  new  
 Priority:  not urgent at all  |   Milestone:       
Component:  unknown            |     Version:  4.7.x
 Keywords:                     |  
-------------------------------+--------------------------------------------
 The scrutinizer run of Salmonella found a problem with the "random-mtzig"
 egg, which turns out to be caused by a (small) bug in the bind egg:
 http://parenteses.org/mario/misc/specialize-report/install/random-
 mtzig.html

 A simple test:

 {{{
 (use srfi-4 bind)

 (foreign-declare "void foo(unsigned int *x, int y) { printf(\"%d %d\\n\",
 x[1], y); }")

 (bind* "void foo(unsigned int *x, ___length(x) int y);")
 }}}

 When compiling this with {{{-scrutinize}}}, I get a similar warning:
 {{{
 Warning: in toplevel procedure `foo':
   access to variable `g27' which has an undefined value
 }}}

 This is due to the fact that the {{{make-inout-wrapper}}} helper procedure
 rewrites to a {{{let}}} form which returns its value. If that's a void
 type, it returns this "undefined" value, which triggers a scrutiny
 warning.  I'm unsure whether this is actually correct (why would it be a
 bug to just pass on a value?  Using it as an argument to another procedure
 would be an actual problem)

 If this is indeed to be considered a scrutiny bug, please close this
 ticket and make a new one for Chicken.

 Meanwhile, here's a patch for {{{bind}}} if it's to be considered a bind
 bug:

 {{{
 Index: bind-translator.scm
 ===================================================================
 --- bind-translator.scm (revision 26708)
 +++ bind-translator.scm (working copy)
 @@ -895,7 +895,9 @@
                           (list tmp) )
                     ,@(filter-map (lambda (rvar io) (and (memq io '(out
 inout)) rvar))
                                   results io) )
 -                 tmp) ) )
 +                 (if (eq? rtype 'void)
 +                      '(void)
 +                      tmp)) ) )
         `(,rname ,@vars) ) ) )

  (define (length-procedure t)
 }}}

-- 
Ticket URL: <http://bugs.call-cc.org/ticket/849>
Chicken Scheme <http://www.call-with-current-continuation.org/>
Chicken Scheme is a compiler for the Scheme programming language.

reply via email to

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