Summary

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

Metadata

Attachments

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> 	<--

Changes and comments

[2018-07-31 11:37:27 UTC] megane attached lookup-fix.patch (description=provisional patch)

[2018-07-31 11:39:31 UTC] megane wrote:

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

[2018-07-31 11:39:31 UTC] megane wrote:

1533030016755388

[2018-08-04 10:54:39 UTC] sjamaan wrote:

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

[2018-08-04 10:55:37 UTC] sjamaan wrote:

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

[2018-08-04 10:57:37 UTC] sjamaan wrote:

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

[2018-08-05 01:53:40 UTC] evhan changed status from new to closed

[2018-08-05 01:53:40 UTC] evhan set resolution to fixed

[2018-08-05 01:53:40 UTC] evhan wrote:

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