Opened 6 years ago

Closed 6 years ago

#1493 closed defect (fixed)

Something goes haywire while walking ##core#define-syntax

Reported by: megane Owned by:
Priority: major Milestone: 5.0
Component: expander Version: 5.0.0
Keywords: environment Cc:
Estimated difficulty: medium

Description

Put (assert (symbol? sym)) in ##sys#register-syntax-export` to get an assertion failure.

$ ./run.sh 
::::::::::::::
m1.scm
::::::::::::::
(module
 m1
 (foo)
 (import scheme)
 (cond-expand
  (chicken-5 (import (chicken base)))
  (else (import chicken)))

 (define-syntax foo
   (ir-macro-transformer
    (lambda (e i cmp)
      (apply
       (lambda (name)
         `(define-syntax ,(strip-syntax name)
            (syntax-rules () ((_ . _) (void)))))
       (cdr e)))))

 )
::::::::::::::
main.scm
::::::::::::::
(cond-expand
 (chicken-5 (import m1))
 (else (use m1)))

(foo foo)
(foo foo)
::::::::::::::
run.sh
::::::::::::::
#!/usr/bin/env bash
set -e
set -o pipefail
rm -rf *.so *.import.*
more * | cat
echo "################################################################################"
csc -J -s m1.scm
csi -version
csi -qbn  main.scm
################################################################################
CHICKEN
(c) 2008-2018, The CHICKEN Team
(c) 2000-2007, Felix L. Winkelmann
Version 5.0.0 (rev ea1202b)
linux-unix-gnu-x86-64 [ 64bit dload ptables ]

[panic] Low-level type assertion (C_header_size(C_VAL1(sym))>(C_VAL2(2))) failed at runtime.c:12135 - execution terminated

...more...
<syntax>
<syntax>
<syntax>
<syntax>
<syntax>
<syntax>
<syntax>
<syntax>
<syntax>
<syntax>
<syntax>
<syntax>
<syntax>
<syntax>
<syntax>
<eval> 	<--

Attachments (1)

lookup-fix.patch (696 bytes) - added by megane 6 years ago.
provisional patch

Download all attachments as: .zip

Change History (6)

Changed 6 years ago by megane

Attachment: lookup-fix.patch added

provisional patch

comment:1 Changed 6 years ago by megane

This seems to fix the issue, but maybe the ##core#macro-alias has to be update also when walking ##core#define-syntax?

Version 0, edited 6 years ago by megane (next)

comment:2 Changed 6 years ago by sjamaan

Something tells me the attached patch shouldn't work if we're actually looking for a macro.

comment:3 Changed 6 years ago by sjamaan

Also, I think current-environment may contain macros as well, which will break in the same way (think let-syntax)

comment:4 Changed 6 years ago by sjamaan

Oh, never mind, find-id skips those. So maybe your fix is correct after all

comment:5 Changed 6 years ago by evhan

Resolution: fixed
Status: newclosed

Fixed by 2029fcae (master) and 5f2c3ae6 (chicken-4).

Note: See TracTickets for help on using tickets.