[Ecls-list] Problem with DEFCLASS

Tobias C. Rittweiler tcr at freebits.de
Mon Nov 16 20:27:13 UTC 2009


Gabriel Dos Reis <gdr at integrable-solutions.net>
writes:

> On Sun, Nov 15, 2009 at 3:41 PM, Juan Jose Garcia-Ripoll
> <juanjose.garciaripoll at googlemail.com> wrote:
>> On Sun, Nov 15, 2009 at 9:53 PM, Gabriel Dos Reis
>> <gdr at integrable-solutions.net> wrote:
>>> On Mon, Nov 9, 2009 at 5:08 PM, Gabriel Dos Reis
>>> <gdr at integrable-solutions.net> wrote:
>>>> I believe there is a bug in the way ECL handles DEFCLASS,
>>>> but I have been unable to reduce the problem to a small testcase.
>>>
>>> Hi Junajo,
>>>
>>>  Did you get a chance to look into this?
>>
>> Yes, it is solved in CVS/git
>
> This fix led to discover another problem in ECL (unrelated to DEFCLASS).
> This time. it may be in the reader (I think).  The (SBCL) build dies
> with error
>
> ;;; Compiling (DEFVAR *FIXNUM-PRIMITIVE-TYPE* ...).
> ;;; Internal error: Reader error in file #<input stream
> #P"/home/gdr/src/sbcl.cvs/src/compiler/generic/primtype.lisp">,
> position 2931:
> ;;; #1# is undefined.
> couldn't compile "src/compiler/generic/primtype.lisp"
>
>
> Since this is billed as an internal error, I thought you would want to
> know about it :-)
> I don't know what position 2931 refers but, here is the form which
> I believe triggered the error
>
> (!def-primitive-type-alias tagged-num (:or positive-fixnum fixnum))
> (progn
>   (!def-primitive-type-alias unsigned-num #1=
>     #!+#.(cl:if (cl:= sb!vm::n-machine-word-bits 64) '(and) '(or))
>     (:or unsigned-byte-64 unsigned-byte-63 positive-fixnum)
>     #!-#.(cl:if (cl:= sb!vm::n-machine-word-bits 64) '(and) '(or))
>     (:or unsigned-byte-32 unsigned-byte-31 positive-fixnum))
>   (!def-primitive-type-alias signed-num #2=
>     #!+#.(cl:if (cl:= sb!vm::n-machine-word-bits 64) '(and) '(or))
>     (:or signed-byte-64 fixnum unsigned-byte-63 positive-fixnum)
>     #!-#.(cl:if (cl:= sb!vm::n-machine-word-bits 64) '(and) '(or))
>     (:or signed-byte-32 fixnum unsigned-byte-31 positive-fixnum))
>   (!def-primitive-type-alias untagged-num
>     (:or . #.(sort (copy-list (union (cdr '#1#) (cdr '#2#))) #'string<))))

Simpler test case:

  (let ((x '#1=(a x c))) (eq #.(second '#1#) x))

I think this can be fixed by replacing the ecl_read_object_non_recursive
by ecl_read_object in sharp_dot_reader in src/c/read.d.

Unfortunately that doesn't fix it yet, after that change:

  > (let ((x '#1=(a x c)))
      '#.(first '#1#))    
  1

Even though it should return A.

  -T.





More information about the ecl-devel mailing list