chicken-users
[Top][All Lists]
Advanced

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

Re: [Bug] csc infinitely loops on expansion of macro that csi expandsno


From: felix . winkelmann
Subject: Re: [Bug] csc infinitely loops on expansion of macro that csi expandsnormally
Date: Mon, 30 Dec 2024 22:06:44 +0100

> Hello,
>
> csc enters an infinite loop attempting to expand the following:
>
>       (define-syntax make-alist
>         (syntax-rules ()
>           ((make-alist (key val) ...)
>            (list (cons key val) ...))))
>
>       (display (caar (make-alist ("cons" cons))))
>       (newline)
>

This is indeed a bug, a non-terminating loop attempting to resolve a type 
variable.
The change below should remove the problem. I will submit the patch to our
maintainers mailing list and make sure it ends up in the old CHICKEN 5 branch
and the one for the new CHICKEN version (6).

Thanks for your report. It surprises me that this did not come up earlier. 
Somehow
the particular code you have tested ends up with some weird recursive type that
somehow trips up the type resolution. The "scrutinizer" (type analysis pass)
in CHICKEN is a bit of a mess - too many people have hacked on it for too long.

Anyway, much appreciated!


cheers,
felix
---

diff --git a/scrutinizer.scm b/scrutinizer.scm
index a8a78852..59f5a4a0 100644
--- a/scrutinizer.scm
+++ b/scrutinizer.scm
@@ -1573,6 +1573,7 @@
             (lambda (a)
               (let ((t2 (second a)))
                 (if (or (not t2)
+                               (memq t done)
                         (memq t2 done)) ; circular reference
                     (if (third a)
                         (resolve (third a) (cons t done))




reply via email to

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