Opened 13 years ago
Closed 13 years ago
#852 closed defect (fixed)
csi segfaults when playing with modules and macros
Reported by: | megane | Owned by: | sjamaan |
---|---|---|---|
Priority: | minor | Milestone: | 4.9.0 |
Component: | unknown | Version: | 4.7.x |
Keywords: | Cc: | ||
Estimated difficulty: |
Description
Crashes with master (Version 4.7.5 (rev 5fe91ae)) when run with the interpreter.
If run compiled it just raises the expected error:
"Error: unbound variable: define25"
(module foo
(bar)
(import chicken scheme)
(define-syntax bar
(ir-macro-transformer
(lambda (e i c)
`(list define)))))
(module a
*
(import chicken scheme)
(import foo)
(bar))
Change History (5)
comment:1 Changed 13 years ago by
comment:2 Changed 13 years ago by
Milestone: | 4.8.0 → 4.9.0 |
---|
comment:3 Changed 13 years ago by
I retract that statement: the printer's fine. The macro expander's fine too. It's the interpreter (closure compiler) which goes wrong when finally trying to look up the variable in the syntactic environment after the macro has been expanded.
It finds the actual macro transformer object there, but it shouldn't return that. The compiler does something similar but it pretends not to find anything since macros aren't first-class so can't be returned as variables.
A fix has been posted to chicken-hackers.
comment:4 Changed 13 years ago by
Owner: | set to sjamaan |
---|---|
Status: | new → accepted |
comment:5 Changed 13 years ago by
Resolution: | → fixed |
---|---|
Status: | accepted → closed |
Works on Version 4.7.5 (rev bd1d0fc).
The problem here is that bar returns the actual macro transformer procedure bound to
define
. In the compiler, that doesn't work because macro transformers aren't available as first-class procedures in the compiler (unless you make them available somehow).You *might* be able to see this by modifying it to an er-macro-transformer:
This code crashes in master (w/ debugbuild), but shows the following in 4.7.0 (w/o debugbuild):
That's how macro transformers are currently printed ;)
The segfault is a problem in the printer, not in the macro transformer.