Follow-up Comment #1, bug #33362 (project guile): Entering the offending code in a function, f, and disassembled it leading to, > ,x f ... Disassembly of #<procedure t (x) | (x y)>:
0 (br-if-nargs-ne 0 1 :L997) ;; -> 21 6 (reserve-locals 0 1) 9 (local-ref 0) ;; `x' 11 (object-ref 1) ;; y 13 (local-set 1) 15 (local-set 0) ;; `x' 17 (br :L998) ;; -> 23 21 (assert-nargs-ee/locals 2) ... This results in error behavior as stated. Now increasing the reservation by one in (reserve-locals 0 1) with a hex editor fixes the problem and the object code runs just fine. So probably when y is used in the case lambda with fewer used arguments the compiler misses the number of reservations of the stack that is needed. So later when the code calls a function and stack space is needed some undefined behavior results e.g. a crash. Solution? The problem is in the tree-il compilation code. The allocation of number of locals needs to be adjusted for the self referential parts. consider to store the suggested value, v, as (alloc new v ncarg). Then when compiling the a self referential call with narg elements. Then we need to update acording to: new = max(new,v + max(0,narg - ncarg)) Safest is to parse the tree-il subcode for self referentials and update the local-variables and argument stack layout acordingly. _______________________________________________________ Reply to this item at: <http://savannah.gnu.org/bugs/?33362> _______________________________________________ Message sent via/by Savannah http://savannah.gnu.org/