Opened 12 years ago

Closed 12 years ago

#842 closed defect (fixed)

trace: Procedure called with incorrect number of arguments (but still magically works)

Reported by: sjamaan Owned by: felix winkelmann
Priority: minor Milestone:
Component: extensions Version: 4.7.x
Keywords: Cc:
Estimated difficulty:

Description (last modified by sjamaan)

The trace egg calls its walk-module procedure with two arguments, but accepts exactly three arguments.

I don't understand why it still works, though:

$ csi
#;1> (use trace)
#;2> (module foo (bar) (import chicken scheme) (define (bar x) (+ x 1)))
#;3> (trace-module 'foo)
; tracing bar

Perhaps the extra argument gets "optimized" away because it is never used? I'd normally say this is a bug in the compiler, but it does warn when you enable scrutiny so it's probably fine to keep the compiler the way it is.

Since the third argument isn't used, I think this patch should be fine, which simply removes the extra argument:

Index: trace.scm
===================================================================
--- trace.scm	(revision 26685)
+++ trace.scm	(working copy)
@@ -223,7 +223,7 @@
      ((if (traced? proc) do-untrace do-trace) (list proc)))
    procs))
 
-(define (walk-module mname proc warn)
+(define (walk-module mname proc)
   (let* ((m (##sys#find-module mname))
 	 (exps (nth-value 1 (##sys#module-exports m))))
     (for-each

By the way, the trace module has no author field in the meta-file. If you don't want to maintain it, maybe you can just put in "the chicken team" or something.

This was found by Mario's specialization run of salmonella: http://parenteses.org/mario/misc/specialize-report/install/trace.html

Change History (2)

comment:1 Changed 12 years ago by sjamaan

Description: modified (diff)

comment:2 Changed 12 years ago by felix winkelmann

Resolution: fixed
Status: newclosed

Thanks for reporting this. I have tagged a new version (0.7). The extra argument is not used so I think you're right in that it will be optimized away.

Note: See TracTickets for help on using tickets.