[Ecls-list] ECL stack overflow in CMP::SIMILAR-CFORM

Samium Gromoff _deepfire at feelingofgreen.ru
Thu Sep 30 21:07:12 UTC 2010


On Thu, 30 Sep 2010 23:31:51 +0400, Samium Gromoff <_deepfire at feelingofgreen.ru> wrote:
> Juan,
> 
> compiling a file containing:
> 
> (defun bar ()
>   (labels ((rec (x)
> 	     (rec x)))))
> 
> (defun foo ()
>   (labels ((rec (x)
>              (rec x)))))
> 
> yields:
> 
> $ ecl.exe -eval '(compile-file "../foo.lisp")' -eval '(si:quit)'
> ;;; Loading #P"d:/usr/src/ecl-bin/cmp.fas"
> ;;;
> ;;; Compiling ../foo.lisp.
> ;;; OPTIMIZE levels: Safety=2, Space=0, Speed=3, Debug=0
> ;;;
> ;;; Compiling (DEFUN BAR ...).
> ;;; Compiling (DEFUN FOO ...).
> ;;; Internal error:
> ;;;   in file foo.lisp, position 53
> ;;;   at (DEFUN FOO ...)
> ;;;   ** C-STACK overflow at size 557056. Stack can probably be resized.
> 
> Experimentation tells that following conditions must hold for the error
> to manifest itself:
> 
>   - the names of the functions established by LABELS must coincide
>   - the bodies of the functions established by LABELS function bodies
>     must be the same

Not quite absolutely necessarily the same, it appears that /some/
variance in certain specific places retains the error.  For example, the
original function definitions which tripped this error were:

(defun leftmost (tree)
  (labels ((rec (sub)
	     (if (consp sub)
		 (rec (car sub))     <=========
		 sub)))
    (let ((r (rec (tree-root tree))))
      (if (plug-p r)
          (seek-plugs r #'leaf-next)
          r))))

(defun rightmost (tree)
  (labels ((rec (sub)
             (if (consp sub)
                 (rec (cdr sub))     <=========
                 sub)))
    (let ((r (rec (tree-root tree))))
      (if (plug-p r)
          (seek-plugs r #'leaf-prev)
          r))))

I.e. there was some variation indeed -- CAR vs. CDR.

-- 
regards,
  Samium Gromoff
--
"Actually I made up the term 'object-oriented', and I can tell you I
did not have C++ in mind." - Alan Kay (OOPSLA 1997 Keynote)




More information about the ecl-devel mailing list